Class: OpenDotaApi::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/open_dota_api/client.rb

Constant Summary collapse

INTERFACE =
'api'.freeze

Instance Method Summary collapse

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( = nil, attributes = {})
  data = request(Player::ENDPOINT, , params: attributes)
  Player.new(data)
end

#pro_players(attributes = {}) ⇒ Object



42
43
44
45
# File 'lib/open_dota_api/client.rb', line 42

def pro_players(attributes = {})
  data = request(ProPlayer::ENDPOINT, params: attributes)
  ProPlayer.instantiate(data)
end

#teams(attributes = {}) ⇒ Object



27
28
29
30
# File 'lib/open_dota_api/client.rb', line 27

def teams(attributes = {})
  data = request(Team::ENDPOINT, params: attributes)
  Team.instantiate(data)
end