Class: Statium::Opta::Resource::CommonResource

Inherits:
Object
  • Object
show all
Defined in:
lib/statium/opta/resource/common.rb

Direct Known Subclasses

LiveMatch, Match, TournamentCalendar, Venue

Instance Method Summary collapse

Instance Method Details

#build_uri(resource_name, auth_key, path_suffix, query_options) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/statium/opta/resource/common.rb', line 13

def build_uri(resource_name, auth_key, path_suffix, query_options)
  uri = URI::HTTPS.build(
  host: 'api.performfeeds.com',
  path: "/soccerdata/#{resource_name}/#{auth_key}#{path_suffix}"
  )
  uri.query = URI.encode_www_form(query_options)
  uri
end

#common_url_options(lang = 'en') ⇒ Object



5
6
7
8
9
10
11
# File 'lib/statium/opta/resource/common.rb', line 5

def common_url_options(lang = 'en')
  common_url_options = {
    _fmt: 'json',
    _lcl: lang
  }
  common_url_options
end

#parseObject



26
27
28
# File 'lib/statium/opta/resource/common.rb', line 26

def parse
  raise "This method must be overriden by implementing classes"
end

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



22
23
24
# File 'lib/statium/opta/resource/common.rb', line 22

def uri(auth_key, lang = 'en')
  raise "This method must be overriden by implementing classes"
end