lib/apple-news/article.rb in apple-news-0.2.5 vs lib/apple-news/article.rb in apple-news-0.3.0

- old
+ new

@@ -32,17 +32,22 @@ @state = data['state'] hydrate! if !id.nil? && data.keys.size == 0 end + def reload + return false if id.nil? + hydrate! + end + 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') + @share_url = data.delete('shareUrl') @state = data.delete('state') load_properties(data) end end