Class: Sportradar::Api::Baseball::Event::WarmingUp

Inherits:
Data
  • Object
show all
Defined in:
lib/sportradar/api/baseball/events/warming_up.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, **opts) ⇒ WarmingUp

Returns a new instance of WarmingUp.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/sportradar/api/baseball/events/warming_up.rb', line 8

def initialize(data, **opts)
  @response       = data
  # @api          = opts[:api]
  # @half_inning  = opts[:half_inning]
  @event          = opts[:event]
  @id             = data["id"]
  @type           = data['type']
  @first_name     = data['first_name'] if data['first_name']
  @last_name      = data['last_name'] if data['last_name']
  @player_id      = data['player_id'] if data['player_id']
  @team_id        = data['team_id'] if data['team_id']
  @preferred_name = data['preferred_name'] if data['preferred_name']
  update(data)
end

Instance Attribute Details

#first_nameObject

Returns the value of attribute first_name.



6
7
8
# File 'lib/sportradar/api/baseball/events/warming_up.rb', line 6

def first_name
  @first_name
end

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/sportradar/api/baseball/events/warming_up.rb', line 6

def id
  @id
end

#last_nameObject

Returns the value of attribute last_name.



6
7
8
# File 'lib/sportradar/api/baseball/events/warming_up.rb', line 6

def last_name
  @last_name
end

#player_idObject

Returns the value of attribute player_id.



6
7
8
# File 'lib/sportradar/api/baseball/events/warming_up.rb', line 6

def player_id
  @player_id
end

#responseObject

Returns the value of attribute response.



6
7
8
# File 'lib/sportradar/api/baseball/events/warming_up.rb', line 6

def response
  @response
end

#team_idObject

Returns the value of attribute team_id.



6
7
8
# File 'lib/sportradar/api/baseball/events/warming_up.rb', line 6

def team_id
  @team_id
end

Instance Method Details

#data_keyObject



31
32
33
# File 'lib/sportradar/api/baseball/events/warming_up.rb', line 31

def data_key
  'warming_up'
end

#descriptionObject



23
24
25
# File 'lib/sportradar/api/baseball/events/warming_up.rb', line 23

def description
  "#{(@preferred_name || @first_name)} #{@last_name} is now warming up in the bullpen."
end

#update(data, **opts) ⇒ Object



27
28
29
# File 'lib/sportradar/api/baseball/events/warming_up.rb', line 27

def update(data, **opts)
  # parse pitches
end