Class: Smite::Client
Instance Attribute Summary collapse
-
#auth_key ⇒ Object
readonly
Returns the value of attribute auth_key.
-
#dev_id ⇒ Object
readonly
Returns the value of attribute dev_id.
-
#lang ⇒ Object
readonly
Returns the value of attribute lang.
-
#session_id ⇒ Object
readonly
Returns the value of attribute session_id.
Instance Method Summary collapse
- #achievements(player_id) ⇒ Object
- #create_session ⇒ Object
- #data_used ⇒ Object
- #esports_pro_league_details ⇒ Object
- #friends(player_name) ⇒ Object
- #god_ranks(player_name) ⇒ Object
- #god_recommended_items(god_id) ⇒ Object
- #gods ⇒ Object
-
#initialize(dev_id, auth_key, lang = 1) ⇒ Client
constructor
A new instance of Client.
- #items ⇒ Object
- #league_leaderboard(queue, tier, season) ⇒ Object
- #league_seasons(queue) ⇒ Object
- #match_details(match_id) ⇒ Object
- #match_history(player_name) ⇒ Object
- #match_ids_by_queue(queue, date, hour) ⇒ Object
- #match_player_details(match_id) ⇒ Object
- #motd ⇒ Object
- #player(player_name) ⇒ Object
- #player_status(player_name) ⇒ Object
- #queue_stats(player_name, queue) ⇒ Object
- #search_teams(team_name) ⇒ Object
- #team_details(clan_id) ⇒ Object
- #team_players(clan_id) ⇒ Object
- #test_session ⇒ Object
- #top_matches ⇒ Object
- #valid_session? ⇒ Boolean
Constructor Details
#initialize(dev_id, auth_key, lang = 1) ⇒ Client
Returns a new instance of Client.
7 8 9 10 11 12 |
# File 'lib/smite/client.rb', line 7 def initialize(dev_id, auth_key, lang = 1) @dev_id = dev_id @auth_key = auth_key @lang = [1,2,3,7,9,10,11,12,13].include?(lang) ? lang : 1 create_session end |
Instance Attribute Details
#auth_key ⇒ Object (readonly)
Returns the value of attribute auth_key.
3 4 5 |
# File 'lib/smite/client.rb', line 3 def auth_key @auth_key end |
#dev_id ⇒ Object (readonly)
Returns the value of attribute dev_id.
3 4 5 |
# File 'lib/smite/client.rb', line 3 def dev_id @dev_id end |
#lang ⇒ Object (readonly)
Returns the value of attribute lang.
3 4 5 |
# File 'lib/smite/client.rb', line 3 def lang @lang end |
#session_id ⇒ Object (readonly)
Returns the value of attribute session_id.
3 4 5 |
# File 'lib/smite/client.rb', line 3 def session_id @session_id end |
Instance Method Details
#achievements(player_id) ⇒ Object
74 75 76 |
# File 'lib/smite/client.rb', line 74 def achievements(player_id) api_call('getplayerachievements', [player_id]) end |
#create_session ⇒ Object
106 107 108 109 110 111 |
# File 'lib/smite/client.rb', line 106 def create_session return @session_id if valid_session? response = api_call('createsession', [], false) @session_id = response['session_id'] end |
#data_used ⇒ Object
102 103 104 |
# File 'lib/smite/client.rb', line 102 def data_used api_call('getdataused') end |
#esports_pro_league_details ⇒ Object
14 15 16 |
# File 'lib/smite/client.rb', line 14 def esports_pro_league_details api_call('getesportsproleaguedetails') end |
#friends(player_name) ⇒ Object
78 79 80 |
# File 'lib/smite/client.rb', line 78 def friends(player_name) api_call('getfriends', [player_name]) end |
#god_ranks(player_name) ⇒ Object
82 83 84 |
# File 'lib/smite/client.rb', line 82 def god_ranks(player_name) api_call('getgodranks', [player_name]) end |
#god_recommended_items(god_id) ⇒ Object
18 19 20 |
# File 'lib/smite/client.rb', line 18 def god_recommended_items(god_id) api_call('getgodrecommendeditems', [god_id, lang]) end |
#gods ⇒ Object
66 67 68 |
# File 'lib/smite/client.rb', line 66 def gods api_call('getgods', [lang]) end |
#items ⇒ Object
70 71 72 |
# File 'lib/smite/client.rb', line 70 def items api_call('getitems', [lang]) end |
#league_leaderboard(queue, tier, season) ⇒ Object
34 35 36 |
# File 'lib/smite/client.rb', line 34 def league_leaderboard(queue, tier, season) api_call('getleagueleaderboard', [queue, tier, season]) end |
#league_seasons(queue) ⇒ Object
30 31 32 |
# File 'lib/smite/client.rb', line 30 def league_seasons(queue) api_call('getleagueseasons', [queue]) end |
#match_details(match_id) ⇒ Object
62 63 64 |
# File 'lib/smite/client.rb', line 62 def match_details(match_id) api_call('getmatchdetails', [match_id]) end |
#match_history(player_name) ⇒ Object
90 91 92 |
# File 'lib/smite/client.rb', line 90 def match_history(player_name) api_call('getmatchhistory', [player_name]) end |
#match_ids_by_queue(queue, date, hour) ⇒ Object
26 27 28 |
# File 'lib/smite/client.rb', line 26 def match_ids_by_queue(queue, date, hour) api_call('getmatchidsbyqueue', [queue, date, hour]) end |
#match_player_details(match_id) ⇒ Object
22 23 24 |
# File 'lib/smite/client.rb', line 22 def match_player_details(match_id) api_call('getmatchplayerdetails', [match_id]) end |
#motd ⇒ Object
38 39 40 |
# File 'lib/smite/client.rb', line 38 def motd api_call('getmotd') end |
#player(player_name) ⇒ Object
86 87 88 |
# File 'lib/smite/client.rb', line 86 def player(player_name) api_call('getplayer', [player_name]) end |
#player_status(player_name) ⇒ Object
42 43 44 |
# File 'lib/smite/client.rb', line 42 def player_status(player_name) api_call('getplayerstatus', [player_name]) end |
#queue_stats(player_name, queue) ⇒ Object
46 47 48 |
# File 'lib/smite/client.rb', line 46 def queue_stats(player_name, queue) api_call('getqueuestats', [player_name, queue]) end |
#search_teams(team_name) ⇒ Object
94 95 96 |
# File 'lib/smite/client.rb', line 94 def search_teams(team_name) api_call('searchteams', [team_name]) end |
#team_details(clan_id) ⇒ Object
50 51 52 |
# File 'lib/smite/client.rb', line 50 def team_details(clan_id) api_call('getteamdetails', [clan_id]) end |
#team_players(clan_id) ⇒ Object
54 55 56 |
# File 'lib/smite/client.rb', line 54 def team_players(clan_id) api_call('getteamplayers', [clan_id]) end |
#test_session ⇒ Object
98 99 100 |
# File 'lib/smite/client.rb', line 98 def test_session api_call('testsession') end |
#top_matches ⇒ Object
58 59 60 |
# File 'lib/smite/client.rb', line 58 def top_matches api_call('gettopmatches') end |
#valid_session? ⇒ Boolean
113 114 115 |
# File 'lib/smite/client.rb', line 113 def valid_session? !!(test_session =~ /successful/i) end |