Class: HalcyonAPI::Client
- Inherits:
-
Object
- Object
- HalcyonAPI::Client
- Defined in:
- lib/halcyon_api/client.rb
Overview
Used to interface with the official Vainglory API
Constant Summary collapse
- BASE_URL =
The base URL used for most requests
'https://api.dc01.gamelockerapp.com'.freeze
Instance Method Summary collapse
-
#initialize(api_key, region_identifier = 'na') ⇒ Client
constructor
A new instance of Client.
-
#link(_link_id) ⇒ Object
Checks to see if a link object exists for a given code.
-
#match(match_id) ⇒ OpenStruct
Gets data for a single match.
-
#matches(filter_params = {}) ⇒ OpenStruct
Gets data from matches (multiple).
-
#player(player_id) ⇒ OpenStruct
Gets data for a single player.
-
#players(player_name, *additional_player_names) ⇒ OpenStruct
Gets data about players (one or more).
-
#samples(filter_params = {}) ⇒ OpenStruct
Gets batches of random match data.
-
#status ⇒ OpenStruct
Gets current API version and release date.
-
#team(_team_id) ⇒ Object
Gets aggregated lifetime information about a single team.
-
#teams(_filter_params = {}) ⇒ Object
Gets aggregated lifetime information about teams (multiple).
-
#telemetry(url) ⇒ OpenStruct
Gets telemtry data from a specified URL.
Constructor Details
#initialize(api_key, region_identifier = 'na') ⇒ Client
Requires a valid region short name.
A new instance of Client.
26 27 28 29 |
# File 'lib/halcyon_api/client.rb', line 26 def initialize(api_key, region_identifier = 'na') @api_key = api_key @region = Region.find(region_identifier) end |
Instance Method Details
#link(_link_id) ⇒ Object
Checks to see if a link object exists for a given code
158 159 160 |
# File 'lib/halcyon_api/client.rb', line 158 def link(_link_id) raise(NotImplementedError, 'Coming soon!') end |
#match(match_id) ⇒ OpenStruct
Gets data for a single match
88 89 90 |
# File 'lib/halcyon_api/client.rb', line 88 def match(match_id) get_request(shard_endpoint_uri("matches/#{match_id}")) end |
#matches(filter_params = {}) ⇒ OpenStruct
Gets data from matches (multiple)
74 75 76 |
# File 'lib/halcyon_api/client.rb', line 74 def matches(filter_params = {}) get_request(shard_endpoint_uri('matches', filter_params)) end |
#player(player_id) ⇒ OpenStruct
Gets data for a single player
119 120 121 |
# File 'lib/halcyon_api/client.rb', line 119 def player(player_id) get_request(shard_endpoint_uri("players/#{player_id}")) end |
#players(player_name, *additional_player_names) ⇒ OpenStruct
Gets data about players (one or more)
104 105 106 107 108 109 |
# File 'lib/halcyon_api/client.rb', line 104 def players(player_name, *additional_player_names) player_names = [player_name].concat(additional_player_names) filter_params = { 'filter[playerNames]' => player_names.join(',') } get_request(shard_endpoint_uri('players', filter_params)) end |
#samples(filter_params = {}) ⇒ OpenStruct
Gets batches of random match data
46 47 48 |
# File 'lib/halcyon_api/client.rb', line 46 def samples(filter_params = {}) get_request(shard_endpoint_uri('samples', filter_params)) end |
#status ⇒ OpenStruct
Gets current API version and release date
169 170 171 |
# File 'lib/halcyon_api/client.rb', line 169 def status get_request_without_headers(endpoint_uri('status')) end |
#team(_team_id) ⇒ Object
Gets aggregated lifetime information about a single team
150 151 152 |
# File 'lib/halcyon_api/client.rb', line 150 def team(_team_id) raise(NotImplementedError, 'Coming soon!') end |
#teams(_filter_params = {}) ⇒ Object
Gets aggregated lifetime information about teams (multiple)
142 143 144 |
# File 'lib/halcyon_api/client.rb', line 142 def teams(_filter_params = {}) raise(NotImplementedError, 'Coming soon!') end |
#telemetry(url) ⇒ OpenStruct
Gets telemtry data from a specified URL
131 132 133 |
# File 'lib/halcyon_api/client.rb', line 131 def telemetry(url) get_request(URI(url), true, false) end |