Class: Sportradar::Api::Content::Article

Inherits:
Data
  • Object
show all
Defined in:
lib/sportradar/api/content/article.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#bylineObject

Returns the value of attribute byline.



4
5
6
# File 'lib/sportradar/api/content/article.rb', line 4

def 
  @byline
end

#contentObject

Returns the value of attribute content.



4
5
6
# File 'lib/sportradar/api/content/article.rb', line 4

def content
  @content
end

#createdObject

Returns the value of attribute created.



4
5
6
# File 'lib/sportradar/api/content/article.rb', line 4

def created
  @created
end

#creditObject

Returns the value of attribute credit.



4
5
6
# File 'lib/sportradar/api/content/article.rb', line 4

def credit
  @credit
end

#datelineObject

Returns the value of attribute dateline.



4
5
6
# File 'lib/sportradar/api/content/article.rb', line 4

def 
  @dateline
end

#injuryObject

Returns the value of attribute injury.



4
5
6
# File 'lib/sportradar/api/content/article.rb', line 4

def injury
  @injury
end

#providerObject

Returns the value of attribute provider.



4
5
6
# File 'lib/sportradar/api/content/article.rb', line 4

def provider
  @provider
end

#referencesObject

Returns the value of attribute references.



4
5
6
# File 'lib/sportradar/api/content/article.rb', line 4

def references
  @references
end

#responseObject

Returns the value of attribute response.



4
5
6
# File 'lib/sportradar/api/content/article.rb', line 4

def response
  @response
end

#titleObject

Returns the value of attribute title.



4
5
6
# File 'lib/sportradar/api/content/article.rb', line 4

def title
  @title
end

#transactionObject

Returns the value of attribute transaction.



4
5
6
# File 'lib/sportradar/api/content/article.rb', line 4

def transaction
  @transaction
end

#typeObject

Returns the value of attribute type.



4
5
6
# File 'lib/sportradar/api/content/article.rb', line 4

def type
  @type
end

#updatedObject

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

Returns:

  • (Boolean)


26
27
28
# File 'lib/sportradar/api/content/article.rb', line 26

def injury?
  injury == 'true'
end

#transaction?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/sportradar/api/content/article.rb', line 22

def transaction?
  transaction == 'true'
end