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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4d9e5f6cff282df806de356086a1127436ae85de
4
- data.tar.gz: cc4c2e54294f23dba9cc2e312b06cbbefb0dec48
3
+ metadata.gz: 027d7133a3a1dbcef841a0901fcd779064491222
4
+ data.tar.gz: 4033d8c2c255eb877b13e4c266b5633a9a726ee7
5
5
  SHA512:
6
- metadata.gz: 92ab8933ac3d883850ba3466afb269d3e5c59c2dc5be43492c8f764dc22dba583f7fe1428ba5b7b0f56edb4b87d1f56c1a6673298a2272e79081d7c6c8bdeecb
7
- data.tar.gz: c66ecf050a7ab22364e9283b55bd751ca28171126abb50c5988505f9e7f47a5e9a4ba730fc873b1a0c33b0c54fe90d358f09a449501c2ff6e25db0b66a811ebb
6
+ metadata.gz: beee6e49644645042f0eccb8a19f0d19f25b85b8b135f8e78f7ce7f4fb61c8e8203c6fde2cdf24af3502ec4c1e224ffc5598c67194af218ecc67389df6fca9e4
7
+ data.tar.gz: b191d147f0f3da2fbe422aca12c86e99ea98b0c41d874839417c2e776335f1d9e70f397dfcbfac591dd636cf93086f659c00056487c794aebc86ec4dece90992
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby_gg (0.1.3.1)
4
+ ruby_gg (0.1.4)
5
5
  httparty (~> 0.16.1)
6
6
 
7
7
  GEM
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.get_user(id) #Where id can be int or str.
44
- You can check for id from client.challenger.solo_queue()[0][:playerOrTeamId] # Gives the id for first challenger player in the list returned.
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) # where id and count both can be str or int. Id is summoner's ID, and count is number of data you want back (it is sorted according to most mastery points).
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
- # 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*.
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
 
@@ -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
@@ -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(URI.encode("#{@base_url}#{@profile_url}by-name/#{name}?api_key=#{@api_key}")).parsed_response
21
- summonerInfo = {}
22
- summonerInfo[:user] = get_user(userPayload['id'])
23
- summonerInfo[:solo] = get_solo(userPayload['id'])
24
- summonerInfo[:flex] = get_flex(userPayload['id'])
25
- summonerInfo[:tt] = get_tt(userPayload['id'])
26
- return summonerInfo
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
@@ -1,3 +1,3 @@
1
1
  module RubyGg
2
- VERSION = "0.1.3.1"
2
+ VERSION = "0.1.4"
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.1
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manish Shahi