Class: Feedjira::Parser::JSONFeedItem
- Inherits:
-
Object
- Object
- Feedjira::Parser::JSONFeedItem
- Includes:
- FeedEntryUtilities
- Defined in:
- lib/feedjira/parser/json_feed_item.rb
Overview
Parser for dealing with JSON Feed items.
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#banner_image ⇒ Object
readonly
Returns the value of attribute banner_image.
-
#categories ⇒ Object
readonly
Returns the value of attribute categories.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#entry_id ⇒ Object
readonly
Returns the value of attribute entry_id.
-
#external_url ⇒ Object
readonly
Returns the value of attribute external_url.
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#json ⇒ Object
readonly
Returns the value of attribute json.
-
#published ⇒ Object
readonly
Returns the value of attribute published.
-
#summary ⇒ Object
readonly
Returns the value of attribute summary.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#updated ⇒ Object
readonly
Returns the value of attribute updated.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(json) ⇒ JSONFeedItem
constructor
A new instance of JSONFeedItem.
Methods included from FeedEntryUtilities
#[], #[]=, #each, #id, #parse_datetime, #published=, #sanitize!, #updated=
Constructor Details
#initialize(json) ⇒ JSONFeedItem
Returns a new instance of JSONFeedItem.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/feedjira/parser/json_feed_item.rb', line 12 def initialize(json) @json = json @entry_id = json.fetch("id") @url = json.fetch("url") @external_url = json.fetch("external_url", nil) @title = json.fetch("title", nil) @content = parse_content(json.fetch("content_html", nil), json.fetch("content_text", nil)) @summary = json.fetch("summary", nil) @image = json.fetch("image", nil) @banner_image = json.fetch("banner_image", nil) @published = parse_published(json.fetch("date_published", nil)) @updated = parse_updated(json.fetch("date_modified", nil)) @author = (json.fetch("author", nil)) @categories = json.fetch("tags", []) end |
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
9 10 11 |
# File 'lib/feedjira/parser/json_feed_item.rb', line 9 def @author end |
#banner_image ⇒ Object (readonly)
Returns the value of attribute banner_image.
9 10 11 |
# File 'lib/feedjira/parser/json_feed_item.rb', line 9 def @banner_image end |
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
9 10 11 |
# File 'lib/feedjira/parser/json_feed_item.rb', line 9 def categories @categories end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
9 10 11 |
# File 'lib/feedjira/parser/json_feed_item.rb', line 9 def content @content end |
#entry_id ⇒ Object (readonly)
Returns the value of attribute entry_id.
9 10 11 |
# File 'lib/feedjira/parser/json_feed_item.rb', line 9 def entry_id @entry_id end |
#external_url ⇒ Object (readonly)
Returns the value of attribute external_url.
9 10 11 |
# File 'lib/feedjira/parser/json_feed_item.rb', line 9 def external_url @external_url end |
#image ⇒ Object (readonly)
Returns the value of attribute image.
9 10 11 |
# File 'lib/feedjira/parser/json_feed_item.rb', line 9 def image @image end |
#json ⇒ Object (readonly)
Returns the value of attribute json.
9 10 11 |
# File 'lib/feedjira/parser/json_feed_item.rb', line 9 def json @json end |
#published ⇒ Object (readonly)
Returns the value of attribute published.
9 10 11 |
# File 'lib/feedjira/parser/json_feed_item.rb', line 9 def published @published end |
#summary ⇒ Object (readonly)
Returns the value of attribute summary.
9 10 11 |
# File 'lib/feedjira/parser/json_feed_item.rb', line 9 def summary @summary end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
9 10 11 |
# File 'lib/feedjira/parser/json_feed_item.rb', line 9 def title @title end |
#updated ⇒ Object (readonly)
Returns the value of attribute updated.
9 10 11 |
# File 'lib/feedjira/parser/json_feed_item.rb', line 9 def updated @updated end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
9 10 11 |
# File 'lib/feedjira/parser/json_feed_item.rb', line 9 def url @url end |