Class: Sportradar::Api::Baseball::Outcome
- Defined in:
- lib/sportradar/api/baseball/outcome.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
Returns the value of attribute count.
-
#current_inning ⇒ Object
Returns the value of attribute current_inning.
-
#current_inning_half ⇒ Object
Returns the value of attribute current_inning_half.
-
#hitter ⇒ Object
Returns the value of attribute hitter.
-
#pitcher ⇒ Object
Returns the value of attribute pitcher.
-
#response ⇒ Object
Returns the value of attribute response.
-
#runners ⇒ Object
Returns the value of attribute runners.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(data, **opts) ⇒ Outcome
constructor
A new instance of Outcome.
- #update(data, source: nil, **opts) ⇒ Object
- #update_from_outcome(data) ⇒ Object
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, **opts) ⇒ Outcome
Returns a new instance of Outcome.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/sportradar/api/baseball/outcome.rb', line 7 def initialize(data, **opts) @response = data @api = opts[:api] @game = opts[:game] @scores = {} @id = data['id'] update(data, **opts) end |
Instance Attribute Details
#count ⇒ Object
Returns the value of attribute count.
5 6 7 |
# File 'lib/sportradar/api/baseball/outcome.rb', line 5 def count @count end |
#current_inning ⇒ Object
Returns the value of attribute current_inning.
5 6 7 |
# File 'lib/sportradar/api/baseball/outcome.rb', line 5 def current_inning @current_inning end |
#current_inning_half ⇒ Object
Returns the value of attribute current_inning_half.
5 6 7 |
# File 'lib/sportradar/api/baseball/outcome.rb', line 5 def current_inning_half @current_inning_half end |
#hitter ⇒ Object
Returns the value of attribute hitter.
5 6 7 |
# File 'lib/sportradar/api/baseball/outcome.rb', line 5 def hitter @hitter end |
#pitcher ⇒ Object
Returns the value of attribute pitcher.
5 6 7 |
# File 'lib/sportradar/api/baseball/outcome.rb', line 5 def pitcher @pitcher end |
#response ⇒ Object
Returns the value of attribute response.
5 6 7 |
# File 'lib/sportradar/api/baseball/outcome.rb', line 5 def response @response end |
#runners ⇒ Object
Returns the value of attribute runners.
5 6 7 |
# File 'lib/sportradar/api/baseball/outcome.rb', line 5 def runners @runners end |
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'lib/sportradar/api/baseball/outcome.rb', line 5 def type @type end |
Instance Method Details
#update(data, source: nil, **opts) ⇒ Object
18 19 20 |
# File 'lib/sportradar/api/baseball/outcome.rb', line 18 def update(data, source: nil, **opts) update_from_outcome(data['outcome']) if data['outcome'] end |
#update_from_outcome(data) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/sportradar/api/baseball/outcome.rb', line 22 def update_from_outcome(data) @type = data['type'] if data['type'] @current_inning = data['current_inning'] if data['current_inning'] @current_inning_half = data['current_inning_half'] if data['current_inning_half'] @count = data['count'] if data['count'] @hitter = data['hitter'] if data['hitter'] @pitcher = data['pitcher'] if data['pitcher'] @runners = data['runners'] if data['runners'] end |