Class: Finlight::RawArticle
- Inherits:
-
Object
- Object
- Finlight::RawArticle
- Defined in:
- lib/finlight/models.rb
Overview
An unenriched article as delivered by the raw stream.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#categories ⇒ Object
readonly
Returns the value of attribute categories.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#images ⇒ Object
readonly
Returns the value of attribute images.
-
#is_update ⇒ Object
readonly
Returns the value of attribute is_update.
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#link ⇒ Object
readonly
Returns the value of attribute link.
-
#publish_date ⇒ Object
readonly
Returns the value of attribute publish_date.
-
#revised_date ⇒ Object
readonly
Returns the value of attribute revised_date.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#summary ⇒ Object
readonly
Returns the value of attribute summary.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(link:, title:, publish_date:, source:, language:, summary: nil, images: nil, created_at: nil, revised_date: nil, is_update: nil, categories: nil) ⇒ RawArticle
constructor
A new instance of RawArticle.
Constructor Details
#initialize(link:, title:, publish_date:, source:, language:, summary: nil, images: nil, created_at: nil, revised_date: nil, is_update: nil, categories: nil) ⇒ RawArticle
Returns a new instance of RawArticle.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/finlight/models.rb', line 88 def initialize(link:, title:, publish_date:, source:, language:, summary: nil, images: nil, created_at: nil, revised_date: nil, is_update: nil, categories: nil, **) @link = link @title = title @publish_date = publish_date @source = source @language = language @summary = summary @images = images @created_at = created_at @revised_date = revised_date @is_update = is_update @categories = categories end |
Instance Attribute Details
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
85 86 87 |
# File 'lib/finlight/models.rb', line 85 def categories @categories end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
85 86 87 |
# File 'lib/finlight/models.rb', line 85 def created_at @created_at end |
#images ⇒ Object (readonly)
Returns the value of attribute images.
85 86 87 |
# File 'lib/finlight/models.rb', line 85 def images @images end |
#is_update ⇒ Object (readonly)
Returns the value of attribute is_update.
85 86 87 |
# File 'lib/finlight/models.rb', line 85 def is_update @is_update end |
#language ⇒ Object (readonly)
Returns the value of attribute language.
85 86 87 |
# File 'lib/finlight/models.rb', line 85 def language @language end |
#link ⇒ Object (readonly)
Returns the value of attribute link.
85 86 87 |
# File 'lib/finlight/models.rb', line 85 def link @link end |
#publish_date ⇒ Object (readonly)
Returns the value of attribute publish_date.
85 86 87 |
# File 'lib/finlight/models.rb', line 85 def publish_date @publish_date end |
#revised_date ⇒ Object (readonly)
Returns the value of attribute revised_date.
85 86 87 |
# File 'lib/finlight/models.rb', line 85 def revised_date @revised_date end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
85 86 87 |
# File 'lib/finlight/models.rb', line 85 def source @source end |
#summary ⇒ Object (readonly)
Returns the value of attribute summary.
85 86 87 |
# File 'lib/finlight/models.rb', line 85 def summary @summary end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
85 86 87 |
# File 'lib/finlight/models.rb', line 85 def title @title end |
Class Method Details
.base_attributes(hash) ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/finlight/models.rb', line 103 def self.base_attributes(hash) { link: hash["link"], title: hash["title"], publish_date: FlexTime.parse(hash["publishDate"]), source: hash["source"], language: hash["language"], summary: hash["summary"], images: ModelParsing.to_string_list(hash["images"]), created_at: FlexTime.parse(hash["createdAt"]), revised_date: FlexTime.parse(hash["revisedDate"]), is_update: hash["isUpdate"], categories: ModelParsing.to_string_list(hash["categories"]) } end |
.from_h(hash) ⇒ Object
119 120 121 |
# File 'lib/finlight/models.rb', line 119 def self.from_h(hash) new(**base_attributes(hash)) end |