Class: Smite::Client
Instance Attribute Summary collapse
- 
  
    
      #auth_key  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute auth_key.
 - 
  
    
      #created  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute created.
 - 
  
    
      #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 13  | 
    
      # 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 @created = Time.now - 20 * 60 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  | 
  
#created ⇒ Object (readonly)
Returns the value of attribute created.
      3 4 5  | 
    
      # File 'lib/smite/client.rb', line 3 def created @created 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
      75 76 77  | 
    
      # File 'lib/smite/client.rb', line 75 def achievements(player_id) api_call('getplayerachievements', [player_id]) end  | 
  
#create_session ⇒ Object
      107 108 109 110 111 112 113  | 
    
      # File 'lib/smite/client.rb', line 107 def create_session return @session_id if valid_session? response = api_call('createsession', [], false) @session_id = response['session_id'] @created = Time.now end  | 
  
#data_used ⇒ Object
      103 104 105  | 
    
      # File 'lib/smite/client.rb', line 103 def data_used api_call('getdataused') end  | 
  
#esports_pro_league_details ⇒ Object
      15 16 17  | 
    
      # File 'lib/smite/client.rb', line 15 def esports_pro_league_details api_call('getesportsproleaguedetails') end  | 
  
#friends(player_name) ⇒ Object
      79 80 81  | 
    
      # File 'lib/smite/client.rb', line 79 def friends(player_name) api_call('getfriends', [player_name]) end  | 
  
#god_ranks(player_name) ⇒ Object
      83 84 85  | 
    
      # File 'lib/smite/client.rb', line 83 def god_ranks(player_name) api_call('getgodranks', [player_name]) end  | 
  
#god_recommended_items(god_id) ⇒ Object
      19 20 21  | 
    
      # File 'lib/smite/client.rb', line 19 def god_recommended_items(god_id) api_call('getgodrecommendeditems', [god_id, lang]) end  | 
  
#gods ⇒ Object
      67 68 69  | 
    
      # File 'lib/smite/client.rb', line 67 def gods api_call('getgods', [lang]) end  | 
  
#items ⇒ Object
      71 72 73  | 
    
      # File 'lib/smite/client.rb', line 71 def items api_call('getitems', [lang]) end  | 
  
#league_leaderboard(queue, tier, season) ⇒ Object
      35 36 37  | 
    
      # File 'lib/smite/client.rb', line 35 def league_leaderboard(queue, tier, season) api_call('getleagueleaderboard', [queue, tier, season]) end  | 
  
#league_seasons(queue) ⇒ Object
      31 32 33  | 
    
      # File 'lib/smite/client.rb', line 31 def league_seasons(queue) api_call('getleagueseasons', [queue]) end  | 
  
#match_details(match_id) ⇒ Object
      63 64 65  | 
    
      # File 'lib/smite/client.rb', line 63 def match_details(match_id) api_call('getmatchdetails', [match_id]) end  | 
  
#match_history(player_name) ⇒ Object
      91 92 93  | 
    
      # File 'lib/smite/client.rb', line 91 def match_history(player_name) api_call('getmatchhistory', [player_name]) end  | 
  
#match_ids_by_queue(queue, date, hour) ⇒ Object
      27 28 29  | 
    
      # File 'lib/smite/client.rb', line 27 def match_ids_by_queue(queue, date, hour) api_call('getmatchidsbyqueue', [queue, date, hour]) end  | 
  
#match_player_details(match_id) ⇒ Object
      23 24 25  | 
    
      # File 'lib/smite/client.rb', line 23 def match_player_details(match_id) api_call('getmatchplayerdetails', [match_id]) end  | 
  
#motd ⇒ Object
      39 40 41  | 
    
      # File 'lib/smite/client.rb', line 39 def motd api_call('getmotd') end  | 
  
#player(player_name) ⇒ Object
      87 88 89  | 
    
      # File 'lib/smite/client.rb', line 87 def player(player_name) api_call('getplayer', [player_name]) end  | 
  
#player_status(player_name) ⇒ Object
      43 44 45  | 
    
      # File 'lib/smite/client.rb', line 43 def player_status(player_name) api_call('getplayerstatus', [player_name]) end  | 
  
#queue_stats(player_name, queue) ⇒ Object
      47 48 49  | 
    
      # File 'lib/smite/client.rb', line 47 def queue_stats(player_name, queue) api_call('getqueuestats', [player_name, queue]) end  | 
  
#search_teams(team_name) ⇒ Object
      95 96 97  | 
    
      # File 'lib/smite/client.rb', line 95 def search_teams(team_name) api_call('searchteams', [team_name]) end  | 
  
#team_details(clan_id) ⇒ Object
      51 52 53  | 
    
      # File 'lib/smite/client.rb', line 51 def team_details(clan_id) api_call('getteamdetails', [clan_id]) end  | 
  
#team_players(clan_id) ⇒ Object
      55 56 57  | 
    
      # File 'lib/smite/client.rb', line 55 def team_players(clan_id) api_call('getteamplayers', [clan_id]) end  | 
  
#test_session ⇒ Object
      99 100 101  | 
    
      # File 'lib/smite/client.rb', line 99 def test_session api_call('testsession') end  | 
  
#top_matches ⇒ Object
      59 60 61  | 
    
      # File 'lib/smite/client.rb', line 59 def top_matches api_call('gettopmatches') end  | 
  
#valid_session? ⇒ Boolean
      115 116 117  | 
    
      # File 'lib/smite/client.rb', line 115 def valid_session? (created + (15 * 60)) > Time.now end  |