riot_lol_api 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/.DS_Store +0 -0
- data/lib/core_ext/hash.rb +29 -0
- data/lib/core_ext/string.rb +5 -0
- data/lib/riot_lol_api/client.rb +28 -6
- data/lib/riot_lol_api/model/{player.rb → block.rb} +3 -3
- data/lib/riot_lol_api/model/champion.rb +22 -0
- data/lib/riot_lol_api/model/{talent.rb → fellow_player.rb} +1 -3
- data/lib/riot_lol_api/model/game.rb +1 -1
- data/lib/riot_lol_api/model/image.rb +14 -0
- data/lib/riot_lol_api/model/info.rb +14 -0
- data/lib/riot_lol_api/model/item.rb +14 -0
- data/lib/riot_lol_api/model/leveltip.rb +14 -0
- data/lib/riot_lol_api/model/mastery.rb +0 -2
- data/lib/riot_lol_api/model/{rune.rb → page.rb} +3 -4
- data/lib/riot_lol_api/model/passive.rb +16 -0
- data/lib/riot_lol_api/model/recommended.rb +16 -0
- data/lib/riot_lol_api/model/skin.rb +14 -0
- data/lib/riot_lol_api/model/spell.rb +18 -0
- data/lib/riot_lol_api/model/summoner.rb +12 -44
- data/lib/riot_lol_api/model/var.rb +14 -0
- data/lib/riot_lol_api/model.rb +2 -2
- data/lib/riot_lol_api/version.rb +1 -1
- data/lib/riot_lol_api.rb +2 -0
- data/spec/factories/champion.rb +9 -0
- data/spec/factories/page.rb +10 -0
- data/spec/factories/summoner.rb +2 -3
- data/spec/mock_response/get_champion_by_id.json +13 -0
- data/spec/mock_response/get_champion_by_id_all_data.json +13 -0
- data/spec/riot_lol_api_spec.rb +148 -40
- metadata +25 -9
- data/spec/factories/mastery.rb +0 -9
- data/spec/factories/rune.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f0c729a9e5623a8a5ba0df115b092558d1db2bc
|
4
|
+
data.tar.gz: 6781933dc8c5b2c1d113f6d0255ceefd85cbacb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb38c0b530d75258e241e3001a75cd793422f81befbfd53c22c30a8ce664b4b3cc80e049711bd4e2a09f0208decb97c029e8bafee1d9268e30f5bfd37e7aab85
|
7
|
+
data.tar.gz: 6a02d861420dc41f4d3e2761836151ff3d65ec977b3e8215b3743b6770fc2042815df85df905f49218301e62629abcd91542ca5ddd7779b6346dbaa50e0424c6
|
data/lib/.DS_Store
CHANGED
Binary file
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'active_support/inflector'
|
2
|
+
|
3
|
+
class Hash
|
4
|
+
def to_symbol
|
5
|
+
new_hash = {}
|
6
|
+
self.each do |k,v|
|
7
|
+
k_symbol = k.to_symbol
|
8
|
+
if v.class == Array
|
9
|
+
new_hash[k_symbol] = Array.new
|
10
|
+
if v[0].class == Hash
|
11
|
+
name_class = k.singularize.camelize
|
12
|
+
v.each do |tab|
|
13
|
+
new_hash[k_symbol] << Object.const_get("RiotLolApi::Model::#{name_class}").new(tab.to_symbol)
|
14
|
+
end
|
15
|
+
else
|
16
|
+
v.each do |tab|
|
17
|
+
new_hash[k_symbol] << tab
|
18
|
+
end
|
19
|
+
end
|
20
|
+
elsif v.class == Hash
|
21
|
+
name_class = k.singularize.camelize
|
22
|
+
new_hash[k_symbol] = Object.const_get("RiotLolApi::Model::#{name_class}").new(v.to_symbol)
|
23
|
+
else
|
24
|
+
new_hash[k_symbol] = v
|
25
|
+
end
|
26
|
+
end
|
27
|
+
new_hash
|
28
|
+
end
|
29
|
+
end
|
data/lib/riot_lol_api/client.rb
CHANGED
@@ -13,9 +13,14 @@ module RiotLolApi
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
def self.get url
|
16
|
+
def self.get url, data = nil
|
17
17
|
unless RiotLolApi::TOKEN.nil?
|
18
|
-
|
18
|
+
if data.nil?
|
19
|
+
data = {:api_key => RiotLolApi::TOKEN}
|
20
|
+
else
|
21
|
+
data.merge!({:api_key => RiotLolApi::TOKEN})
|
22
|
+
end
|
23
|
+
response = HTTParty.get(url, :query => data)
|
19
24
|
case response.code
|
20
25
|
when 200
|
21
26
|
JSON.parse(response.body)
|
@@ -32,13 +37,14 @@ module RiotLolApi
|
|
32
37
|
end
|
33
38
|
end
|
34
39
|
|
40
|
+
# SUMMONER
|
41
|
+
|
35
42
|
def get_summoner_by_name name
|
36
43
|
name = name.downcase
|
37
44
|
name.strip!
|
38
45
|
response = Client.get("https://prod.api.pvp.net/api/lol/#{@region}/v1.4/summoner/by-name/#{name}")
|
39
46
|
unless response.nil?
|
40
|
-
|
41
|
-
RiotLolApi::Model::Summoner.new(:id_summoner => summoner["id"],:name => summoner["name"],:profile_icon_id => summoner["profileIconId"],:summoner_level => summoner["summonerLevel"],:revision_date_str => '',:revision_date => summoner["revisionDate"],:region => @region)
|
47
|
+
RiotLolApi::Model::Summoner.new(response[name].to_symbol.merge({:region => @region}))
|
42
48
|
else
|
43
49
|
nil
|
44
50
|
end
|
@@ -47,12 +53,28 @@ module RiotLolApi
|
|
47
53
|
def get_summoner_by_id id
|
48
54
|
response = Client.get("https://prod.api.pvp.net/api/lol/#{@region}/v1.4/summoner/#{id}")
|
49
55
|
unless response.nil?
|
50
|
-
|
51
|
-
RiotLolApi::Model::Summoner.new(:id_summoner => summoner["id"],:name => summoner["name"],:profile_icon_id => summoner["profileIconId"],:summoner_level => summoner["summonerLevel"],:revision_date_str => '',:revision_date => summoner["revisionDate"],:region => @region)
|
56
|
+
RiotLolApi::Model::Summoner.new(response[id.to_s].to_symbol.merge({:region => @region}))
|
52
57
|
else
|
53
58
|
nil
|
54
59
|
end
|
55
60
|
end
|
56
61
|
|
62
|
+
# CHAMPION
|
63
|
+
|
64
|
+
def get_champion_by_id id, data = nil, local = 'fr_FR'
|
65
|
+
if data.nil?
|
66
|
+
data = {:local => local}
|
67
|
+
else
|
68
|
+
data.merge!({:local => local})
|
69
|
+
end
|
70
|
+
|
71
|
+
response = Client.get("https://prod.api.pvp.net/api/lol/static-data/#{@region}/v1.2/champion/#{id}",data)
|
72
|
+
unless response.nil?
|
73
|
+
RiotLolApi::Model::Champion.new(response.to_symbol)
|
74
|
+
else
|
75
|
+
nil
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
57
79
|
end
|
58
80
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'riot_lol_api/model/stat'
|
2
|
+
require 'riot_lol_api/model/recommended'
|
3
|
+
require 'riot_lol_api/model/image'
|
4
|
+
require 'riot_lol_api/model/spell'
|
5
|
+
require 'riot_lol_api/model/info'
|
6
|
+
require 'riot_lol_api/model/passive'
|
7
|
+
require 'riot_lol_api/model/skin'
|
8
|
+
|
9
|
+
module RiotLolApi
|
10
|
+
module Model
|
11
|
+
class Champion
|
12
|
+
|
13
|
+
def initialize(options = {})
|
14
|
+
options.each do |key, value|
|
15
|
+
self.class.send(:attr_accessor, key.to_sym)
|
16
|
+
instance_variable_set("@#{key}", value)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,10 +1,9 @@
|
|
1
|
+
require 'riot_lol_api/model/mastery'
|
1
2
|
require 'riot_lol_api/model/slot'
|
2
3
|
|
3
4
|
module RiotLolApi
|
4
5
|
module Model
|
5
|
-
class
|
6
|
-
|
7
|
-
# attr :id_rune, :name, :current, :slots
|
6
|
+
class Page
|
8
7
|
|
9
8
|
def initialize(options = {})
|
10
9
|
options.each do |key, value|
|
@@ -15,4 +14,4 @@ module RiotLolApi
|
|
15
14
|
|
16
15
|
end
|
17
16
|
end
|
18
|
-
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'riot_lol_api/model/image'
|
2
|
+
|
3
|
+
module RiotLolApi
|
4
|
+
module Model
|
5
|
+
class Passive
|
6
|
+
|
7
|
+
def initialize(options = {})
|
8
|
+
options.each do |key, value|
|
9
|
+
self.class.send(:attr_accessor, key.to_sym)
|
10
|
+
instance_variable_set("@#{key}", value)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'riot_lol_api/model/block'
|
2
|
+
|
3
|
+
module RiotLolApi
|
4
|
+
module Model
|
5
|
+
class Recommended
|
6
|
+
|
7
|
+
def initialize(options = {})
|
8
|
+
options.each do |key, value|
|
9
|
+
self.class.send(:attr_accessor, key.to_sym)
|
10
|
+
instance_variable_set("@#{key}", value)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'riot_lol_api/model/leveltip'
|
2
|
+
require 'riot_lol_api/model/image'
|
3
|
+
require 'riot_lol_api/model/var'
|
4
|
+
|
5
|
+
module RiotLolApi
|
6
|
+
module Model
|
7
|
+
class Spell
|
8
|
+
|
9
|
+
def initialize(options = {})
|
10
|
+
options.each do |key, value|
|
11
|
+
self.class.send(:attr_accessor, key.to_sym)
|
12
|
+
instance_variable_set("@#{key}", value)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -2,8 +2,6 @@ module RiotLolApi
|
|
2
2
|
module Model
|
3
3
|
class Summoner
|
4
4
|
|
5
|
-
# attr :id_summoner, :name, :profile_icon_id, :summoner_level, :revision_date_str, :revision_date, :region
|
6
|
-
|
7
5
|
def initialize(options = {})
|
8
6
|
options.each do |key, value|
|
9
7
|
self.class.send(:attr_accessor, key.to_sym)
|
@@ -12,69 +10,39 @@ module RiotLolApi
|
|
12
10
|
end
|
13
11
|
|
14
12
|
def masteries
|
15
|
-
response = Client.get("https://prod.api.pvp.net/api/lol/#{@region}/v1.4/summoner/#{@
|
13
|
+
response = Client.get("https://prod.api.pvp.net/api/lol/#{@region}/v1.4/summoner/#{@id}/masteries")
|
16
14
|
unless response.nil?
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
masteries.each do |mastery|
|
21
|
-
# talents
|
22
|
-
tab_talents = Array.new
|
23
|
-
unless mastery['masteries'].nil?
|
24
|
-
mastery['masteries'].each do |talent|
|
25
|
-
tab_talents << RiotLolApi::Model::Talent.new(:id_talent => talent['id'], :rank => talent['rank'])
|
26
|
-
end
|
27
|
-
end
|
28
|
-
tab_masteries << RiotLolApi::Model::Mastery.new(:id_mastery => mastery["id"], :name => mastery["name"], :current => mastery["current"], :talents => tab_talents)
|
15
|
+
tab_pages = Array.new
|
16
|
+
response[self.id.to_s]['pages'].each do |page|
|
17
|
+
tab_pages << RiotLolApi::Model::Page.new(page.to_symbol)
|
29
18
|
end
|
30
|
-
|
19
|
+
tab_pages
|
31
20
|
else
|
32
21
|
nil
|
33
22
|
end
|
34
23
|
end
|
35
24
|
|
36
25
|
def runes
|
37
|
-
response = Client.get("https://prod.api.pvp.net/api/lol/#{@region}/v1.4/summoner/#{@
|
26
|
+
response = Client.get("https://prod.api.pvp.net/api/lol/#{@region}/v1.4/summoner/#{@id}/runes")
|
38
27
|
unless response.nil?
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
runes.each do |rune|
|
43
|
-
# talents
|
44
|
-
tab_slots = Array.new
|
45
|
-
unless rune['slots'].nil?
|
46
|
-
rune['slots'].each do |slot|
|
47
|
-
tab_slots << RiotLolApi::Model::Slot.new(:id_slot => slot['runeId'], :rank => slot['runeSlotId'])
|
48
|
-
end
|
49
|
-
end
|
50
|
-
tab_runes << RiotLolApi::Model::Rune.new(:id_rune => rune["id"], :name => rune["name"], :current => rune["current"], :slots => tab_slots)
|
28
|
+
tab_pages = Array.new
|
29
|
+
response[self.id.to_s]['pages'].each do |page|
|
30
|
+
tab_pages << RiotLolApi::Model::Page.new(page.to_symbol)
|
51
31
|
end
|
52
|
-
|
53
|
-
tab_runes
|
32
|
+
tab_pages
|
54
33
|
else
|
55
34
|
nil
|
56
35
|
end
|
57
36
|
end
|
58
37
|
|
59
38
|
def games
|
60
|
-
response = Client.get("https://prod.api.pvp.net/api/lol/#{@region}/v1.3/game/by-summoner/#{@
|
39
|
+
response = Client.get("https://prod.api.pvp.net/api/lol/#{@region}/v1.3/game/by-summoner/#{@id}/recent")
|
61
40
|
unless response.nil?
|
62
41
|
games = response['games']
|
63
42
|
|
64
43
|
tab_games = Array.new
|
65
44
|
games.each do |game|
|
66
|
-
|
67
|
-
tab_fellow_players = Array.new
|
68
|
-
game['fellowPlayers'].each do |fellow_player|
|
69
|
-
tab_fellow_players << RiotLolApi::Model::Player.new(:summoner_id => fellow_player['summonerId'], :team_id => fellow_player['teamId'], :champion_id => fellow_player['championId'])
|
70
|
-
end
|
71
|
-
|
72
|
-
stat = game['stats']
|
73
|
-
tab_stats = RiotLolApi::Model::Stat.new(:nexus_killed => stat['nexusKilled'] || false, :neutral_minions_killed_your_jungle => stat['neutralMinionsKilledYourJungle'] || 0,:neutral_minions_killed_enemy_jungle => stat['neutralMinionsKilledEnemyJungle'] || 0,:neutral_minions_killed => stat['neutralMinionsKilled'] || 0, :minions_denied => stat['minionsDenied'] || 0,:largest_killing_spree => stat['largestKillingSpree'],:largest_multi_kill => stat['largestMultiKill'],:legendary_items_created => stat['legendaryItemsCreated'],:largest_critical_strike => stat['largestCriticalStrike'],:killing_sprees => stat['killingSprees'] || 0, :items_purchased => stat['itemsPurchased'] || 0, :first_blood => stat['firstBlood'], :double_kills => stat['doubleKills'], :consumables_purchased => stat['consumablesPurchased'], :combat_player_score => stat['combatPlayerScore'] || 0, :champions_killed => stat['championsKilled'] || 0, :barracks_killed => stat['barracksKilled'] || 0, :total_damage_dealt_to_champions => stat['totalDamageDealtToChampions'], :gold_earned => stat['goldEarned'], :item2 => stat['item2'], :item1 => stat['item1'], :ward_placed => stat['wardPlaced'], :total_damage_taken => stat['totalDamageTaken'], :item0 => stat['item0'], :physical_damage_dealt_player => stat['physicalDamageDealtPlayer'], :total_units_healed => stat['totalUnitsHealed'], :level => stat['level'], :magic_damage_dealt_to_champions => stat['magicDamageDealtToChampions'], :magic_damage_dealt_player => stat['magicDamageDealtPlayer'], :assists => stat['assists'], :magic_damage_taken => stat['magicDamageTaken'], :num_deaths => stat['numDeaths'], :total_time_crowd_control_dealt => stat['totalTimeCrowdControlDealt'], :physical_damage_taken => stat['physicalDamageTaken'], :win => stat['win'], :team => stat['team'], :sight_wards_bought => stat['sightWardsBought'], :total_damage_dealt => stat['totalDamageDealt'], :total_heal => stat['totalHeal'], :item4 => stat['item4'], :item3 => stat['item3'], :item6 => stat['item6'], :item5 => stat['item5'], :minions_killed => stat['minionsKilled'], :time_played => stat['timePlayed'], :physical_damage_dealt_to_champions => stat['physicalDamageDealtToChampions'], :true_damage_taken => stat['trueDamageTaken'], :gold_spent => stat['goldSpent'])
|
74
|
-
|
75
|
-
# nodeCapture
|
76
|
-
|
77
|
-
tab_games << RiotLolApi::Model::Game.new(:champion_id => game['championId'], :invalid => game['invalid'], :ip_earned => game['ipEarned'], :create_date => game['createDate'], :create_date_str => '', :fellow_players => tab_fellow_players, :game_id => game['gameId'], :game_mode => game['gameMode'], :game_type => game['gameType'], :level => game['level'], :map_id => game['mapId'], :spell1 => game['spell1'], :spell2 => game['spell2'], :stats => tab_stats, :sub_type => game['subType'], :team_id => game['teamId'])
|
45
|
+
tab_games << RiotLolApi::Model::Game.new(game.to_symbol)
|
78
46
|
end
|
79
47
|
|
80
48
|
tab_games
|
data/lib/riot_lol_api/model.rb
CHANGED
data/lib/riot_lol_api/version.rb
CHANGED
data/lib/riot_lol_api.rb
CHANGED
@@ -0,0 +1,10 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :page, :class => RiotLolApi::Model::Page do
|
3
|
+
id 37482369
|
4
|
+
name "support"
|
5
|
+
current false
|
6
|
+
masteries nil
|
7
|
+
slots nil
|
8
|
+
initialize_with { new(:id => id, :name => name, :current => current, :masteries => masteries, :slots => slots) }
|
9
|
+
end
|
10
|
+
end
|
data/spec/factories/summoner.rb
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
FactoryGirl.define do
|
2
2
|
factory :summoner, :class => RiotLolApi::Model::Summoner do
|
3
|
-
|
3
|
+
id 20639710
|
4
4
|
name "PacoLoco"
|
5
5
|
profile_icon_id 8
|
6
6
|
summoner_level 30
|
7
|
-
revision_date_str ''
|
8
7
|
revision_date 1398345588000
|
9
8
|
region "euw"
|
10
|
-
initialize_with { new(:
|
9
|
+
initialize_with { new(:id => id, :name => name, :profile_icon_id => profile_icon_id, :summoner_level => summoner_level, :revision_date => revision_date, :region => region) }
|
11
10
|
end
|
12
11
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Access-Control-Allow-Headers: Content-Type
|
3
|
+
Access-Control-Allow-Methods: GET, POST, DELETE, PUT
|
4
|
+
Access-Control-Allow-Origin: *
|
5
|
+
Content-Type: application/json; charset=UTF-8
|
6
|
+
Date: Tue, 27 May 2014 11:40:47 GMT
|
7
|
+
Server: Jetty(9.1.1.v20140108)
|
8
|
+
Vary: Accept-Encoding, User-Agent
|
9
|
+
X-NewRelic-App-Data: PxQFWFFSDwQTVlhTBAcHX0YdFGQHBDcQUQxLA1tMXV1dORYzVBBGBxdCdhUSEVFRRRAEPhhQRw84HlpcDjpMEUQDTAtbFVBTRwRlTlQURD5LHGtOBQtZXkANDgxrHh1ESAEYA05WTVEJWgxaCw4YHwJJG1UGVApXVQJUAFJSCAMBBwVAag==
|
10
|
+
transfer-encoding: chunked
|
11
|
+
Connection: keep-alive
|
12
|
+
|
13
|
+
{"id":412,"key":"Thresh","name":"Thresh","title":"Garde aux chaînes"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Access-Control-Allow-Headers: Content-Type
|
3
|
+
Access-Control-Allow-Methods: GET, POST, DELETE, PUT
|
4
|
+
Access-Control-Allow-Origin: *
|
5
|
+
Content-Type: application/json; charset=UTF-8
|
6
|
+
Date: Fri, 30 May 2014 15:33:01 GMT
|
7
|
+
Server: Jetty(9.1.1.v20140108)
|
8
|
+
Vary: Accept-Encoding, User-Agent
|
9
|
+
X-NewRelic-App-Data: PxQFWFFSDwQTVlhTBAcHX0YdFGQHBDcQUQxLA1tMXV1dORYzVBBGBxdCdhUSEVFRRRAEPhhQRw84HlpcDjpMEUQDTAtbFVBTRwRlTlQURD5LHGtOBQtZXkANDgxrHh1ESAEYA05WTVIHUw5QCwkBHh5UFUNVBQUHUQEAWAMACQFTV1FTFWw=
|
10
|
+
transfer-encoding: chunked
|
11
|
+
Connection: keep-alive
|
12
|
+
|
13
|
+
{"id":412,"key":"Thresh","name":"Thresh","title":"Garde aux chaînes","image":{"full":"Thresh.png","sprite":"champion3.png","group":"champion","x":48,"y":0,"w":48,"h":48},"skins":[{"id":412000,"name":"default","num":0},{"id":412001,"name":"Thresh des profondeurs","num":1},{"id":412002,"name":"Thresh du championnat","num":2}],"lore":"Thresh est un Grand faucheur dont les chaînes maléfiques retiennent l'âme des vivants. Une seconde d'hésitation quand vous apercevez son visage spectral et vous êtes perdu. Il ne laisse dans son sillage que des hommes creux ; l'âme, elle, est captive des lueurs glauques de sa lanterne. Le Garde aux chaînes prend un plaisir sadique à tourmenter ses victimes, avant comme après leur trépas. Sa lugubre tâche ne prend jamais fin et il arpente toutes terres pour faucher d'autres esprits encore.<br><br>Thresh se fraie un chemin lent mais déterminé dans Valoran. Il choisit ses victimes l'une après l'autre, concentre son attention sur chaque âme tour à tour. Il joue avec elles, érode lentement leur raison avec son humour tordu, dément. Une fois que Thresh s'intéresse à une âme, il ne prend plus de repos jusqu'à ce qu'il la possède enfin. Puis il traîne ses proies jusqu'aux Îles obscures pour des tourments ineffables. C'est là sa seule vocation.<br><br>On ne sait pas grand-chose du passé du Garde aux chaînes, et dans la plupart des cas il ne s'agit que de contes de bonne femme et de comptines. On y évoque un cruel geôlier des temps anciens qui prenait plaisir à torturer ses prisonniers. Patient et brutal, il utilisait toutes sortes de méthodes pour briser l'esprit de ses victimes avant que leur corps ne succombe à ces tortures. Les chaînes étaient l'outil préféré du bourreau pour inspirer la terreur. Leur cliquetis annonçait sa terrible approche et promettait la souffrance à celui qui l'entendait. Nul ne s'opposa à son horrible règne jusqu'à ce que ses prisonniers ne parviennent à s'échapper au cours d'une émeute de grande envergure. Ils le submergèrent et, sans remords, le pendirent avec ses propres chaînes. Ainsi commença la non-vie du spectre terrible que nous connaissons sous le nom de Thresh – du moins d'après les contes.<br><br>Thresh hante désormais le pays, laissant derrière lui un sillage d'horreur et de désespoir. Mais il y a un but derrière ses machinations funèbres, celui de trouver des âmes plus fortes que celles des misérables humains. Il n'aura ce qu'il veut que lorsqu'il aura brisé la volonté des plus puissants guerriers de Valoran.<br><br>''Rien n'est plus exaltant que de déchiqueter un esprit, morceau par morceau.''<br>-- Thresh","blurb":"Thresh est un Grand faucheur dont les chaînes maléfiques retiennent l'âme des vivants. Une seconde d'hésitation quand vous apercevez son visage spectral et vous êtes perdu. Il ne laisse dans son sillage que des hommes creux ; l'âme, elle, est captive ...","allytips":["La communication est essentielle quand vous utilisez la lanterne de Thresh. Informez vos alliés de votre manière de l'utiliser.","Les compétences Peine capitale et Fauchage peuvent être combinées pour effectuer de puissantes actions.","Thresh peut aussi collecter les âmes des unités qu'il n'a pas tuées. Positionnez-vous de façon à être près des morts pour maximiser votre collecte."],"enemytips":["La compétence Peine capitale de Thresh a un long délai d'incantation. Dès que vous voyez l'incantation commencer, esquivez.","Briser volontairement un mur de La boîte peut aider un allié vulnérable à s'échapper.","La défense et les dégâts de Thresh reposent sur sa capacité à collecter les âmes. Tentez de le punir lorsqu'il tente de les récupérer."],"tags":["Support","Fighter"],"partype":"Mana","info":{"attack":5,"defense":6,"magic":6,"difficulty":7},"stats":{"armor":16.0,"armorperlevel":0.0,"attackdamage":46.0,"attackdamageperlevel":2.2,"attackrange":450.0,"attackspeedoffset":0.0,"attackspeedperlevel":3.5,"crit":0.0,"critperlevel":0.0,"hp":411.0,"hpperlevel":89.0,"hpregen":6.0,"hpregenperlevel":0.55,"movespeed":335.0,"mp":200.0,"mpperlevel":44.0,"mpregen":5.0,"mpregenperlevel":0.7,"spellblock":30.0,"spellblockperlevel":0.0},"spells":[{"name":"Peine capitale","description":"Thresh ligote un ennemi dans ses chaînes et l'attire vers lui. Activer cette compétence une deuxième fois attire Thresh vers l'ennemi.","sanitizedDescription":"Thresh ligote un ennemi dans ses chaînes et l'attire vers lui. Activer cette compétence une deuxième fois attire Thresh vers l'ennemi.","tooltip":"<span class=\"colorFFFFFF\">Attrape un ennemi, puis le tire vers lui ou bondit vers lui.</span> <br>Lance sa faux, infligeant {{ e1 }} <span class=\"color99FF99\">(+{{ a1 }})</span> pts de dégâts magiques à la première unité touchée et l'attirant vers lui pendant 1,5 sec. <br><br>Le délai de récupération de Peine capitale est réduit de 3 sec si un ennemi est touché.<br><br>Réactivez cette compétence pour que Thresh bondisse vers l'ennemi touché.","sanitizedTooltip":"Attrape un ennemi, puis le tire vers lui ou bondit vers lui. Lance sa faux, infligeant {{ e1 }} (+{{ a1 }}) pts de dégâts magiques à la première unité touchée et l'attirant vers lui pendant 1,5 sec. Le délai de récupération de Peine capitale est réduit de 3 sec si un ennemi est touché. Réactivez cette compétence pour que Thresh bondisse vers l'ennemi touché.","leveltip":{"label":["Dégâts","Récupération"],"effect":["{{ e1 }} -> {{ e1NL }}","{{ cooldown }} -> {{ cooldownnNL }}"]},"image":{"full":"ThreshQ.png","sprite":"spell9.png","group":"spell","x":48,"y":96,"w":48,"h":48},"resource":"{{ cost }} pts de mana","maxrank":5,"cost":[80,80,80,80,80],"costType":"Mana","costBurn":"80","cooldown":[20.0,18.0,16.0,14.0,12.0],"cooldownBurn":"20/18/16/14/12","effect":[[80,120,160,200,240],[1,1,1,1,2],[80,110,140,170,200],[3,3,3,3,3]],"effectBurn":["80/120/160/200/240","1/1.25/1.5/1.75/2","80/110/140/170/200","3"],"vars":[{"key":"a1","link":"spelldamage","coeff":[0.5]}],"range":[1075,1075,1075,1075,1075],"rangeBurn":"1075","key":"ThreshQ"},{"name":"Lien des ténèbres","description":"Thresh lance une lanterne qui protège les champions alliés proches contre les dégâts. Les alliés peuvent cliquer sur la lanterne pour foncer vers Thresh.","sanitizedDescription":"Thresh lance une lanterne qui protège les champions alliés proches contre les dégâts. Les alliés peuvent cliquer sur la lanterne pour foncer vers Thresh.","tooltip":"<span class=\"colorFFFFFF\">Crée une lanterne protectrice qu'un allié peut utiliser pour foncer vers vous.</span> <br>Lancez la lanterne à un endroit. Si un allié proche de la lanterne clique dessus, il la ramasse et Thresh les attire tous les deux vers lui.<br><br>De plus, les alliés qui en approchent gagnent un bouclier qui dure 4 sec et qui absorbe jusqu'à {{ e1 }} <span class=\"color99FF99\">(+{{ a1 }})</span> pts de dégâts. Chaque allié ne profite du bouclier qu'une seule fois par utilisation de la compétence.","sanitizedTooltip":"Crée une lanterne protectrice qu'un allié peut utiliser pour foncer vers vous. Lancez la lanterne à un endroit. Si un allié proche de la lanterne clique dessus, il la ramasse et Thresh les attire tous les deux vers lui. De plus, les alliés qui en approchent gagnent un bouclier qui dure 4 sec et qui absorbe jusqu'à {{ e1 }} (+{{ a1 }}) pts de dégâts. Chaque allié ne profite du bouclier qu'une seule fois par utilisation de la compétence.","leveltip":{"label":["Absorption du bouclier","Récupération","Coût en mana"],"effect":["{{ e1 }} -> {{ e1NL }}","{{ cooldown }} -> {{ cooldownnNL }}","{{ cost }} -> {{ costnNL }}"]},"image":{"full":"ThreshW.png","sprite":"spell9.png","group":"spell","x":96,"y":96,"w":48,"h":48},"resource":"{{ cost }} pts de mana","maxrank":5,"cost":[50,55,60,65,70],"costType":"Mana","costBurn":"50/55/60/65/70","cooldown":[22.0,20.5,19.0,17.5,16.0],"cooldownBurn":"22/20.5/19/17.5/16","effect":[[60,95,130,165,200],[10,15,25,35,45],[2,2,2,2,2],[35,35,35,35,35]],"effectBurn":["60/95/130/165/200","10/15/25/35/45","2","35"],"vars":[{"key":"a1","link":"spelldamage","coeff":[0.4]}],"range":[950,950,950,950,950],"rangeBurn":"950","key":"ThreshW"},{"name":"Fauchage","description":"Les attaques de Thresh se chargent, infligeant davantage de dégâts s'il attend plus entre les attaques. À l'activation, Thresh effectue un fauchage avec sa chaîne, envoyant tous les ennemis touchés dans la direction du coup.","sanitizedDescription":"Les attaques de Thresh se chargent, infligeant davantage de dégâts s'il attend plus entre les attaques. À l'activation, Thresh effectue un fauchage avec sa chaîne, envoyant tous les ennemis touchés dans la direction du coup.","tooltip":"<span class=\"size14 colorFF9900\">Passive : </span><span class=\"colorFFFFFF\">chaque coup inflige de {{ f1 }} à {{ f2 }} pts de dégâts magiques supplémentaires, dégâts qui augmentent quand vous n'attaquez pas.</span><br>Les dégâts supplémentaires sont équivalents au nombre d'âmes collectées plus jusqu'à {{ e3 }}%<span class=\"color99FF99\"></span> de ses dégâts d'attaque. Le pourcentage dépend du temps écoulé depuis sa dernière attaque.<br><br><span class=\"size14 colorFF9900\">Active : </span><span class=\"colorFFFFFF\">envoie les ennemis proches dans la direction de votre choix.</span> <br>Inflige {{ e1 }} <span class=\"color99FF99\">(+{{ a1 }})</span> pts de dégâts magiques sur une ligne qui part de derrière lui. Les ennemis touchés sont envoyés dans la direction du coup, puis ralentis de {{ e2 }}% pendant 1,5 sec.<br><br>Lancer vers l'avant pour repousser et vers l'arrière pour attirer.","sanitizedTooltip":"Passive : chaque coup inflige de {{ f1 }} à {{ f2 }} pts de dégâts magiques supplémentaires, dégâts qui augmentent quand vous n'attaquez pas. Les dégâts supplémentaires sont équivalents au nombre d'âmes collectées plus jusqu'à {{ e3 }}% de ses dégâts d'attaque. Le pourcentage dépend du temps écoulé depuis sa dernière attaque. Active : envoie les ennemis proches dans la direction de votre choix. Inflige {{ e1 }} (+{{ a1 }}) pts de dégâts magiques sur une ligne qui part de derrière lui. Les ennemis touchés sont envoyés dans la direction du coup, puis ralentis de {{ e2 }}% pendant 1,5 sec. Lancer vers l'avant pour repousser et vers l'arrière pour attirer.","leveltip":{"label":["Dégâts passifs","Dégâts actifs","Ralentissement","Coût en mana"],"effect":["{{ e3 }}% -> {{ e3NL }}%","{{ e1 }} -> {{ e1NL }}","{{ e2 }}% -> {{ e2NL }}%","{{ cost }} -> {{ costnNL }}"]},"image":{"full":"ThreshE.png","sprite":"spell9.png","group":"spell","x":144,"y":96,"w":48,"h":48},"resource":"{{ cost }} pts de mana","maxrank":5,"cost":[60,65,70,75,80],"costType":"Mana","costBurn":"60/65/70/75/80","cooldown":[9.0,9.0,9.0,9.0,9.0],"cooldownBurn":"9","effect":[[65,95,125,155,185],[20,25,30,35,40],[80,110,140,170,200]],"effectBurn":["65/95/125/155/185","20/25/30/35/40","80/110/140/170/200"],"vars":[{"key":"a1","link":"spelldamage","coeff":[0.4]}],"range":[800,800,800,800,800],"rangeBurn":"800","key":"ThreshE"},{"name":"La boîte","description":"Une prison dont les murs ralentissent et blessent les ennemis qui les brisent.","sanitizedDescription":"Une prison dont les murs ralentissent et blessent les ennemis qui les brisent.","tooltip":"<span class=\"colorFFFFFF\">Piège les ennemis entre des murs qui, s'ils sont brisés, ralentissent et infligent des dégâts.</span> <br>Crée une prison de murs spectraux autour de lui. Les champions ennemis qui traversent un mur subissent {{ e1 }} <span class=\"color99FF99\">(+{{ a1 }})</span> pts de dégâts magiques et sont ralentis de {{ e3 }}% pendant 2 sec, mais ils brisent ce mur. <br><br>Dès qu'un mur est brisé, les murs restants n'infligent que la moitié des dégâts et leur ralentissement dure moitié moins longtemps. Un ennemi ne peut pas être affecté par plusieurs murs simultanément.","sanitizedTooltip":"Piège les ennemis entre des murs qui, s'ils sont brisés, ralentissent et infligent des dégâts. Crée une prison de murs spectraux autour de lui. Les champions ennemis qui traversent un mur subissent {{ e1 }} (+{{ a1 }}) pts de dégâts magiques et sont ralentis de {{ e3 }}% pendant 2 sec, mais ils brisent ce mur. Dès qu'un mur est brisé, les murs restants n'infligent que la moitié des dégâts et leur ralentissement dure moitié moins longtemps. Un ennemi ne peut pas être affecté par plusieurs murs simultanément.","leveltip":{"label":["Dégâts","Récupération"],"effect":["{{ e1 }} -> {{ e1NL }}","{{ cooldown }} -> {{ cooldownnNL }}"]},"image":{"full":"ThreshRPenta.png","sprite":"spell9.png","group":"spell","x":192,"y":96,"w":48,"h":48},"resource":"{{ cost }} pts de mana","maxrank":3,"cost":[100,100,100],"costType":"Mana","costBurn":"100","cooldown":[150.0,140.0,130.0],"cooldownBurn":"150/140/130","effect":[[250,400,550],[2,2,2],[99,99,99],[4,4,4],[6,6,6]],"effectBurn":["250/400/550","2","99","4","6"],"vars":[{"key":"a1","link":"spelldamage","coeff":[1.0]}],"range":[450,450,450],"rangeBurn":"450","key":"ThreshRPenta"}],"passive":{"name":"Damnation","description":"Thresh peut collecter les âmes des ennemis qui meurent près de lui, augmentant définitivement son armure et sa puissance.","sanitizedDescription":"Thresh peut collecter les âmes des ennemis qui meurent près de lui, augmentant définitivement son armure et sa puissance.","image":{"full":"Thresh_Passive.png","sprite":"passive3.png","group":"passive","x":48,"y":0,"w":48,"h":48}},"recommended":[{"champion":"Thresh","title":"Beginner","type":"riot-beginner","map":"1","mode":"CLASSIC","priority":false,"blocks":[{"type":"beginner_Starter","items":[{"id":1054,"count":1},{"id":2003,"count":1}]},{"type":"beginner_Advanced","recMath":true,"items":[{"id":1028,"count":1},{"id":3067,"count":1}]},{"type":"beginner_MovementSpeed","recMath":true,"items":[{"id":1001,"count":1},{"id":1029,"count":1},{"id":3047,"count":1}]},{"type":"beginner_LegendaryItem","recMath":true,"items":[{"id":3067,"count":1},{"id":3105,"count":1},{"id":3190,"count":1}]},{"type":"beginner_MoreLegendaryItems","items":[{"id":3110,"count":1},{"id":3068,"count":1},{"id":3050,"count":1},{"id":3083,"count":1}]}]},{"champion":"Thresh","title":"Map12","type":"riot","map":"12","mode":"ARAM","priority":false,"blocks":[{"type":"starting","items":[{"id":1001,"count":1},{"id":3096,"count":1},{"id":1004,"count":1},{"id":2003,"count":4}]},{"type":"essential","items":[{"id":3028,"count":1},{"id":3111,"count":1},{"id":3105,"count":1}]},{"type":"offensive","items":[{"id":3069,"count":1},{"id":3060,"count":1},{"id":3174,"count":1}]},{"type":"defensive","items":[{"id":3065,"count":1},{"id":3110,"count":1},{"id":3222,"count":1}]},{"type":"Consumables","items":[{"id":2003,"count":1},{"id":2004,"count":1}]}]},{"champion":"Thresh","title":"TaricDM","type":"riot","map":"8","mode":"ODIN","priority":false,"blocks":[{"type":"starting","items":[{"id":1001,"count":1},{"id":3067,"count":1},{"id":2003,"count":3}]},{"type":"essential","items":[{"id":3111,"count":1},{"id":3105,"count":1},{"id":3050,"count":1}]},{"type":"offensive","items":[{"id":3060,"count":1},{"id":3092,"count":1}]},{"type":"defensive","items":[{"id":3065,"count":1},{"id":3110,"count":1},{"id":3290,"count":1}]},{"type":"Consumables","items":[{"id":2003,"count":1},{"id":2004,"count":1}]}]},{"champion":"Thresh","title":"ThreshFB","type":"riot","map":"12","mode":"FIRSTBLOOD","priority":false,"blocks":[{"type":"starting","items":[{"id":2044,"count":1},{"id":2003,"count":1},{"id":3342,"count":1},{"id":3302,"count":1}]},{"type":"essential","items":[{"id":2049,"count":1},{"id":3105,"count":1},{"id":3117,"count":1},{"id":3097,"count":1}]},{"type":"offensive","items":[{"id":3068,"count":1},{"id":3050,"count":1},{"id":3023,"count":1}]},{"type":"defensive","items":[{"id":3222,"count":1},{"id":3190,"count":1},{"id":3401,"count":1}]},{"type":"Consumables","items":[{"id":2003,"count":1},{"id":2004,"count":1},{"id":2044,"count":1},{"id":2043,"count":1}]}]},{"champion":"Thresh","title":"ThreshSR","type":"riot","map":"1","mode":"CLASSIC","priority":false,"blocks":[{"type":"starting","items":[{"id":2044,"count":1},{"id":2003,"count":1},{"id":3341,"count":1},{"id":3301,"count":1}]},{"type":"essential","items":[{"id":2049,"count":1},{"id":3105,"count":1},{"id":3117,"count":1},{"id":3096,"count":1}]},{"type":"offensive","items":[{"id":3068,"count":1},{"id":3050,"count":1},{"id":3023,"count":1},{"id":3069,"count":1}]},{"type":"defensive","items":[{"id":3222,"count":1},{"id":3190,"count":1}]},{"type":"Consumables","items":[{"id":2003,"count":1},{"id":2004,"count":1},{"id":2044,"count":1},{"id":2043,"count":1}]}]},{"champion":"Thresh","title":"TaricTT","type":"riot","map":"10","mode":"CLASSIC","priority":false,"blocks":[{"type":"starting","items":[{"id":1001,"count":1},{"id":1054,"count":1}]},{"type":"essential","items":[{"id":3111,"count":1},{"id":3105,"count":1},{"id":3050,"count":1}]},{"type":"offensive","items":[{"id":3060,"count":1},{"id":3092,"count":1}]},{"type":"defensive","items":[{"id":3065,"count":1},{"id":3110,"count":1},{"id":3290,"count":1}]},{"type":"Consumables","items":[{"id":2003,"count":1},{"id":2004,"count":1}]}]}]}
|
data/spec/riot_lol_api_spec.rb
CHANGED
@@ -4,6 +4,28 @@ require 'pp'
|
|
4
4
|
|
5
5
|
describe RiotLolApi::Client do
|
6
6
|
|
7
|
+
describe "can use string and hash ovewriting method" do
|
8
|
+
|
9
|
+
it "transform string CamelCase in to symbol" do
|
10
|
+
test = "lolApiTest"
|
11
|
+
expect(test.to_symbol).to eq :lol_api_test
|
12
|
+
end
|
13
|
+
|
14
|
+
it "transform hash keys CamelCase in to symbol" do
|
15
|
+
hash_test = {"lolApiTest" => "lol", "testLol" => "truc"}
|
16
|
+
expect(hash_test.to_symbol).to eq({:lol_api_test => "lol", :test_lol => "truc"})
|
17
|
+
end
|
18
|
+
|
19
|
+
it "Add instance of class to_symbol" do
|
20
|
+
hash_result = {"lolApiTest" => "lol", "testLol" => "truc", "masteries" => [{"id" => 4212,"rank" => 2},{"id" => 4233,"rank" => 3}], "stats" => {"truc" => 0, "machin" => 2}}.to_symbol
|
21
|
+
# Test Array
|
22
|
+
expect(hash_result[:masteries][0]).to be_a RiotLolApi::Model::Mastery
|
23
|
+
# Test Hash
|
24
|
+
expect(hash_result[:stats]).to be_a RiotLolApi::Model::Stat
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
7
29
|
describe "get_summoner_by_name" do
|
8
30
|
|
9
31
|
before(:each) do
|
@@ -21,14 +43,13 @@ describe RiotLolApi::Client do
|
|
21
43
|
expect(@summoner_test).to be_a RiotLolApi::Model::Summoner
|
22
44
|
end
|
23
45
|
|
24
|
-
it "should good attributes" do
|
46
|
+
it "should have good attributes" do
|
25
47
|
summoner = FactoryGirl.build(:summoner)
|
26
48
|
|
27
|
-
expect(@summoner_test.
|
49
|
+
expect(@summoner_test.id).to eq(summoner.id)
|
28
50
|
expect(@summoner_test.name).to eq(summoner.name)
|
29
51
|
expect(@summoner_test.profile_icon_id).to eq(summoner.profile_icon_id)
|
30
52
|
expect(@summoner_test.summoner_level).to eq(summoner.summoner_level)
|
31
|
-
expect(@summoner_test.revision_date_str).to eq(summoner.revision_date_str)
|
32
53
|
expect(@summoner_test.revision_date).to eq(summoner.revision_date)
|
33
54
|
expect(@summoner_test.region).to eq(summoner.region)
|
34
55
|
end
|
@@ -51,43 +72,42 @@ describe RiotLolApi::Client do
|
|
51
72
|
expect(@summoner_test).to be_a RiotLolApi::Model::Summoner
|
52
73
|
end
|
53
74
|
|
54
|
-
it "should good attributes" do
|
75
|
+
it "should have good attributes" do
|
55
76
|
summoner = FactoryGirl.build(:summoner)
|
56
77
|
|
57
|
-
expect(@summoner_test.
|
78
|
+
expect(@summoner_test.id).to eq(summoner.id)
|
58
79
|
expect(@summoner_test.name).to eq(summoner.name)
|
59
80
|
expect(@summoner_test.profile_icon_id).to eq(summoner.profile_icon_id)
|
60
81
|
expect(@summoner_test.summoner_level).to eq(summoner.summoner_level)
|
61
|
-
expect(@summoner_test.revision_date_str).to eq(summoner.revision_date_str)
|
62
82
|
expect(@summoner_test.revision_date).to eq(summoner.revision_date)
|
63
83
|
expect(@summoner_test.region).to eq(summoner.region)
|
64
84
|
end
|
65
85
|
end
|
66
86
|
|
67
|
-
describe "get summoner masteries" do
|
87
|
+
describe "get summoner masteries pages" do
|
68
88
|
|
69
89
|
before(:each) do
|
70
90
|
# Create summoner
|
71
91
|
summoner = FactoryGirl.build(:summoner)
|
72
92
|
|
73
93
|
api_response = File.read 'spec/mock_response/get_summoner_masteries_by_id.json'
|
74
|
-
stub_request(:get, "https://prod.api.pvp.net/api/lol/euw/v1.4/summoner/#{summoner.
|
94
|
+
stub_request(:get, "https://prod.api.pvp.net/api/lol/euw/v1.4/summoner/#{summoner.id}/masteries?api_key=#{RiotLolApi::TOKEN}").to_return(api_response)
|
75
95
|
|
76
|
-
@
|
96
|
+
@page_test = summoner.masteries
|
77
97
|
end
|
78
98
|
|
79
|
-
it "should good attributes" do
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
@
|
85
|
-
expect(
|
86
|
-
expect(
|
87
|
-
expect(
|
88
|
-
|
89
|
-
expect(
|
90
|
-
expect(
|
99
|
+
it "should have good attributes" do
|
100
|
+
tab_pages = Array.new
|
101
|
+
tab_pages << FactoryGirl.build(:page, :id => 37482369, :name => "support", :current => false, :masteries => [RiotLolApi::Model::Mastery.new(:id => 4212,:rank => 2),RiotLolApi::Model::Mastery.new(:id => 4233,:rank => 3)])
|
102
|
+
tab_pages << FactoryGirl.build(:page, :id => 37482370, :name => "jungler", :current => false, :masteries => [RiotLolApi::Model::Mastery.new(:id => 4233,:rank => 3),RiotLolApi::Model::Mastery.new(:id => 4242,:rank => 1)])
|
103
|
+
|
104
|
+
@page_test.each_with_index do |page,i|
|
105
|
+
expect(page.id).to eq(tab_pages[i].id)
|
106
|
+
expect(page.name).to eq(tab_pages[i].name)
|
107
|
+
expect(page.current).to eq(tab_pages[i].current)
|
108
|
+
page.masteries.each_with_index do |mastery,j|
|
109
|
+
expect(mastery.id).to eq(tab_pages[i].masteries[j].id)
|
110
|
+
expect(mastery.rank).to eq(tab_pages[i].masteries[j].rank)
|
91
111
|
end
|
92
112
|
end
|
93
113
|
end
|
@@ -100,23 +120,23 @@ describe RiotLolApi::Client do
|
|
100
120
|
summoner = FactoryGirl.build(:summoner)
|
101
121
|
|
102
122
|
api_response = File.read 'spec/mock_response/get_summoner_runes_by_id.json'
|
103
|
-
stub_request(:get, "https://prod.api.pvp.net/api/lol/euw/v1.4/summoner/#{summoner.
|
123
|
+
stub_request(:get, "https://prod.api.pvp.net/api/lol/euw/v1.4/summoner/#{summoner.id}/runes?api_key=#{RiotLolApi::TOKEN}").to_return(api_response)
|
104
124
|
|
105
125
|
@rune_test = summoner.runes
|
106
126
|
end
|
107
127
|
|
108
|
-
it "should good attributes" do
|
128
|
+
it "should have good attributes" do
|
109
129
|
tab_runes = Array.new
|
110
|
-
tab_runes << FactoryGirl.build(:
|
111
|
-
tab_runes << FactoryGirl.build(:
|
130
|
+
tab_runes << FactoryGirl.build(:page, :id => 6182779, :name => "ad", :current => true, :slots => [RiotLolApi::Model::Slot.new(:rune_slot_id => 1,:rune_id => 5253),RiotLolApi::Model::Slot.new(:rune_slot_id => 2,:rune_id => 5253)])
|
131
|
+
tab_runes << FactoryGirl.build(:page, :id => 6182780, :name => "ap", :current => false, :slots => [RiotLolApi::Model::Slot.new(:rune_slot_id => 1,:rune_id => 5245),RiotLolApi::Model::Slot.new(:rune_slot_id => 2,:rune_id => 5245)])
|
112
132
|
|
113
133
|
@rune_test.each_with_index do |rune,i|
|
114
|
-
expect(rune.
|
134
|
+
expect(rune.id).to eq(tab_runes[i].id)
|
115
135
|
expect(rune.name).to eq(tab_runes[i].name)
|
116
136
|
expect(rune.current).to eq(tab_runes[i].current)
|
117
137
|
rune.slots.each_with_index do |slot,j|
|
118
|
-
expect(slot.
|
119
|
-
expect(slot.
|
138
|
+
expect(slot.rune_slot_id).to eq(tab_runes[i].slots[j].rune_slot_id)
|
139
|
+
expect(slot.rune_id).to eq(tab_runes[i].slots[j].rune_id)
|
120
140
|
end
|
121
141
|
end
|
122
142
|
end
|
@@ -129,14 +149,14 @@ describe RiotLolApi::Client do
|
|
129
149
|
summoner = FactoryGirl.build(:summoner)
|
130
150
|
|
131
151
|
api_response = File.read 'spec/mock_response/get_summoner_games_by_id.json'
|
132
|
-
stub_request(:get, "https://prod.api.pvp.net/api/lol/euw/v1.3/game/by-summoner/#{summoner.
|
152
|
+
stub_request(:get, "https://prod.api.pvp.net/api/lol/euw/v1.3/game/by-summoner/#{summoner.id}/recent?api_key=#{RiotLolApi::TOKEN}").to_return(api_response)
|
133
153
|
|
134
154
|
@game_tests = summoner.games
|
135
155
|
end
|
136
156
|
|
137
|
-
it "should good attributes" do
|
138
|
-
game = FactoryGirl.build(:game, :fellow_players => [RiotLolApi::Model::
|
139
|
-
RiotLolApi::Model::Stat.new(:nexus_killed =>
|
157
|
+
it "should have good attributes" do
|
158
|
+
game = FactoryGirl.build(:game, :fellow_players => [RiotLolApi::Model::FellowPlayer.new(:summoner_id => 228437,:team_id => 200, :champion_id => 102),RiotLolApi::Model::FellowPlayer.new(:summoner_id => 25235641,:team_id => 100, :champion_id => 48)], :stats =>
|
159
|
+
RiotLolApi::Model::Stat.new(:ward_killed => nil, :vision_wards_bought => nil, :victory_point_total => nil, :unreal_kills => nil, :turrets_killed => nil, :true_damage_taken => nil, :true_damage_dealt_to_champions => nil, :true_damage_dealt_player => nil, :triple_kills => nil, :total_score_rank => nil, :total_player_score => nil, :team_objective => nil, :super_monster_killed => nil, :summon_spell2_cast => nil, :summon_spell1_cast => nil, :spell4_cast => nil, :spell3_cast => nil, :spell2_cast => nil, :spell1_cast => nil, :quadra_kills => nil, :penta_kills => nil, :objective_player_score => nil, :num_items_bought => nil, :node_neutralize_assist => nil, :node_neutralize => nil, :node_capture_assist => nil,:node_capture => nil, :nexus_killed => nil, :neutral_minions_killed_your_jungle => nil,:neutral_minions_killed_enemy_jungle => nil,:neutral_minions_killed => nil, :minions_denied => nil, :legendary_items_created => nil,:largest_multi_kill => nil, :largest_killing_spree =>nil, :largest_critical_strike => nil, :killing_sprees => nil, :items_purchased => nil,:item5 => nil, :gold_earned => 5969, :gold_spent => 5630,:first_blood => nil,:double_kills => nil,:consumables_purchased => nil, :combat_player_score => nil, :champions_killed => nil, :barracks_killed => nil,:level => 13, :num_deaths => 2, :minions_killed => 10, :total_damage_dealt => 19848, :total_damage_taken => 16127, :team => 200, :win => false, :physical_damage_dealt_player => 7116, :magic_damage_dealt_player => 12732, :physical_damage_taken => 7806, :magic_damage_taken => 8069, :time_played => 1597, :total_heal => 9241, :total_units_healed => 4, :assists => 8, :item0 => 3301, :item1 => 2049, :item2 => 3047, :item3 => 3110, :item4 => 1057, :item6 => 3340, :sight_wards_bought => 1, :magic_damage_dealt_to_champions => 3100, :physical_damage_dealt_to_champions => 1230, :total_damage_dealt_to_champions => 4330, :true_damage_taken => 252, :ward_placed => 14, :total_time_crowd_control_dealt => 602))
|
140
160
|
|
141
161
|
@game_tests.each do |game_test|
|
142
162
|
expect(game_test.game_id).to eq(game.game_id)
|
@@ -190,17 +210,105 @@ describe RiotLolApi::Client do
|
|
190
210
|
expect(game_test.stats.neutral_minions_killed_enemy_jungle).to eq(game.stats.neutral_minions_killed_enemy_jungle)
|
191
211
|
expect(game_test.stats.neutral_minions_killed_your_jungle).to eq(game.stats.neutral_minions_killed_your_jungle)
|
192
212
|
expect(game_test.stats.nexus_killed).to eq(game.stats.nexus_killed)
|
193
|
-
|
194
|
-
expect(game_test.stats.
|
195
|
-
expect(game_test.stats.
|
196
|
-
expect(game_test.stats.
|
197
|
-
expect(game_test.stats.
|
198
|
-
expect(game_test.stats.
|
199
|
-
expect(game_test.stats.
|
200
|
-
|
213
|
+
expect(game_test.stats.node_capture).to eq(game.stats.node_capture)
|
214
|
+
expect(game_test.stats.node_capture_assist).to eq(game.stats.node_capture_assist)
|
215
|
+
expect(game_test.stats.node_neutralize).to eq(game.stats.node_neutralize)
|
216
|
+
expect(game_test.stats.node_neutralize_assist).to eq(game.stats.node_neutralize_assist)
|
217
|
+
expect(game_test.stats.num_deaths).to eq(game.stats.num_deaths)
|
218
|
+
expect(game_test.stats.num_items_bought).to eq(game.stats.num_items_bought)
|
219
|
+
expect(game_test.stats.objective_player_score).to eq(game.stats.objective_player_score)
|
220
|
+
expect(game_test.stats.penta_kills).to eq(game.stats.penta_kills)
|
221
|
+
expect(game_test.stats.physical_damage_dealt_player).to eq(game.stats.physical_damage_dealt_player)
|
222
|
+
expect(game_test.stats.physical_damage_dealt_to_champions).to eq(game.stats.physical_damage_dealt_to_champions)
|
223
|
+
expect(game_test.stats.physical_damage_taken).to eq(game.stats.physical_damage_taken)
|
224
|
+
expect(game_test.stats.quadra_kills).to eq(game.stats.quadra_kills)
|
225
|
+
expect(game_test.stats.sight_wards_bought).to eq(game.stats.sight_wards_bought)
|
226
|
+
expect(game_test.stats.spell4_cast).to eq(game.stats.spell4_cast)
|
227
|
+
expect(game_test.stats.spell3_cast).to eq(game.stats.spell3_cast)
|
228
|
+
expect(game_test.stats.spell2_cast).to eq(game.stats.spell2_cast)
|
229
|
+
expect(game_test.stats.spell1_cast).to eq(game.stats.spell1_cast)
|
230
|
+
expect(game_test.stats.summon_spell1_cast).to eq(game.stats.summon_spell1_cast)
|
231
|
+
expect(game_test.stats.summon_spell2_cast).to eq(game.stats.summon_spell2_cast)
|
232
|
+
expect(game_test.stats.super_monster_killed).to eq(game.stats.super_monster_killed)
|
233
|
+
expect(game_test.stats.team).to eq(game.stats.team)
|
234
|
+
expect(game_test.stats.team_objective).to eq(game.stats.team_objective)
|
235
|
+
expect(game_test.stats.time_played).to eq(game.stats.time_played)
|
236
|
+
expect(game_test.stats.total_damage_dealt).to eq(game.stats.total_damage_dealt)
|
237
|
+
expect(game_test.stats.total_damage_dealt_to_champions).to eq(game.stats.total_damage_dealt_to_champions)
|
238
|
+
expect(game_test.stats.total_damage_taken).to eq(game.stats.total_damage_taken)
|
239
|
+
expect(game_test.stats.total_heal).to eq(game.stats.total_heal)
|
240
|
+
expect(game_test.stats.total_player_score).to eq(game.stats.total_player_score)
|
241
|
+
expect(game_test.stats.total_score_rank).to eq(game.stats.total_score_rank)
|
242
|
+
expect(game_test.stats.total_time_crowd_control_dealt).to eq(game.stats.total_time_crowd_control_dealt)
|
243
|
+
expect(game_test.stats.total_units_healed).to eq(game.stats.total_units_healed)
|
244
|
+
expect(game_test.stats.triple_kills).to eq(game.stats.triple_kills)
|
245
|
+
expect(game_test.stats.true_damage_dealt_player).to eq(game.stats.true_damage_dealt_player)
|
246
|
+
expect(game_test.stats.true_damage_dealt_to_champions).to eq(game.stats.true_damage_dealt_to_champions)
|
247
|
+
expect(game_test.stats.true_damage_taken).to eq(game.stats.true_damage_taken)
|
248
|
+
expect(game_test.stats.turrets_killed).to eq(game.stats.turrets_killed)
|
249
|
+
expect(game_test.stats.unreal_kills).to eq(game.stats.unreal_kills)
|
250
|
+
expect(game_test.stats.victory_point_total).to eq(game.stats.victory_point_total)
|
251
|
+
expect(game_test.stats.vision_wards_bought).to eq(game.stats.vision_wards_bought)
|
252
|
+
expect(game_test.stats.ward_killed).to eq(game.stats.ward_killed)
|
253
|
+
expect(game_test.stats.ward_placed).to eq(game.stats.ward_placed)
|
254
|
+
expect(game_test.stats.win).to eq(game.stats.win)
|
201
255
|
end
|
202
256
|
end
|
203
257
|
|
204
258
|
end
|
205
259
|
|
260
|
+
describe "get_champion_by_id" do
|
261
|
+
|
262
|
+
before(:each) do
|
263
|
+
# Create client
|
264
|
+
client = FactoryGirl.build(:client)
|
265
|
+
id_champion = 412
|
266
|
+
|
267
|
+
api_response = File.read 'spec/mock_response/get_champion_by_id.json'
|
268
|
+
stub_request(:get, "https://prod.api.pvp.net/api/lol/static-data/euw/v1.2/champion/#{id_champion}?local=fr_FR&api_key=#{RiotLolApi::TOKEN}").to_return(api_response)
|
269
|
+
|
270
|
+
@champion_test = client.get_champion_by_id(id_champion)
|
271
|
+
end
|
272
|
+
|
273
|
+
it "should get summoner object" do
|
274
|
+
expect(@champion_test).to be_a RiotLolApi::Model::Champion
|
275
|
+
end
|
276
|
+
|
277
|
+
it "should have good attributes" do
|
278
|
+
champion = FactoryGirl.build(:champion)
|
279
|
+
|
280
|
+
expect(@champion_test.id).to eq(champion.id)
|
281
|
+
expect(@champion_test.key).to eq(champion.key)
|
282
|
+
expect(@champion_test.name).to eq(champion.name)
|
283
|
+
expect(@champion_test.title).to eq(champion.title)
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
describe "get_champion_by_id_all_data" do
|
288
|
+
|
289
|
+
before(:each) do
|
290
|
+
# Create client
|
291
|
+
client = FactoryGirl.build(:client)
|
292
|
+
id_champion = 412
|
293
|
+
|
294
|
+
api_response = File.read 'spec/mock_response/get_champion_by_id_all_data.json'
|
295
|
+
stub_request(:get, "https://prod.api.pvp.net/api/lol/static-data/euw/v1.2/champion/#{id_champion}?local=fr_FR&champData=all&api_key=#{RiotLolApi::TOKEN}").to_return(api_response)
|
296
|
+
|
297
|
+
@champion_test = client.get_champion_by_id(id_champion,{:champData => 'all'})
|
298
|
+
end
|
299
|
+
|
300
|
+
it "should get summoner object" do
|
301
|
+
expect(@champion_test).to be_a RiotLolApi::Model::Champion
|
302
|
+
end
|
303
|
+
|
304
|
+
it "should have good attributes" do
|
305
|
+
champion = FactoryGirl.build(:champion)
|
306
|
+
|
307
|
+
expect(@champion_test.id).to eq(champion.id)
|
308
|
+
expect(@champion_test.key).to eq(champion.key)
|
309
|
+
expect(@champion_test.name).to eq(champion.name)
|
310
|
+
expect(@champion_test.title).to eq(champion.title)
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
206
314
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riot_lol_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- francois_blanchard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -109,25 +109,39 @@ files:
|
|
109
109
|
- README.md
|
110
110
|
- Rakefile
|
111
111
|
- lib/.DS_Store
|
112
|
+
- lib/core_ext/hash.rb
|
113
|
+
- lib/core_ext/string.rb
|
112
114
|
- lib/riot_lol_api.rb
|
113
115
|
- lib/riot_lol_api/client.rb
|
114
116
|
- lib/riot_lol_api/model.rb
|
117
|
+
- lib/riot_lol_api/model/block.rb
|
118
|
+
- lib/riot_lol_api/model/champion.rb
|
119
|
+
- lib/riot_lol_api/model/fellow_player.rb
|
115
120
|
- lib/riot_lol_api/model/game.rb
|
121
|
+
- lib/riot_lol_api/model/image.rb
|
122
|
+
- lib/riot_lol_api/model/info.rb
|
123
|
+
- lib/riot_lol_api/model/item.rb
|
124
|
+
- lib/riot_lol_api/model/leveltip.rb
|
116
125
|
- lib/riot_lol_api/model/mastery.rb
|
117
|
-
- lib/riot_lol_api/model/
|
118
|
-
- lib/riot_lol_api/model/
|
126
|
+
- lib/riot_lol_api/model/page.rb
|
127
|
+
- lib/riot_lol_api/model/passive.rb
|
128
|
+
- lib/riot_lol_api/model/recommended.rb
|
129
|
+
- lib/riot_lol_api/model/skin.rb
|
119
130
|
- lib/riot_lol_api/model/slot.rb
|
131
|
+
- lib/riot_lol_api/model/spell.rb
|
120
132
|
- lib/riot_lol_api/model/stat.rb
|
121
133
|
- lib/riot_lol_api/model/summoner.rb
|
122
|
-
- lib/riot_lol_api/model/
|
134
|
+
- lib/riot_lol_api/model/var.rb
|
123
135
|
- lib/riot_lol_api/version.rb
|
124
136
|
- riot_lol_api.gemspec
|
125
137
|
- spec/.DS_Store
|
138
|
+
- spec/factories/champion.rb
|
126
139
|
- spec/factories/client.rb
|
127
140
|
- spec/factories/game.rb
|
128
|
-
- spec/factories/
|
129
|
-
- spec/factories/rune.rb
|
141
|
+
- spec/factories/page.rb
|
130
142
|
- spec/factories/summoner.rb
|
143
|
+
- spec/mock_response/get_champion_by_id.json
|
144
|
+
- spec/mock_response/get_champion_by_id_all_data.json
|
131
145
|
- spec/mock_response/get_summoner_by_id.json
|
132
146
|
- spec/mock_response/get_summoner_by_name.json
|
133
147
|
- spec/mock_response/get_summoner_games_by_id.json
|
@@ -161,11 +175,13 @@ specification_version: 4
|
|
161
175
|
summary: Riot games api
|
162
176
|
test_files:
|
163
177
|
- spec/.DS_Store
|
178
|
+
- spec/factories/champion.rb
|
164
179
|
- spec/factories/client.rb
|
165
180
|
- spec/factories/game.rb
|
166
|
-
- spec/factories/
|
167
|
-
- spec/factories/rune.rb
|
181
|
+
- spec/factories/page.rb
|
168
182
|
- spec/factories/summoner.rb
|
183
|
+
- spec/mock_response/get_champion_by_id.json
|
184
|
+
- spec/mock_response/get_champion_by_id_all_data.json
|
169
185
|
- spec/mock_response/get_summoner_by_id.json
|
170
186
|
- spec/mock_response/get_summoner_by_name.json
|
171
187
|
- spec/mock_response/get_summoner_games_by_id.json
|
data/spec/factories/mastery.rb
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
FactoryGirl.define do
|
2
|
-
factory :mastery, :class => RiotLolApi::Model::Mastery do
|
3
|
-
id_mastery 37482369
|
4
|
-
name "support"
|
5
|
-
current false
|
6
|
-
talents nil
|
7
|
-
initialize_with { new(:id_mastery => id_mastery, :name => name, :current => current, :talents => talents) }
|
8
|
-
end
|
9
|
-
end
|
data/spec/factories/rune.rb
DELETED