Class: MediumToWebflow::Medium::Post
- Inherits:
-
Object
- Object
- MediumToWebflow::Medium::Post
- Defined in:
- lib/medium_to_webflow/medium/post.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#category ⇒ Object
readonly
Returns the value of attribute category.
-
#guid ⇒ Object
readonly
Returns the value of attribute guid.
-
#image_url ⇒ Object
readonly
Returns the value of attribute image_url.
-
#published_at ⇒ Object
readonly
Returns the value of attribute published_at.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Post
constructor
A new instance of Post.
Constructor Details
#initialize(attributes) ⇒ Post
Returns a new instance of Post.
10 11 12 13 14 15 16 17 18 |
# File 'lib/medium_to_webflow/medium/post.rb', line 10 def initialize(attributes) @title = attributes[:title] @url = attributes[:url] @published_at = attributes[:published_at] @author = attributes[:author] @image_url = attributes[:image_url] @category = attributes[:category] @guid = attributes[:guid] end |
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
8 9 10 |
# File 'lib/medium_to_webflow/medium/post.rb', line 8 def @author end |
#category ⇒ Object (readonly)
Returns the value of attribute category.
8 9 10 |
# File 'lib/medium_to_webflow/medium/post.rb', line 8 def category @category end |
#guid ⇒ Object (readonly)
Returns the value of attribute guid.
8 9 10 |
# File 'lib/medium_to_webflow/medium/post.rb', line 8 def guid @guid end |
#image_url ⇒ Object (readonly)
Returns the value of attribute image_url.
8 9 10 |
# File 'lib/medium_to_webflow/medium/post.rb', line 8 def image_url @image_url end |
#published_at ⇒ Object (readonly)
Returns the value of attribute published_at.
8 9 10 |
# File 'lib/medium_to_webflow/medium/post.rb', line 8 def published_at @published_at end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
8 9 10 |
# File 'lib/medium_to_webflow/medium/post.rb', line 8 def title @title end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
8 9 10 |
# File 'lib/medium_to_webflow/medium/post.rb', line 8 def url @url end |
Class Method Details
.from_rss(item) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/medium_to_webflow/medium/post.rb', line 21 def from_rss(item) new( title: item.title, url: item.link, published_at: item.pubDate, author: item. || item.dc_creator, image_url: extract_image_url(item.content_encoded, item.description), category: humanize_category(item.categories&.first&.content), guid: extract_guid(item.guid.content) ) end |