Class: Sportradar::Api::Basketball::Injury

Inherits:
Data
  • Object
show all
Defined in:
lib/sportradar/api/basketball/injury.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) ⇒ Injury

Returns a new instance of Injury.



7
8
9
10
# File 'lib/sportradar/api/basketball/injury.rb', line 7

def initialize(data, **opts)
  @response = data
  update(data, **opts)
end

Instance Attribute Details

#commentObject

Returns the value of attribute comment.



5
6
7
# File 'lib/sportradar/api/basketball/injury.rb', line 5

def comment
  @comment
end

#descriptonObject

Returns the value of attribute descripton.



5
6
7
# File 'lib/sportradar/api/basketball/injury.rb', line 5

def descripton
  @descripton
end

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/sportradar/api/basketball/injury.rb', line 5

def id
  @id
end

#responseObject

Returns the value of attribute response.



5
6
7
# File 'lib/sportradar/api/basketball/injury.rb', line 5

def response
  @response
end

#start_dateObject

Returns the value of attribute start_date.



5
6
7
# File 'lib/sportradar/api/basketball/injury.rb', line 5

def start_date
  @start_date
end

#statusObject

Returns the value of attribute status.



5
6
7
# File 'lib/sportradar/api/basketball/injury.rb', line 5

def status
  @status
end

#update_dateObject

Returns the value of attribute update_date.



5
6
7
# File 'lib/sportradar/api/basketball/injury.rb', line 5

def update_date
  @update_date
end

Instance Method Details

#out?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/sportradar/api/basketball/injury.rb', line 21

def out?
  @status == 'Out'
end

#update(data, **opts) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/sportradar/api/basketball/injury.rb', line 12

def update(data, **opts)
  @id           = data.last&.dig('id')
  @comment      = data.last&.dig('comment')
  @descripton   = data.last&.dig('desc')
  @status       = data.last&.dig('status')
  @start_date   = data.last&.dig('start_date')
  @update_date  = data.last&.dig('update_date')
end