Class: GameLockerAPI
- Inherits:
-
Object
- Object
- GameLockerAPI
- Defined in:
- lib/gamelocker_api.rb,
lib/gamelocker_api/match.rb,
lib/gamelocker_api/player.rb,
lib/gamelocker_api/roster.rb,
lib/gamelocker_api/version.rb,
lib/gamelocker_api/participant.rb,
lib/gamelocker_api/abstract_parser.rb
Defined Under Namespace
Classes: AbstractParser, Match, Participant, Player, Roster, VirtualResponse
Constant Summary collapse
- VERSION =
"0.1.1"
Instance Attribute Summary collapse
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
Instance Method Summary collapse
-
#initialize(api_key, region = "na") ⇒ GameLockerAPI
constructor
A new instance of GameLockerAPI.
- #match(match_uuid = nil) ⇒ Object
- #matches(match_params = {}) ⇒ Object
-
#player(uuid) ⇒ Object
Probably does not work.
- #players(players_list = []) ⇒ Object
Constructor Details
#initialize(api_key, region = "na") ⇒ GameLockerAPI
Returns a new instance of GameLockerAPI.
12 13 14 15 16 17 |
# File 'lib/gamelocker_api.rb', line 12 def initialize(api_key, region = "na") @api_key = api_key @region = region @base_url= "https://api.dc01.gamelockerapp.com/shards/" @headers = {} end |
Instance Attribute Details
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
11 12 13 |
# File 'lib/gamelocker_api.rb', line 11 def base_url @base_url end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
11 12 13 |
# File 'lib/gamelocker_api.rb', line 11 def headers @headers end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
11 12 13 |
# File 'lib/gamelocker_api.rb', line 11 def region @region end |
Instance Method Details
#match(match_uuid = nil) ⇒ Object
31 32 33 |
# File 'lib/gamelocker_api.rb', line 31 def match(match_uuid = nil) match_uuid ? request("matches/#{match_uuid}") : request("matches") end |
#matches(match_params = {}) ⇒ Object
35 36 37 |
# File 'lib/gamelocker_api.rb', line 35 def matches(match_params = {}) request("matches", match_params) end |
#player(uuid) ⇒ Object
Probably does not work
20 21 22 |
# File 'lib/gamelocker_api.rb', line 20 def player(uuid) request("players/#{uuid}", {}) end |
#players(players_list = []) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/gamelocker_api.rb', line 24 def players(players_list = []) raise "Max of only 6 players" if players_list.count > 6 string = players_list.join(", ") hash = {"filter[playerNames]": string} request("players", hash) end |