Class: Mediumite::Post
- Inherits:
-
Object
- Object
- Mediumite::Post
- Defined in:
- lib/mediumite/post.rb
Instance Method Summary collapse
-
#initialize(content) ⇒ Post
constructor
A new instance of Post.
- #publication_id ⇒ Object
- #to_json ⇒ Object
- #under_publication? ⇒ Boolean
Constructor Details
#initialize(content) ⇒ Post
Returns a new instance of Post.
5 6 7 |
# File 'lib/mediumite/post.rb', line 5 def initialize(content) @content = content end |
Instance Method Details
#publication_id ⇒ Object
9 10 11 |
# File 'lib/mediumite/post.rb', line 9 def publication_id @content[:publication_id] end |
#to_json ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/mediumite/post.rb', line 17 def to_json { title: @content[:title], contentFormat: @content[:format] ||= "markdown", content: @content[:body], canonicalUrl: @content[:canonical_url], tags: @content[:tags], publishStatus: @content[:publish_status] ||= "draft" }.to_json end |
#under_publication? ⇒ Boolean
13 14 15 |
# File 'lib/mediumite/post.rb', line 13 def under_publication? !!@content[:publication_id] end |