lib/apple-news/article.rb in apple-news-0.2.4 vs lib/apple-news/article.rb in apple-news-0.2.5
- old
+ new
@@ -11,11 +11,11 @@
include Properties
optional_properties :is_sponsored, :is_preview, :accessory_text, :revision
optional_property :links, {}
- attr_reader :id
+ attr_reader :id, :share_url, :state
attr_accessor :document
def_delegator :@document, :title
def initialize(id = nil, data = {})
super(data)
@@ -36,10 +36,15 @@
private
def hydrate!
data = fetch_data['data']
+
+ # Some special properties that need to be manually set.
@document = Document.new(data.delete('document'))
+ @share_url = data.delete('share_url')
+ @state = data.delete('state')
+
load_properties(data)
end
end
end