ruby_gg 0.1.3.1 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/Gemfile.lock +1 -1
 - data/README.md +23 -8
 - data/lib/ruby_gg/champion.rb +7 -0
 - data/lib/ruby_gg/summoner.rb +19 -13
 - data/lib/ruby_gg/version.rb +1 -1
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 027d7133a3a1dbcef841a0901fcd779064491222
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 4033d8c2c255eb877b13e4c266b5633a9a726ee7
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: beee6e49644645042f0eccb8a19f0d19f25b85b8b135f8e78f7ce7f4fb61c8e8203c6fde2cdf24af3502ec4c1e224ffc5598c67194af218ecc67389df6fca9e4
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: b191d147f0f3da2fbe422aca12c86e99ea98b0c41d874839417c2e776335f1d9e70f397dfcbfac591dd636cf93086f659c00056487c794aebc86ec4dece90992
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -40,27 +40,42 @@ However you can pass in interger or string of an integer to get set number of re 
     | 
|
| 
       40 
40 
     | 
    
         
             
            Gets summoners information (for data types check league api documentation). returnType is hashValue.
         
     | 
| 
       41 
41 
     | 
    
         
             
            returnType = {:user => {userDto}, :solo => {soloDto}, :flex => {flexDto}, :tt => {ttDto}}
         
     | 
| 
       42 
42 
     | 
    
         
             
            ```ruby
         
     | 
| 
       43 
     | 
    
         
            -
                client.summoner. 
     | 
| 
       44 
     | 
    
         
            -
                You can check for  
     | 
| 
      
 43 
     | 
    
         
            +
                client.summoner.find(name) #Where id can be int or str. 
         
     | 
| 
      
 44 
     | 
    
         
            +
                #You can check for name from client.challenger.solo_queue()[0][:playerOrTeamName] 
         
     | 
| 
      
 45 
     | 
    
         
            +
                # Gives the id for first challenger player in the list returned.
         
     | 
| 
       45 
46 
     | 
    
         
             
            ```
         
     | 
| 
       46 
47 
     | 
    
         
             
            Gets summoners Champion Masteries (returns hashValue).
         
     | 
| 
       47 
48 
     | 
    
         
             
            returnType = [{"playerId"=>72859900, "championId"=>53, "championLevel"=>1, "championPoints"=>124, "lastPlayTime"=>1475296559000, "championPointsSinceLastLevel"=>124, "championPointsUntilNextLevel"=>1676, "chestGranted"=>false, "tokensEarned"=>0}]
         
     | 
| 
       48 
49 
     | 
    
         | 
| 
       49 
50 
     | 
    
         
             
            ```ruby
         
     | 
| 
       50 
     | 
    
         
            -
                client.summoner.champion_mastery(id, count)  
     | 
| 
      
 51 
     | 
    
         
            +
                client.summoner.champion_mastery(id, count) 
         
     | 
| 
      
 52 
     | 
    
         
            +
            ```
         
     | 
| 
      
 53 
     | 
    
         
            +
            Where id and count both can be str or int. 
         
     | 
| 
      
 54 
     | 
    
         
            +
            Id is summoner's ID, and count is number of data you want back (it is sorted according to most mastery points).
         
     | 
| 
      
 55 
     | 
    
         
            +
            ```ruby
         
     | 
| 
       51 
56 
     | 
    
         
             
                client.summoner.champion_mastery(id, 3) # returns 3 top mastery points champs.
         
     | 
| 
       52 
     | 
    
         
            -
                You can check for id from client.challenger.solo_queue()[0][:playerOrTeamId] # Gives the id for first challenger player in the list returned.
         
     | 
| 
       53 
57 
     | 
    
         
             
            ```
         
     | 
| 
      
 58 
     | 
    
         
            +
            You can check for id from 
         
     | 
| 
      
 59 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 60 
     | 
    
         
            +
                client.challenger.solo_queue()[0][:playerOrTeamId]
         
     | 
