Class: Sportradar::Api::Football::Event

Inherits:
Data
  • Object
show all
Defined in:
lib/sportradar/api/football/event.rb

Direct Known Subclasses

Nfl::Event

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) ⇒ Event

Returns a new instance of Event.



7
8
9
10
11
# File 'lib/sportradar/api/football/event.rb', line 7

def initialize(data, **opts)
  @response         = data
  @id               = data["id"]
  update(data, **opts)
end

Instance Attribute Details

#alt_descriptionObject

Returns the value of attribute alt_description.



5
6
7
# File 'lib/sportradar/api/football/event.rb', line 5

def alt_description
  @alt_description
end

#clockObject

Returns the value of attribute clock.



5
6
7
# File 'lib/sportradar/api/football/event.rb', line 5

def clock
  @clock
end

#descriptionObject

Returns the value of attribute description.



5
6
7
# File 'lib/sportradar/api/football/event.rb', line 5

def description
  @description
end

#event_typeObject

Returns the value of attribute event_type.



5
6
7
# File 'lib/sportradar/api/football/event.rb', line 5

def event_type
  @event_type
end

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/sportradar/api/football/event.rb', line 5

def id
  @id
end

#referenceObject

Returns the value of attribute reference.



5
6
7
# File 'lib/sportradar/api/football/event.rb', line 5

def reference
  @reference
end

#responseObject

Returns the value of attribute response.



5
6
7
# File 'lib/sportradar/api/football/event.rb', line 5

def response
  @response
end

#sequenceObject

Returns the value of attribute sequence.



5
6
7
# File 'lib/sportradar/api/football/event.rb', line 5

def sequence
  @sequence
end

#typeObject

Returns the value of attribute type.



5
6
7
# File 'lib/sportradar/api/football/event.rb', line 5

def type
  @type
end

Instance Method Details

#eventsObject



26
27
28
# File 'lib/sportradar/api/football/event.rb', line 26

def events
  [self]
end

#halftime?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/sportradar/api/football/event.rb', line 32

def halftime?
  false
end

#over?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/sportradar/api/football/event.rb', line 29

def over?
  false # TODO
end

#playsObject



23
24
25
# File 'lib/sportradar/api/football/event.rb', line 23

def plays
  []
end

#update(data, **opts) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/sportradar/api/football/event.rb', line 12

def update(data, **opts)
  @sequence         = data["sequence"]
  @reference        = data["reference"]
  @clock            = data["clock"]
  @type             = data["type"]
  @event_type       = data["event_type"]
  @description      = data["description"] || data["summary"]
  @alt_description  = data["alt_description"]

  self
end