Class: Brawlhalla::API::Client
- Inherits:
-
Object
- Object
- Brawlhalla::API::Client
- Defined in:
- lib/brawlhalla/api/client.rb
Constant Summary collapse
- BASE_URL =
'https://api.brawlhalla.com'
Instance Method Summary collapse
-
#initialize(api_key, debug: false) ⇒ Client
constructor
A new instance of Client.
-
#ranked(brawlhalla_id) ⇒ Object
Get player ranked stats by giving the Brawlhalla ID.
-
#search(steamid) ⇒ Object
Search player by Steam ID.
-
#stats(brawlhalla_id) ⇒ Object
Get player stats by giving the Brawlhalla ID.
Constructor Details
#initialize(api_key, debug: false) ⇒ Client
Returns a new instance of Client.
8 9 10 11 |
# File 'lib/brawlhalla/api/client.rb', line 8 def initialize(api_key, debug: false) @api_key = api_key @debug = debug end |
Instance Method Details
#ranked(brawlhalla_id) ⇒ Object
Get player ranked stats by giving the Brawlhalla ID.
Example
bh = Brawlhalla::API::Client.new('YOUR_API_KEY_HERE')
bh.ranked(8817417)
39 40 41 |
# File 'lib/brawlhalla/api/client.rb', line 39 def ranked(brawlhalla_id) request(path: "player/#{brawlhalla_id}/ranked") end |
#search(steamid) ⇒ Object
Search player by Steam ID.
Example
bh = Brawlhalla::API::Client.new('YOUR_API_KEY_HERE')
bh.search(76561198048321884)
18 19 20 21 22 23 |
# File 'lib/brawlhalla/api/client.rb', line 18 def search(steamid) request( path: 'search', params: { steamid: steamid } ) end |
#stats(brawlhalla_id) ⇒ Object
Get player stats by giving the Brawlhalla ID.
Example
bh = Brawlhalla::API::Client.new('YOUR_API_KEY_HERE')
bh.stats(8817417)
30 31 32 |
# File 'lib/brawlhalla/api/client.rb', line 30 def stats(brawlhalla_id) request(path: "player/#{brawlhalla_id}/stats") end |