rito_api 0.1.0 → 0.1.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: 6e7b0419fd5e570039a9f1956e9c555e228afd98
4
- data.tar.gz: c98b96ff460f032ef9e004084a3326a1700db22b
3
+ metadata.gz: defbb82c46a204fb5b399779edeb88aed1f27539
4
+ data.tar.gz: 87f85c6e2c945b96a7ed7458f491ab127cc6a505
5
5
  SHA512:
6
- metadata.gz: 57ae8cee5444681a6ba1130c4ab833084560fc42601b496209345c4eb12c3d4c4f3555005147ed53a606ef6510b24cfc2b56195910df4fdaab4758e27def99c9
7
- data.tar.gz: f5649a767b4d62dbc17c3f947ec7e47355eb6dc9b4f4c4590132a24db7b06b364fc3d92df99b4968810caf5ebd4f7ffc7d08699c93354664573143e3f4ddd3b6
6
+ metadata.gz: db7fa24b976af7bccfe597e37c16b788ed9fcedb28b4120ae23515ec3bb67a7701b03367a7a5d9deedbdec26d8fa8b27abd36eb5fb8a85f25f7ac9c3481b9bba
7
+ data.tar.gz: a1f7d2f95aad63984f03dc51a9b18bff65ecd36ce8d797d2dc11d9054b1415eb89dbe1d2ceb55c209feb596a9403356d0e12af4d988ef1f7d3e711bce060373b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rito_api (0.1.0)
4
+ rito_api (0.1.1)
5
5
  fileutils (~> 1.0, >= 1.0.2)
6
6
  httparty (~> 0.16.1)
7
7
  moneta (~> 1.0)
data/README.md CHANGED
@@ -22,8 +22,109 @@ Or install it yourself as:
22
22
 
23
23
  ## Usage
24
24
 
25
- TODO: Write usage instructions here
25
+ Create a client. You can declare whether to cache it or not. Caching is consider more productive.
26
+ *Only supports Redis caching so you need to run redis server before declaring cache as true.
26
27
 
28
+ ```rb
29
+ client = RitoApi::Client(api_key, region, true, 180) # client = RitoApi:Client(api_key, region, cache[true or false], ttl[time till expiration in seconds]).
30
+ # By default caching is set to false.
31
+ ```
32
+ There are 5 kinds of public readable request formats. summoner, champion, item, match, challenger
33
+
34
+ Challenger:
35
+ ```rb
36
+ challengers = client.challenger.solo_queue(count, ttl) # Yes you can modify ttl for every method to overwrite the initial ttl.
37
+ # Count will give back that number of results from the 200 challenger result. If you put down name or number <= 0 and > 200 it will return all 200 results.
38
+ #Example:
39
+ top5chalengers = client.challengers.solo_queue(5, 3600) # This will give you top 5 challengers and save the challengers in the cache for 60 minutes.
40
+ ```
41
+ Summoner:
42
+ ```rb
43
+ #find(IGN) => Find the summoner for given IGN.
44
+ mySummoner = client.summoner.find('rockerturner') # you can pass ttl as second argument but by default it will use the initialized ttl which is 180 here.
45
+
46
+ #rank_info => returns rank information for given IGN. if not ranked on any queue; should return nil or {}.
47
+ myRank = client.summoner.rank_info('rockerturner')
48
+
49
+ #solo, flex, tt => will use rank_info to get queried rank.
50
+ mySoloRank = client.summoner.solo('rockerturner')
51
+ myFlexRank = client.summoner.flex('rockerturner')
52
+ myTwistedTreeRank = client.summoner.tt('rockerturner')
53
+
54
+ #recent_matches => returns 20 recent matches fragment data of given IGN.
55
+ myRecentMatches => client.summoner.recent_matches('rockerturner')
56
+
57
+ #top_positions => return 2 top position played by the summoner in last 20 matches of given IGN.
58
+ myTopPositions = client.summoner.top_positions('rockerturner')
59
+
60
+ #champion_mastery => returns all the champion mastery for given ign with mastery level and points. You can pass in second argument of count to get top count mastery.
61
+ myTop3Masteries = client.summoner.champion_mastery('rockerturner', 3)
62
+
63
+ #icon => return icon link of the given iconID.
64
+ myIcon = client.summoner.icon(iconId) # You can get iconID from metadata of find(ign).
65
+ #Example:
66
+ rockerturner_icon = client.summoner.icon(mySummoner[:profileIconId]) #mySummoner was defined earlier.
67
+ ```
68
+ Champion:
69
+ ```rb
70
+ #Champion calls are relatively easy.
71
+
72
+ #get_name => gets the name of given champion ID.
73
+ championName = client.champion.get_name('43') # Returns Karma.
74
+
75
+ #Lets make real use of this.
76
+
77
+ myTop3Masteries.each do |champion|
78
+ puts client.champion.get_name(champion[:championId]) #This is print out the name of myTop3Masteries champions.
79
+ end
80
+
81
+ #icon => gets the icon link for the given champion.
82
+
83
+ vayneIcon = client.champion.icon('Vayne') #casesensitive. wukong is MonkeyKing
84
+
85
+ #points => just gives K or M depending on the points sent in.
86
+
87
+ myPoints = client.champion.points(500000) # Will return 500K
88
+
89
+ #Lets make real use of this.
90
+
91
+ myTop3Masteries.each do |champion|
92
+ puts "#{client.champion.get_name(champion[:championId])} = #{client.champion.points(champion[:championPoints])}"
93
+ #This is print out the name = masteryPoints of myTop3Masteries champions.
94
+ end
95
+ ```
96
+ #match
97
+ ```rb
98
+ #get => gets match information.
99
+ myMatch = client.matches.get(matchId) # You can get a matchID from summoner.recent_matches.
100
+ rockerturnerMatch = client.matches.get(2769842762) # This is one of my matches. We will be using it as an example for rest of the methods.
101
+
102
+ #get_bans => gets all the banned championId. Separated into 2 arrays for blue and red team.
103
+ rockerturnerMatchBans = client.matches.get_bans(2769842762)
104
+
105
+ #get_players => gets all the players in the match with their ign and id and iconId etcetera.
106
+ rockerturnerMatchPlayers = client.matches.get_players(2769842762)
107
+
108
+ #stats => gets the stats of the game.
109
+ rockerturnerMatchStats = client.matches.stats(2769842762)
110
+
111
+ #player_stats => returns players stats playing certain champion.
112
+ #I played karma this game and champion ID for karma is 43. you can find champID in meta data of get_players.
113
+ rockerturnerStats = client.matches.player_stats(2769842762, 43)
114
+
115
+ #player_identities => returns the player identity from the participant ID which can be obtained from get_players or stats or player_stats.
116
+ #My participantId this game was 2.
117
+ rockerturnerIdentities = client.matches.player_identities(2769842762, 2)
118
+ ```
119
+
120
+ #item
121
+ ```rb
122
+ #get_icon => returns link for given item id.
123
+ ardentIcon = client.item.get_icon(3504)
124
+
125
+ #spells_icon(id)
126
+ flashIcon = client.item.spells_icon(4)
127
+ ```
27
128
  ## Development
