@@ -9,11 +9,11 @@ public class ParselyMetadata {
99 var section : String ?
1010 var tags : Array < String > ?
1111 var duration : TimeInterval ?
12-
12+
1313 /**
1414 A class to manage and re-use metadata. Metadata contained in an instance of this
1515 class will conform to Parsely's schema.
16-
16+
1717 - Parameter canonical_url: A post's canonical url. For videos, it is overridden with the vId and thus can be omitted.
1818 - Parameter pub_date: Date this piece of content was published.
1919 - Parameter title: Title of the content.
@@ -22,15 +22,15 @@ public class ParselyMetadata {
2222 - Parameter section: Same as section for website integration.
2323 - Parameter tags: Up to 20 tags on an event are allowed.
2424 - Parameter duration: Durations passed explicitly to trackVideoStart take precedence over any in metadata.
25- */
25+ */
2626 public init ( canonical_url: String ? = nil ,
27- pub_date: Date ? = nil ,
28- title: String ? = nil ,
29- authors: Array < String > ? = nil ,
30- image_url: String ? = nil ,
31- section: String ? = nil ,
32- tags: Array < String > ? = nil ,
33- duration: TimeInterval ? = nil ) {
27+ pub_date: Date ? = nil ,
28+ title: String ? = nil ,
29+ authors: Array < String > ? = nil ,
30+ image_url: String ? = nil ,
31+ section: String ? = nil ,
32+ tags: Array < String > ? = nil ,
33+ duration: TimeInterval ? = nil ) {
3434 self . canonical_url = canonical_url
3535 self . pub_date = pub_date
3636 self . title = title
@@ -40,15 +40,15 @@ public class ParselyMetadata {
4040 self . tags = tags
4141 self . duration = duration
4242 }
43-
43+
4444 func toDict( ) -> Dictionary < String , Any > {
4545 var metas : Dictionary < String , Any > = [ : ]
46-
46+
4747 if let canonical_url {
4848 metas [ " link " ] = canonical_url
4949 }
5050 if let pub_date {
51- metas [ " pub_date " ] = String ( format: " %i " , pub_date. millisecondsSince1970)
51+ metas [ " pub_date " ] = String ( format: " %i " , pub_date. millisecondsSince1970)
5252 }
5353 if let title {
5454 metas [ " title " ] = title
@@ -68,7 +68,7 @@ public class ParselyMetadata {
6868 if let duration {
6969 metas [ " duration " ] = duration
7070 }
71-
71+
7272 return metas
7373 }
7474}
0 commit comments