| 
      
 61 
     | 
    
         
            +
            ```
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
            Gives the id for first challenger player in the list returned.
         
     | 
| 
      
 64 
     | 
    
         
            +
                
         
     | 
| 
       54 
65 
     | 
    
         
             
            Gets champions name with their id.
         
     | 
| 
       55 
66 
     | 
    
         | 
| 
       56 
67 
     | 
    
         
             
            ```ruby
         
     | 
| 
       57 
68 
     | 
    
         
             
                client.champion.get_name(championId) # Champion Id can be str or int. 
         
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
      
 69 
     | 
    
         
            +
            ```
         
     | 
| 
      
 70 
     | 
    
         
            +
            You can get the championId from client.summoner.champion_mastery(id, count) ==> for count == 1 [0][championId] will return championId.
         
     | 
| 
      
 71 
     | 
    
         
            +
            Example:
         
     | 
| 
      
 72 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 73 
     | 
    
         
            +
                masteries = client.summoner.champion_mastery(72859900, 3)
         
     | 
| 
      
 74 
     | 
    
         
            +
            ```
         
     | 
| 
      
 75 
     | 
    
         
            +
            That will return 3 top champion_mastery for that id *Rockerturner is the username*.
         
     | 
| 
      
 76 
     | 
    
         
            +
            ```ruby
         
     | 
| 
       61 
77 
     | 
    
         
             
                topChamp = []
         
     | 
| 
       62 
78 
     | 
    
         
             
                masteries.each{|x| topChamp.push(x['championId'])} 
         
     | 
| 
       63 
     | 
    
         
            -
                
         
     | 
| 
       64 
79 
     | 
    
         
             
            ```
         
     | 
| 
       65 
80 
     | 
    
         
             
            ## Development
         
     | 
| 
       66 
81 
     | 
    
         | 
    
        data/lib/ruby_gg/champion.rb
    CHANGED
    
    | 
         @@ -10,6 +10,7 @@ module RubyGg 
     | 
|
| 
       10 
10 
     | 
    
         
             
                        @region = region
         
     | 
| 
       11 
11 
     | 
    
         
             
                        @base_url = "https://#{@region}.api.riotgames.com"
         
     | 
| 
       12 
12 
     | 
    
         
             
                        @champion_url = "/lol/league/v3/challengerleagues/by-queue/"
         
     | 
| 
      
 13 
     | 
    
         
            +
                        @leagueVer = HTTParty.get('https://ddragon.leagueoflegends.com/api/versions.json').parsed_response[0]
         
     | 
| 
       13 
14 
     | 
    
         
             
                    end
         
     | 
| 
       14 
15 
     | 
    
         | 
| 
       15 
16 
     | 
    
         
             
                    def get_name(id)
         
     | 
| 
         @@ -156,6 +157,12 @@ module RubyGg 
     | 
|
| 
       156 
157 
     | 
    
         
             
                                    '143' => 'Zyra'}
         
     | 
| 
       157 
158 
     | 
    
         
             
                        return champNames[id.to_s]
         
     | 
| 
       158 
159 
     | 
    
         
             
                    end
         
     | 
| 
      
 160 
     | 
    
         
            +
                    
         
     | 
| 
      
 161 
     | 
    
         
            +
                    def icon(champName)
         
     | 
| 
      
 162 
     | 
    
         
            +
                        icon = "https://ddragon.leagueoflegends.com/cdn/#{@leagueVer}/img/champion/#{champName}.png"
         
     | 
| 
      
 163 
     | 
    
         
            +
                        return icon
         
     | 
| 
      
 164 
     | 
    
         
            +
                    end
         
     | 
| 
      
 165 
     | 
    
         
            +
                    
         
     | 
| 
       159 
166 
     | 
    
         
             
                end
         
     | 
| 
       160 
167 
     | 
    
         | 
| 
       161 
168 
     | 
    
         
             
            end
         
     | 
    
        data/lib/ruby_gg/summoner.rb
    CHANGED
    
    | 
         @@ -16,14 +16,26 @@ module RubyGg 
     | 
|
| 
       16 
16 
     | 
    
         
             
                        @leagueVer = HTTParty.get('https://ddragon.leagueoflegends.com/api/versions.json').parsed_response[0]
         
     | 
| 
       17 
17 
     | 
    
         
             
                    end
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
      
 19 
     | 
    
         
            +
                    
         
     | 