28
129
 
29
130
  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.
@@ -44,6 +44,123 @@ module RitoApi
44
44
  end
45
45
  return playerIdentity
46
46
  end
47
+
48
+ def get_runes(matchId, championId, ttl = @ttl)
49
+ slots = {
50
+ 8200 => {
51
+ :key => "Sorcery",
52
+ :icon => "perk-images/Styles/7202_Sorcery.png",
53
+ :runes => {
54
+ 8210=>{:key=>"Transcendence", :icon=>"perk-images/Styles/Sorcery/Transcendence/Transcendence.png"},
55
+ 8214=>{:key=>"SummonAery", :icon=>"perk-images/Styles/Sorcery/SummonAery/SummonAery.png"},
56
+ 8224=>{:key=>"NullifyingOrb", :icon=>"perk-images/Styles/Sorcery/NullifyingOrb/Pokeshield.png"},
57
+ 8226=>{:key=>"ManaflowBand", :icon=>"perk-images/Styles/Sorcery/ManaflowBand/ManaflowBand.png"},
58
+ 8229=>{:key=>"ArcaneComet", :icon=>"perk-images/Styles/Sorcery/ArcaneComet/ArcaneComet.png"},
59
+ 8230=>{:key=>"PhaseRush", :icon=>"perk-images/Styles/Sorcery/PhaseRush/PhaseRush.png"},
60
+ 8232=>{:key=>"Waterwalking", :icon=>"perk-images/Styles/Sorcery/Waterwalking/Waterwalking.png"},
61
+ 8233=>{:key=>"AbsoluteFocus", :icon=>"perk-images/Styles/Sorcery/AbsoluteFocus/AbsoluteFocus.png"},
62
+ 8234=>{:key=>"Celerity", :icon=>"perk-images/Styles/Sorcery/Celerity/CelerityTemp.png"},
63
+ 8236=>{:key=>"GatheringStorm", :icon=>"perk-images/Styles/Sorcery/GatheringStorm/GatheringStorm.png"},
64
+ 8237=>{:key=>"Scorch", :icon=>"perk-images/Styles/Sorcery/Scorch/Scorch.png"},
65
+ 8243=>{:key=>"TheUltimateHat", :icon=>"perk-images/Styles/Sorcery/TheUltimateHat/TheUltimateHat.png"},
66
+ }
67
+
68
+ },
69
+
70
+ 8300 => {
71
+ :key => "Inspiration",
72
+ :icon => "perk-images/Styles/7203_Whimsy.png",
73
+ :runes => {
74
+ 8304=>{:key=>"MagicalFootwear", :icon=>"perk-images/Styles/Inspiration/MagicalFootwear/MagicalFootwear.png"},
75
+ 8306=>{:key=>"HextechFlashtraption", :icon=>"perk-images/Styles/Inspiration/HextechFlashtraption/HextechFlashtraption.png"},
76
+ 8313=>{:key=>"PerfectTiming", :icon=>"perk-images/Styles/Inspiration/PerfectTiming/PerfectTiming.png"},
77
+ 8316=>{:key=>"MinionDematerializer", :icon=>"perk-images/Styles/Inspiration/MinionDematerializer/MinionDematerializer.png"},
78
+ 8321=>{:key=>"FuturesMarket", :icon=>"perk-images/Styles/Inspiration/FuturesMarket/FuturesMarket.png"},
79
+ 8326=>{:key=>"UnsealedSpellbook", :icon=>"perk-images/Styles/Inspiration/UnsealedSpellbook/UnsealedSpellbook.png"},
80
+ 8345=>{:key=>"BiscuitDelivery", :icon=>"perk-images/Styles/Inspiration/BiscuitDelivery/BiscuitDelivery.png"},
81
+ 8347=>{:key=>"CosmicInsight", :icon=>"perk-images/Styles/Inspiration/CosmicInsight/CosmicInsight.png"},
82
+ 8351=>{:key=>"GlacialAugment", :icon=>"perk-images/Styles/Inspiration/GlacialAugment/GlacialAugment.png"},
83
+ 8352=>{:key=>"TimeWarpTonic", :icon=>"perk-images/Styles/Inspiration/TimeWarpTonic/TimeWarpTonic.png"},
84
+ 8359=>{:key=>"Kleptomancy", :icon=>"perk-images/Styles/Inspiration/Kleptomancy/Kleptomancy.png"},
85
+ 8410=>{:key=>"ApproachVelocity", :icon=>"perk-images/Styles/Resolve/ApproachVelocity/ApproachVelocity.png"},
86
+ }
87
+ },
88
+
89
+ 8000 => {
90
+ :icon => "perk-images/Styles/7201_Precision.png",
91
+ :key => "Precision",
92
+ :runes => {
93
+ 8005=>{:key=>"PressTheAttack", :icon=>"perk-images/Styles/Precision/PressTheAttack/PressTheAttack.png"},
94
+ 8008=>{:key=>"LethalTempo", :icon=>"perk-images/Styles/Precision/FlowofBattle/FlowofBattleTemp.png"},
95
+ 8009=>{:key=>"PresenceOfMind", :icon=>"perk-images/Styles/Precision/LastResort/LastResortIcon.png"},
96
+ 8010=>{:key=>"Conqueror", :icon=>"perk-images/Styles/Precision/Conqueror/Conqueror.png"},
97
+ 8014=>{:key=>"CoupDeGrace", :icon=>"perk-images/Styles/Precision/CoupDeGrace/CoupDeGrace.png"},
98
+ 8017=>{:key=>"CutDown", :icon=>"perk-images/Styles/Precision/CutDown/CutDown.png"},
99
+ 8021=>{:key=>"FleetFootwork", :icon=>"perk-images/Styles/Precision/FleetFootwork/FleetFootwork.png"},
100
+ 9101=>{:key=>"Overheal", :icon=>"perk-images/Styles/Precision/Overheal.png"},
101
+ 9103=>{:key=>"LegendBloodline", :icon=>"perk-images/Styles/Precision/Legend_Infamy.png"},
102
+ 9104=>{:key=>"LegendAlacrity", :icon=>"perk-images/Styles/Precision/Legend_Heroism.png"},
103
+ 9105=>{:key=>"LegendTenacity", :icon=>"perk-images/Styles/Precision/Legend_Tenacity.png"},
104
+ 9111=>{:key=>"Triumph", :icon=>"perk-images/Styles/Precision/DangerousGame.png"},
105
+ 8299=>{:key=>"LastStand", :icon=>"perk-images/Styles/Sorcery/LastStand/LastStand.png"}
106
+ }
107
+ },
108
+
109
+ 8100 => {
110
+ :icon => "perk-images/Styles/7200_Domination.png",
111
+ :key => "Domination",
112
+ :runes => {
113
+ 8105=>{:key=>"RelentlessHunter", :icon=>"perk-images/Styles/Domination/RelentlessHunter/RelentlessHunter.png"},
114
+ 8112=>{:key=>"Electrocute", :icon=>"perk-images/Styles/Domination/Electrocute/Electrocute.png"},
115
+ 8120=>{:key=>"GhostPoro", :icon=>"perk-images/Styles/Domination/GhostPoro/GhostPoro.png"},
116
+ 8124=>{:key=>"Predator", :icon=>"perk-images/Styles/Domination/Predator/Predator.png"},
117
+ 8126=>{:key=>"CheapShot", :icon=>"perk-images/Styles/Domination/CheapShot/CheapShot.png"},
118
+ 8128=>{:key=>"DarkHarvest", :icon=>"perk-images/Styles/Domination/DarkHarvest/DarkHarvest.png"},
119
+ 8134=>{:key=>"IngeniousHunter", :icon=>"perk-images/Styles/Domination/IngeniousHunter/IngeniousHunter.png"},
120
+ 8135=>{:key=>"RavenousHunter", :icon=>"perk-images/Styles/Domination/RavenousHunter/RavenousHunter.png"},
121
+ 8136=>{:key=>"ZombieWard", :icon=>"perk-images/Styles/Domination/ZombieWard/ZombieWard.png"},
122
+ 8138=>{:key=>"EyeballCollection", :icon=>"perk-images/Styles/Domination/EyeballCollection/EyeballCollection.png"},
123
+ 8139=>{:key=>"TasteOfBlood", :icon=>"perk-images/Styles/Domination/TasteOfBlood/GreenTerror_TasteOfBlood.png"},
124
+ 8143=>{:key=>"SuddenImpact", :icon=>"perk-images/Styles/Domination/SuddenImpact/SuddenImpact.png"}
125
+ }
126
+ },
127
+
128
+ 8400 => {
129
+ :icon => "perk-images/Styles/7204_Resolve.png",
130
+ :key => "Resolve",
131
+ :runes => {
132
+ 8429=>{:key=>"Conditioning", :icon=>"perk-images/Styles/Resolve/Conditioning/Conditioning.png"},
133
+ 8437=>{:key=>"GraspOfTheUndying", :icon=>"perk-images/Styles/Resolve/GraspOfTheUndying/GraspOfTheUndying.png"},
134
+ 8439=>{:key=>"Aftershock", :icon=>"perk-images/Styles/Resolve/VeteranAftershock/VeteranAftershock.png"},
135
+ 8444=>{:key=>"SecondWind", :icon=>"perk-images/Styles/Resolve/SecondWind/SecondWind.png"},
136
+ 8446=>{:key=>"Demolish", :icon=>"perk-images/Styles/Resolve/Demolish/Demolish.png"},
137
+ 8451=>{:key=>"Overgrowth", :icon=>"perk-images/Styles/Resolve/Overgrowth/Overgrowth.png"},
138
+ 8453=>{:key=>"Revitalize", :icon=>"perk-images/Styles/Resolve/Revitalize/Revitalize.png"},
139
+ 8463=>{:key=>"FontOfLife", :icon=>"perk-images/Styles/Resolve/FontOfLife/FontOfLife.png"},
140
+ 8465=>{:key=>"Guardian", :icon=>"perk-images/Styles/Resolve/Guardian/Guardian.png"},
141
+ 8472=>{:key=>"Chrysalis", :icon=>"perk-images/Styles/Resolve/Chrysalis/Chrysalis.png"},
142
+ 8473=>{:key=>"BonePlating", :icon=>"perk-images/Styles/Resolve/BonePlating/BonePlating.png"},
143
+ 8242 => {:key => 'Unflinching', :icon => 'perk-images/Styles/Sorcery/Unflinching/Unflinching.png'}
144
+ }
145
+ }
146
+
147
+
148
+ }
149
+ playerRunes = []
150
+ payCheck = player_stats(matchId, championId)
151
+ # puts slots[payCheck[:stats][:perkPrimaryStyle]]
152
+ # puts slots[payCheck[:stats][:perkPrimaryStyle]][:runes][payCheck[:stats][:perk0]][:icon]
153
+ # puts slots[payCheck[:stats][:perkSubStyle]][:icon]
154
+ playerRunes.push(runes_icon(slots[payCheck[:stats][:perkPrimaryStyle]][:runes][payCheck[:stats][:perk0]][:icon]))
155
+ playerRunes.push(runes_icon(slots[payCheck[:stats][:perkSubStyle]][:icon]))
156
+ return playerRunes
157
+ end
158
+
159
+ private
160
+ def runes_icon(pUrl)
161
+ return "http://ddragon.leagueoflegends.com/cdn/img/#{pUrl}"
162
+ end
163
+
47
164
  end
48
165
 
49
166
  end
@@ -1,3 +1,3 @@
1
1
  module RitoApi
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rito_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manish Shahi