Class: Sportradar::Api::Basketball::Ncaamb::Bracket

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

Returns a new instance of Bracket.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/sportradar/api/basketball/ncaamb/bracket.rb', line 8

def initialize(data, **opts)
  @response   = data
  @api        = opts[:api]
  @tournament = opts[:tournament]

  @id         = data['id']

  @games_hash = {}

  update(data)
end

Instance Attribute Details

#endObject

Returns the value of attribute end.



6
7
8
# File 'lib/sportradar/api/basketball/ncaamb/bracket.rb', line 6

def end
  @end
end

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/sportradar/api/basketball/ncaamb/bracket.rb', line 6

def id
  @id
end

#locationObject

Returns the value of attribute location.



6
7
8
# File 'lib/sportradar/api/basketball/ncaamb/bracket.rb', line 6

def location
  @location
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/sportradar/api/basketball/ncaamb/bracket.rb', line 6

def name
  @name
end

#responseObject

Returns the value of attribute response.



6
7
8
# File 'lib/sportradar/api/basketball/ncaamb/bracket.rb', line 6

def response
  @response
end

#startObject

Returns the value of attribute start.



6
7
8
# File 'lib/sportradar/api/basketball/ncaamb/bracket.rb', line 6

def start
  @start
end

Instance Method Details

#update(data, **opts) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/sportradar/api/basketball/ncaamb/bracket.rb', line 20

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

  @name     = data['name']                  if data['name']
  @location = data['location']              if data['location']

  # update_games(data['games'])               if data['games']
  update_participants(data['participants']) if data['participants']
  self
end