Class: Sportradar::Api::Baseball::Event
- Defined in:
- lib/sportradar/api/baseball/event.rb,
lib/sportradar/api/baseball/events/at_bat.rb,
lib/sportradar/api/baseball/events/lineup.rb,
lib/sportradar/api/baseball/events/warming_up.rb
Defined Under Namespace
Classes: AtBat, Lineup, WarmingUp
Instance Attribute Summary collapse
-
#at_bat ⇒ Object
Returns the value of attribute at_bat.
-
#half_inning ⇒ Object
Returns the value of attribute half_inning.
-
#id ⇒ Object
Returns the value of attribute id.
-
#lineup ⇒ Object
Returns the value of attribute lineup.
-
#response ⇒ Object
Returns the value of attribute response.
-
#warming_up ⇒ Object
Returns the value of attribute warming_up.
Class Method Summary collapse
-
.subclass(event_type) ⇒ Object
def ==(other) @at_bat == other.at_bat && @warming_up == other.warming_up && @lineup == other.lineup end.
- .subclasses ⇒ Object
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(hash, **opts) ⇒ Event
constructor
alias :type :event_type.
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(hash, **opts) ⇒ Event
alias :type :event_type
8 9 10 11 12 13 14 |
# File 'lib/sportradar/api/baseball/event.rb', line 8 def initialize(hash, **opts) @response = hash @half_inning = opts[:half_inning] @at_bat = AtBat.new(hash['at_bat'], event: self) if hash['at_bat'] @lineup = Lineup.new(hash['lineup'], event: self) if hash['lineup'] @warming_up = WarmingUp.new(hash['warming_up'], event: self) if hash['warming_up'] end |
Instance Attribute Details
#at_bat ⇒ Object
Returns the value of attribute at_bat.
5 6 7 |
# File 'lib/sportradar/api/baseball/event.rb', line 5 def at_bat @at_bat end |
#half_inning ⇒ Object
Returns the value of attribute half_inning.
5 6 7 |
# File 'lib/sportradar/api/baseball/event.rb', line 5 def half_inning @half_inning end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/sportradar/api/baseball/event.rb', line 5 def id @id end |
#lineup ⇒ Object
Returns the value of attribute lineup.
5 6 7 |
# File 'lib/sportradar/api/baseball/event.rb', line 5 def lineup @lineup end |
#response ⇒ Object
Returns the value of attribute response.
5 6 7 |
# File 'lib/sportradar/api/baseball/event.rb', line 5 def response @response end |
#warming_up ⇒ Object
Returns the value of attribute warming_up.
5 6 7 |
# File 'lib/sportradar/api/baseball/event.rb', line 5 def warming_up @warming_up end |
Class Method Details
.subclass(event_type) ⇒ Object
def ==(other)
@at_bat == other.at_bat && @warming_up == other.warming_up && @lineup == other.lineup
end
30 31 32 |
# File 'lib/sportradar/api/baseball/event.rb', line 30 def self.subclass(event_type) subclasses[event_type] end |
Instance Method Details
#description ⇒ Object
16 17 18 |
# File 'lib/sportradar/api/baseball/event.rb', line 16 def description (@at_bat || @lineup || @warming_up)&.description end |