Class: AppleNews::Article
- Inherits:
-
Object
- Object
- AppleNews::Article
- Includes:
- Attachments, Persistence, Properties, Resource
- Defined in:
- lib/apple-news/article.rb,
lib/apple-news/article/attachments.rb,
lib/apple-news/article/persistence.rb
Defined Under Namespace
Modules: Attachments, Persistence
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#document ⇒ Object
Returns the value of attribute document.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#modified_at ⇒ Object
readonly
Returns the value of attribute modified_at.
-
#share_url ⇒ Object
readonly
Returns the value of attribute share_url.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#warnings ⇒ Object
readonly
Returns the value of attribute warnings.
Instance Method Summary collapse
-
#initialize(id = nil, data = {}, config = AppleNews.config) ⇒ Article
constructor
A new instance of Article.
- #reload ⇒ Object
Methods included from Properties
Constructor Details
#initialize(id = nil, data = {}, config = AppleNews.config) ⇒ Article
Returns a new instance of Article.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/apple-news/article.rb', line 19 def initialize(id = nil, data = {}, config = AppleNews.config) assign_data(data) @id = id @config = config @resource_path = '/articles' @files = {} hydrate! if id.present? && data.blank? end |
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
16 17 18 |
# File 'lib/apple-news/article.rb', line 16 def created_at @created_at end |
#document ⇒ Object
Returns the value of attribute document.
17 18 19 |
# File 'lib/apple-news/article.rb', line 17 def document @document end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
16 17 18 |
# File 'lib/apple-news/article.rb', line 16 def id @id end |
#modified_at ⇒ Object (readonly)
Returns the value of attribute modified_at.
16 17 18 |
# File 'lib/apple-news/article.rb', line 16 def modified_at @modified_at end |
#share_url ⇒ Object (readonly)
Returns the value of attribute share_url.
16 17 18 |
# File 'lib/apple-news/article.rb', line 16 def share_url @share_url end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
16 17 18 |
# File 'lib/apple-news/article.rb', line 16 def state @state end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
16 17 18 |
# File 'lib/apple-news/article.rb', line 16 def title @title end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
16 17 18 |
# File 'lib/apple-news/article.rb', line 16 def type @type end |
#warnings ⇒ Object (readonly)
Returns the value of attribute warnings.
16 17 18 |
# File 'lib/apple-news/article.rb', line 16 def warnings @warnings end |
Instance Method Details
#reload ⇒ Object
30 31 32 33 |
# File 'lib/apple-news/article.rb', line 30 def reload return false if id.nil? hydrate! end |