| 
       19 
20 
     | 
    
         
             
                    def find(name)
         
     | 
| 
       20 
     | 
    
         
            -
                        userPayload = HTTParty.get( 
     | 
| 
       21 
     | 
    
         
            -
                         
     | 
| 
       22 
     | 
    
         
            -
                         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                         
     | 
| 
      
 21 
     | 
    
         
            +
                        userPayload = HTTParty.get("#{@base_url}#{@profile_url}#{id.to_i}?api_key=#{@api_key}").parsed_response
         
     | 
| 
      
 22 
     | 
    
         
            +
                        user = {}
         
     | 
| 
      
 23 
     | 
    
         
            +
                        userPayload.each{|k,v| user[k.to_sym] = v}
         
     | 
| 
      
 24 
     | 
    
         
            +
                    end
         
     | 
| 
      
 25 
     | 
    
         
            +
                    
         
     | 
| 
      
 26 
     | 
    
         
            +
                    def rank_info(id)
         
     | 
| 
      
 27 
     | 
    
         
            +
                        rankPayload = HTTParty.get("#{@base_url}#{@rank_url}#{id.to_i}?api_key=#{@api_key}").parsed_response
         
     | 
| 
      
 28 
     | 
    
         
            +
                        rankInfo = {:solo => {}, :flex => {}, :tt => {}}
         
     | 
| 
      
 29 
     | 
    
         
            +
                        rankPayload.each {|x|
         
     | 
| 
      
 30 
     | 
    
         
            +
                            if x['queueType'].eql?"RANKED_SOLO_5x5"
         
     | 
| 
      
 31 
     | 
    
         
            +
                                x.each {|k,v|rankInfo[:solo][k.to_sym] = v}
         
     | 
| 
      
 32 
     | 
    
         
            +
                            elsif x['queueType'].eql? "RANKED_FLEX_SR"
         
     | 
| 
      
 33 
     | 
    
         
            +
                                x.each {|k,v|rankInfo[:flex][k.to_sym] = v}
         
     | 
| 
      
 34 
     | 
    
         
            +
                                
         
     | 
| 
      
 35 
     | 
    
         
            +
                            elsif x['queueType'].eql? "RANKED_TT_SR"
         
     | 
| 
      
 36 
     | 
    
         
            +
                                x.each {|k,v|rankInfo[:tt][k.to_sym] = v}
         
     | 
| 
      
 37 
     | 
    
         
            +
                            end }
         
     | 
| 
      
 38 
     | 
    
         
            +
                        return rankInfo
         
     | 
| 
       27 
39 
     | 
    
         
             
                    end
         
     | 
| 
       28 
40 
     | 
    
         | 
| 
       29 
41 
     | 
    
         
             
                    def icon(iconId)
         
     | 
| 
         @@ -43,12 +55,6 @@ module RubyGg 
     | 
|
| 
       43 
55 
     | 
    
         | 
| 
       44 
56 
     | 
    
         
             
                    end
         
     | 
| 
       45 
57 
     | 
    
         | 
| 
       46 
     | 
    
         
            -
                    def get_user(id)
         
     | 
| 
       47 
     | 
    
         
            -
                        userPayload = HTTParty.get("#{@base_url}#{@profile_url}#{id.to_i}?api_key=#{@api_key}").parsed_response
         
     | 
| 
       48 
     | 
    
         
            -
                        user = {}
         
     | 
| 
       49 
     | 
    
         
            -
                        userPayload.each{|k,v| user[k.to_sym] = v}
         
     | 
| 
       50 
     | 
    
         
            -
                        return user
         
     | 
| 
       51 
     | 
    
         
            -
                    end
         
     | 
| 
       52 
58 
     | 
    
         | 
| 
       53 
59 
     | 
    
         
             
                    def get_solo(id)
         
     | 
| 
       54 
60 
     | 
    
         
             
                        rankPayload = HTTParty.get("#{@base_url}#{@rank_url}#{id.to_i}?api_key=#{@api_key}").parsed_response
         
     | 
    
        data/lib/ruby_gg/version.rb
    CHANGED