Class: Sportradar::Api::Content::Article
- Defined in:
- lib/sportradar/api/content/article.rb
Instance Attribute Summary collapse
-
#byline ⇒ Object
Returns the value of attribute byline.
-
#content ⇒ Object
Returns the value of attribute content.
-
#created ⇒ Object
Returns the value of attribute created.
-
#credit ⇒ Object
Returns the value of attribute credit.
-
#dateline ⇒ Object
Returns the value of attribute dateline.
-
#injury ⇒ Object
Returns the value of attribute injury.
-
#provider ⇒ Object
Returns the value of attribute provider.
-
#references ⇒ Object
Returns the value of attribute references.
-
#response ⇒ Object
Returns the value of attribute response.
-
#title ⇒ Object
Returns the value of attribute title.
-
#transaction ⇒ Object
Returns the value of attribute transaction.
-
#type ⇒ Object
Returns the value of attribute type.
-
#updated ⇒ Object
Returns the value of attribute updated.
Instance Method Summary collapse
-
#initialize(data) ⇒ Article
constructor
A new instance of Article.
- #injury? ⇒ Boolean
- #transaction? ⇒ Boolean
Methods inherited from Data
#all_attributes, #attributes, #create_data, #parse_into_array, #parse_into_array_with_options, #parse_out_hashes, #structure_links, #update_data
Constructor Details
#initialize(data) ⇒ Article
Returns a new instance of Article.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/sportradar/api/content/article.rb', line 6 def initialize(data) @response = data @created = Time.parse(data["created"]) if data["created"] @updated = Time.parse(data["updated"]) if data["updated"] @type = data["type"] @injury = data["injury"] @transaction = data["transaction"] @title = data["title"] @byline = data["byline"] @dateline = data["dateline"] @credit = data["credit"] @content = data["content"]["long"] if data["content"] && data["content"]["long"] @provider = OpenStruct.new(data["provider"]) if data["provider"] @references = parse_into_array(selector: response["refs"], klass: Sportradar::Api::Content::Reference) if response["refs"] end |
Instance Attribute Details
#byline ⇒ Object
Returns the value of attribute byline.
4 5 6 |
# File 'lib/sportradar/api/content/article.rb', line 4 def @byline end |
#content ⇒ Object
Returns the value of attribute content.
4 5 6 |
# File 'lib/sportradar/api/content/article.rb', line 4 def content @content end |
#created ⇒ Object
Returns the value of attribute created.
4 5 6 |
# File 'lib/sportradar/api/content/article.rb', line 4 def created @created end |
#credit ⇒ Object
Returns the value of attribute credit.
4 5 6 |
# File 'lib/sportradar/api/content/article.rb', line 4 def credit @credit end |
#dateline ⇒ Object
Returns the value of attribute dateline.
4 5 6 |
# File 'lib/sportradar/api/content/article.rb', line 4 def dateline @dateline end |
#injury ⇒ Object
Returns the value of attribute injury.
4 5 6 |
# File 'lib/sportradar/api/content/article.rb', line 4 def injury @injury end |
#provider ⇒ Object
Returns the value of attribute provider.
4 5 6 |
# File 'lib/sportradar/api/content/article.rb', line 4 def provider @provider end |
#references ⇒ Object
Returns the value of attribute references.
4 5 6 |
# File 'lib/sportradar/api/content/article.rb', line 4 def references @references end |
#response ⇒ Object
Returns the value of attribute response.
4 5 6 |
# File 'lib/sportradar/api/content/article.rb', line 4 def response @response end |
#title ⇒ Object
Returns the value of attribute title.
4 5 6 |
# File 'lib/sportradar/api/content/article.rb', line 4 def title @title end |
#transaction ⇒ Object
Returns the value of attribute transaction.
4 5 6 |
# File 'lib/sportradar/api/content/article.rb', line 4 def transaction @transaction end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/sportradar/api/content/article.rb', line 4 def type @type end |
#updated ⇒ Object
Returns the value of attribute updated.
4 5 6 |
# File 'lib/sportradar/api/content/article.rb', line 4 def updated @updated end |
Instance Method Details
#injury? ⇒ Boolean
26 27 28 |
# File 'lib/sportradar/api/content/article.rb', line 26 def injury? injury == 'true' end |
#transaction? ⇒ Boolean
22 23 24 |
# File 'lib/sportradar/api/content/article.rb', line 22 def transaction? transaction == 'true' end |