Class: OpenDotaApi::Client
- Inherits:
-
Object
- Object
- OpenDotaApi::Client
- Defined in:
- lib/open_dota_api/client.rb
Constant Summary collapse
- INTERFACE =
'api'.freeze
Instance Method Summary collapse
- #explorer(league_id = nil, attributes = {}) ⇒ Object
- #heroes(attributes = {}) ⇒ Object
- #leagues(attributes = {}) ⇒ Object
- #limits(attributes = {}) ⇒ Object
- #matches(match_id = nil, attributes = {}) ⇒ Object
- #players(account_id = nil, attributes = {}) ⇒ Object
- #pro_players(attributes = {}) ⇒ Object
- #teams(attributes = {}) ⇒ Object
Instance Method Details
#explorer(league_id = nil, attributes = {}) ⇒ Object
52 53 54 55 |
# File 'lib/open_dota_api/client.rb', line 52 def explorer(league_id = nil, attributes = {}) data = request(Explorer::ENDPOINT, params: Explorer.query_params(league_id).merge(attributes)) Explorer.new(data) end |
#heroes(attributes = {}) ⇒ Object
37 38 39 40 |
# File 'lib/open_dota_api/client.rb', line 37 def heroes(attributes = {}) data = request(Hero::ENDPOINT, params: attributes) Hero.instantiate(data) end |
#leagues(attributes = {}) ⇒ Object
22 23 24 25 |
# File 'lib/open_dota_api/client.rb', line 22 def leagues(attributes = {}) data = request(League::ENDPOINT, params: attributes) League.instantiate(data) end |
#limits(attributes = {}) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/open_dota_api/client.rb', line 15 def limits(attributes = {}) return @limits unless @limits.nil? request(Health::ENDPOINT, params: attributes) @limits end |
#matches(match_id = nil, attributes = {}) ⇒ Object
32 33 34 35 |
# File 'lib/open_dota_api/client.rb', line 32 def matches(match_id = nil, attributes = {}) data = request(Match::ENDPOINT, match_id, params: attributes) Match.new(data) end |
#players(account_id = nil, attributes = {}) ⇒ Object
47 48 49 50 |
# File 'lib/open_dota_api/client.rb', line 47 def players(account_id = nil, attributes = {}) data = request(Player::ENDPOINT, account_id, params: attributes) Player.new(data) end |