ruby_gg 0.1.3 → 0.1.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e890a95fd6752c8bffc5e93c9135d4589670a175
4
- data.tar.gz: 739939c7ce90866c35cdea5577e8074fc4e6596f
3
+ metadata.gz: 4d9e5f6cff282df806de356086a1127436ae85de
4
+ data.tar.gz: cc4c2e54294f23dba9cc2e312b06cbbefb0dec48
5
5
  SHA512:
6
- metadata.gz: fa819f6a50942943c7cd81e89996c88a8bf26e3c4dbd9c6985f29b4350a91f7d82534ad8e1e32866a66fcd0ff42d8b99c3600e7a2ae248e6bb0ae9eb5f50b1fc
7
- data.tar.gz: 2a31f157e60693196b10542d12bb62e3292c28a7aabcadaed04ea35aad23b844076d6012ceec83aab333e1e35e82d1c8de0204e98763fae3bf0570b76daa35fd
6
+ metadata.gz: 92ab8933ac3d883850ba3466afb269d3e5c59c2dc5be43492c8f764dc22dba583f7fe1428ba5b7b0f56edb4b87d1f56c1a6673298a2272e79081d7c6c8bdeecb
7
+ data.tar.gz: c66ecf050a7ab22364e9283b55bd751ca28171126abb50c5988505f9e7f47a5e9a4ba730fc873b1a0c33b0c54fe90d358f09a449501c2ff6e25db0b66a811ebb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby_gg (0.1.3)
4
+ ruby_gg (0.1.3.1)
5
5
  httparty (~> 0.16.1)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -51,6 +51,17 @@ returnType = [{"playerId"=>72859900, "championId"=>53, "championLevel"=>1, "cham
51
51
  client.summoner.champion_mastery(id, 3) # returns 3 top mastery points champs.
52
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
53
  ```
54
+ Gets champions name with their id.
55
+
56
+ ```ruby
57
+ client.champion.get_name(championId) # Champion Id can be str or int.
58
+ # You can get the championId from client.summoner.champion_mastery(id, count) ==> for count == 1 [0][championId] will return championId.
59
+ Example:
60
+ masteries = client.summoner.champion_mastery(72859900, 3) # That will return 3 top champion_mastery for that id *Rockerturner is the username*.
61
+ topChamp = []
62
+ masteries.each{|x| topChamp.push(x['championId'])}
63
+
64
+ ```
54
65
  ## Development
55
66
 
56
67
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -12,6 +12,150 @@ module RubyGg
12
12
  @champion_url = "/lol/league/v3/challengerleagues/by-queue/"
13
13
  end
14
14
 
15
+ def get_name(id)
16
+ champNames = {
17
+ '266' => 'Aatrox',
18
+ '103' => 'Ahri',
19
+ '84' => 'Akali',
20
+ '12' => 'Alistar',
21
+ '32' => 'Amumu',
22
+ '34' => 'Anivia',
23
+ '1' => 'Annie',
24
+ '22' => 'Ashe',
25
+ '136' => 'AurelionSol',
26
+ '268' => 'Azir',
27
+ '432' => 'Bard',
28
+ '53' => 'Blitzcrank',
29
+ '63' => 'Brand',
30
+ '201' => 'Braum',
31
+ '51' => 'Caitlyn',
32
+ '164' => 'Camille',
33
+ '69' => 'Cassiopeia',
34
+ '31' => 'Chogath',
35
+ '42' => 'Corki',
36
+ '122' => 'Darius',
37
+ '131' => 'Diana',
38
+ '36' => 'DrMundo',
39
+ '119' => 'Draven',
40
+ '245' => 'Ekko',
41
+ '60' => 'Elise',
42
+ '28' => 'Evelynn',
43
+ '81' => 'Ezreal',
44
+ '9' => 'Fiddlesticks',
45
+ '114' => 'Fiora',
46
+ '105' => 'Fizz',
47
+ '3' => 'Galio',
48
+ '41' => 'Gangplank',
49
+ '86' => 'Garen',
50
+ '150' => 'Gnar',
51
+ '79' => 'Gragas',
52
+ '104' => 'Graves',
53
+ '120' => 'Hecarim',
54
+ '74' => 'Heimerdinger',
55
+ '420' => 'Illaoi',
56
+ '427' => 'Ivern',
57
+ '39' => 'Irelia',
58
+ '40' => 'Janna',
59
+ '59' => 'JarvanIV',
60
+ '24' => 'Jax',
61
+ '126' => 'Jayce',
62
+ '202' => 'Jhin',
63
+ '222' => 'Jinx',
64
+ '145' => 'Kaisa',
65
+ '429' => 'Kalista',
66
+ '43' => 'Karma',
67
+ '30' => 'Karthus',
68
+ '38' => 'Kassadin',
69
+ '55' => 'Katarina',
70
+ '10' => 'Kayle',
71
+ '141' => 'Kayn',
72
+ '85' => 'Kennen',
73
+ '121' => 'Khazix',
74
+ '203' => 'Kindred',
75
+ '240' => 'Kled',
76
+ '96' => 'KogMaw',
77
+ '7' => 'Leblanc',
78
+ '64' => 'LeeSin',
79
+ '89' => 'Leona',
80
+ '127' => 'Lissandra',
81
+ '236' => 'Lucian',
82
+ '117' => 'Lulu',
83
+ '99' => 'Lux',
84
+ '54' => 'Malphite',
85
+ '90' => 'Malzahar',
86
+ '57' => 'Maokai',
87
+ '11' => 'MasterYi',
88
+ '21' => 'MissFortune',
89
+ '82' => 'Mordekaiser',
90
+ '25' => 'Morgana',
91
+ '267' => 'Nami',
92
+ '75' => 'Nasus',
93
+ '111' => 'Nautilus',
94
+ '76' => 'Nidalee',
95
+ '56' => 'Nocturne',
96
+ '20' => 'Nunu',
97
+ '2' => 'Olaf',
98
+ '61' => 'Orianna',
99
+ '516' => 'Ornn',
100
+ '80' => 'Pantheon',
101
+ '78' => 'Poppy',
102
+ '133' => 'Quinn',
103
+ '497' => 'Rakan',
104
+ '33' => 'Rammus',
105
+ '421' => 'RekSai',
106
+ '58' => 'Renekton',
107
+ '107' => 'Rengar',
108
+ '92' => 'Riven',
109
+ '68' => 'Rumble',
110
+ '13' => 'Ryze',
111
+ '113' => 'Sejuani',
112
+ '35' => 'Shaco',
113
+ '98' => 'Shen',
114
+ '102' => 'Shyvana',
115
+ '27' => 'Singed',
116
+ '14' => 'Sion',
117
+ '15' => 'Sivir',
118
+ '72' => 'Skarner',
119
+ '37' => 'Sona',
120
+ '16' => 'Soraka',
121
+ '50' => 'Swain',
122
+ '134' => 'Syndra',
123
+ '223' => 'TahmKench',
124
+ '163' => 'Taliyah',
125
+ '91' => 'Talon',
126
+ '44' => 'Taric',
127
+ '17' => 'Teemo',
128
+ '412' => 'Thresh',
129
+ '18' => 'Tristana',
130
+ '48' => 'Trundle',
131
+ '23' => 'Tryndamere',
132
+ '4' => 'TwistedFate',
133
+ '29' => 'Twitch',
134
+ '77' => 'Udyr',
135
+ '6' => 'Urgot',
136
+ '110' => 'Varus',
137
+ '67' => 'Vayne',
138
+ '45' => 'Veigar',
139
+ '161' => 'Velkoz',
140
+ '254' => 'Vi',
141
+ '112' => 'Viktor',
142
+ '8' => 'Vladimir',
143
+ '106' => 'Volibear',
144
+ '19' => 'Warwick',
145
+ '62' => 'MonkeyKing',
146
+ '498' => 'Xayah',
147
+ '101' => 'Xerath',
148
+ '5' => 'XinZhao',
149
+ '157' => 'Yasuo',
150
+ '83' => 'Yorick',
151
+ '154' => 'Zac',
152
+ '238' => 'Zed',
153
+ '115' => 'Ziggs',
154
+ '26' => 'Zilean',
155
+ '142' => 'Zoe',
156
+ '143' => 'Zyra'}
157
+ return champNames[id.to_s]
158
+ end
15
159
  end
16
160
 
17
161
  end
@@ -1,5 +1,6 @@
1
1
  require_relative('challenger')
2
2
  require_relative('summoner')
3
+ require_relative('champion')
3
4
  module RubyGg
4
5
 
5
6
  class Client
@@ -32,6 +33,9 @@ module RubyGg
32
33
  @summoner = Summoner.new(@api_key, @region)
33
34
  end
34
35
 
36
+ def champion
37
+ @champion = Champion.new(@api_key, @region)
38
+ end
35
39
  end
36
40
 
37
41
  end
@@ -13,19 +13,24 @@ module RubyGg
13
13
  @rank_url = '/lol/league/v3/positions/by-summoner/'
14
14
  @profile_url = '/lol/summoner/v3/summoners/'
15
15
  @top_champions = '/lol/champion-mastery/v3/champion-masteries/by-summoner/'
16
+ @leagueVer = HTTParty.get('https://ddragon.leagueoflegends.com/api/versions.json').parsed_response[0]
16
17
  end
17
18
 
18
19
  def find(name)
19
20
  userPayload = HTTParty.get(URI.encode("#{@base_url}#{@profile_url}by-name/#{name}?api_key=#{@api_key}")).parsed_response
20
21
  summonerInfo = {}
21
22
  summonerInfo[:user] = get_user(userPayload['id'])
22
- summonerInfo[:top_champions] = get_top_champions(userPayload['id'])
23
23
  summonerInfo[:solo] = get_solo(userPayload['id'])
24
24
  summonerInfo[:flex] = get_flex(userPayload['id'])
25
25
  summonerInfo[:tt] = get_tt(userPayload['id'])
26
26
  return summonerInfo
27
27
  end
28
28
 
29
+ def icon(iconId)
30
+ icon = "https://ddragon.leagueoflegends.com/cdn/#{@leagueVer}/img/profileicon/#{iconId.to_i}.png"
31
+ return icon
32
+ end
33
+
29
34
  def champion_mastery(id, count = 0)
30
35
  mastery = HTTParty.get("#{@base_url}#{@top_champions}#{id.to_i}?api_key=#{@api_key}").parsed_response
31
36
  topChamps = []
@@ -1,3 +1,3 @@
1
1
  module RubyGg
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_gg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manish Shahi