Class: Statium::Opta::Resource::Match

Inherits:
CommonResource show all
Defined in:
lib/statium/opta/resource/match.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from CommonResource

#build_uri, #common_url_options

Constructor Details

#initialize(tournament_calendar_uuid, page_number = 1, page_size = 500) ⇒ Match

Returns a new instance of Match



9
10
11
12
13
# File 'lib/statium/opta/resource/match.rb', line 9

def initialize(tournament_calendar_uuid, page_number = 1, page_size = 500)
  @tournament_calendar_uuid = tournament_calendar_uuid
  @page_number = page_number
  @page_size = page_size
end

Instance Attribute Details

#page_numberObject

Returns the value of attribute page_number



6
7
8
# File 'lib/statium/opta/resource/match.rb', line 6

def page_number
  @page_number
end

#page_sizeObject

Returns the value of attribute page_size



7
8
9
# File 'lib/statium/opta/resource/match.rb', line 7

def page_size
  @page_size
end

#tournament_calendar_uuidObject

Returns the value of attribute tournament_calendar_uuid



5
6
7
# File 'lib/statium/opta/resource/match.rb', line 5

def tournament_calendar_uuid
  @tournament_calendar_uuid
end

Instance Method Details

#parse(response_body) ⇒ Object



25
26
27
# File 'lib/statium/opta/resource/match.rb', line 25

def parse response_body
  Statium::Opta::Model::Match.build response_body
end

#uri(auth_key, lang = 'en') ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/statium/opta/resource/match.rb', line 15

def uri(auth_key, lang = 'en')
  specific_options = {
    tmcl: @tournament_calendar_uuid,
    live: 'yes',
    lineups: 'yes',
    _pgSz: @page_size,
  }
  build_uri('match', auth_key, nil, common_url_options(lang).merge(specific_options))
end