league_of_legends 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +4 -0
  3. data/README.md +1 -1
  4. data/Rakefile +5 -0
  5. data/lib/league_of_legends/dto/champion_stats.rb +21 -0
  6. data/lib/league_of_legends/dto/game.rb +37 -0
  7. data/lib/league_of_legends/dto/player.rb +19 -0
  8. data/lib/league_of_legends/dto/ranked_stats.rb +26 -0
  9. data/lib/league_of_legends/dto/raw_stats.rb +92 -0
  10. data/lib/league_of_legends/dto/recent_games.rb +25 -0
  11. data/lib/league_of_legends/dto.rb +12 -0
  12. data/lib/league_of_legends/request/stats/by_summoner/ranked.rb +30 -0
  13. data/lib/league_of_legends/request.rb +7 -0
  14. data/lib/league_of_legends/version.rb +1 -1
  15. data/lib/league_of_legends.rb +4 -5
  16. data/spec/fixtures/vcr_cassettes/ranked_spec_stats_by_summoner.yml +44 -0
  17. data/spec/league_of_legends/api_spec.rb +1 -2
  18. data/spec/league_of_legends/dto/aggregated_stats_spec.rb +41 -2
  19. data/spec/league_of_legends/dto/base_spec.rb +1 -1
  20. data/spec/league_of_legends/dto/champion_list_spec.rb +1 -1
  21. data/spec/league_of_legends/dto/champion_spec.rb +1 -1
  22. data/spec/league_of_legends/dto/champion_stats_spec.rb +46 -0
  23. data/spec/league_of_legends/dto/game_spec.rb +36 -0
  24. data/spec/league_of_legends/dto/player_spec.rb +19 -0
  25. data/spec/league_of_legends/dto/player_stats_summary_list_spec.rb +1 -1
  26. data/spec/league_of_legends/dto/player_stats_summary_spec.rb +1 -1
  27. data/spec/league_of_legends/dto/ranked_stats_spec.rb +24 -0
  28. data/spec/league_of_legends/dto/raw_stats_spec.rb +93 -0
  29. data/spec/league_of_legends/dto/recent_games_spec.rb +22 -0
  30. data/spec/league_of_legends/request/base_spec.rb +1 -1
  31. data/spec/league_of_legends/request/champion_spec.rb +1 -3
  32. data/spec/league_of_legends/request/mapper_spec.rb +1 -1
  33. data/spec/league_of_legends/request/stats/by_summoner/ranked_spec.rb +25 -0
  34. data/spec/league_of_legends/request/stats/by_summoner/summary_spec.rb +1 -2
  35. data/spec/league_of_legends/spec_helper.rb +2 -0
  36. metadata +30 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aee1eefe05daf8e323f53035ef34e2101d7644a0
4
- data.tar.gz: 00661785cdfbe4c54b9a6c89e67ef9695439bca7
3
+ metadata.gz: 52f9958893e25f79b9a66560429067e185d597a2
4
+ data.tar.gz: 8058c26d7b47cb94539175a07632644413e75e28
5
5
  SHA512:
6
- metadata.gz: 421dfdc2975c3ac35fb14cc11530e217da467c060acdf4829978e3ce82d8066b82b55e4058071a2152e5a8da54dca13738779675df7ccf7e8eb25e949250111d
7
- data.tar.gz: efc9fb5d4d82ca1d45988e7bae7780ef3677f77e8e018422bea3a6e399f2eca8187319a53b7483b2d29d5802d2f964994ee5c12a349e7a45f3c275e6f5b3c601
6
+ metadata.gz: e2229fc1998d155cabef33642e3a724a11acd02297718985afbee5ae611d02686bf3c4ef01684518c7ba5b4c2e2173c30696931ecd59ea1a6c7fad05dd362175
7
+ data.tar.gz: bd4ad78fcca524073337e8c98bff342f46caa5b5d69805cd2d049e1e4dc44972d4fb1a29cb90de758b2a213f3c7823c63dedb255191df4f081778d43f213a347
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ # - 1.9.3
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # league_of_legends
1
+ # league_of_legends [![Build Status](https://travis-ci.org/forvalho/league_of_legends.png?branch=master)](https://travis-ci.org/forvalho/league_of_legends)
2
2
 
3
3
  This gem implements the League Of Legends API (currently in open beta). It will continue to be updated as the API evolves.
4
4
 
data/Rakefile CHANGED
@@ -1 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,21 @@
1
+ require 'league_of_legends/dto/aggregated_stats'
2
+
3
+ module ::LeagueOfLegends
4
+ module DTO
5
+ class ChampionStats
6
+
7
+ def self.version
8
+ ::LeagueOfLegends::DTO::RankedStats.version
9
+ end
10
+
11
+ attr_reader :id, :name, :stats
12
+
13
+ def initialize attributes
14
+ @id = attributes[:id].to_i
15
+ @name = attributes[:name]
16
+ @stats = ::LeagueOfLegends::DTO::AggregatedStats.new(attributes[:stats])
17
+ end
18
+
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,37 @@
1
+ require 'league_of_legends/dto/player'
2
+ require 'league_of_legends/dto/raw_stats'
3
+
4
+ module ::LeagueOfLegends
5
+ module DTO
6
+ class Game
7
+
8
+ def self.version
9
+ ::LeagueOfLegends::DTO::RecentGames.version
10
+ end
11
+
12
+ attr_reader :champion_id, :create_date, :fellow_players,
13
+ :game_id, :game_mode, :game_type, :invalid, :level, :map_id,
14
+ :spell_1, :spell_2, :stats, :sub_type, :team_id
15
+
16
+ def initialize attributes
17
+ @champion_id = attributes[:championId].to_i
18
+ @create_date = Time.at(attributes[:createDate]/1000)
19
+ @fellow_players = attributes[:fellowPlayers].map do |player|
20
+ ::LeagueOfLegends::DTO::Player.new(player)
21
+ end
22
+ @game_id = attributes[:gameId].to_i
23
+ @game_mode = attributes[:gameMode]
24
+ @game_type = attributes[:gameType]
25
+ @invalid = attributes[:invalid]
26
+ @level = attributes[:level].to_i
27
+ @map_id = attributes[:mapId].to_i
28
+ @spell_1 = attributes[:spell1].to_i
29
+ @spell_2 = attributes[:spell2].to_i
30
+ @stats = ::LeagueOfLegends::DTO::RawStats.new(attributes[:stats])
31
+ @sub_type = attributes[:subType]
32
+ @team_id = attributes[:teamId].to_i
33
+ end
34
+
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,19 @@
1
+ module ::LeagueOfLegends
2
+ module DTO
3
+ class Player
4
+
5
+ def self.version
6
+ ::LeagueOfLegends::DTO::RecentGames.version
7
+ end
8
+
9
+ attr_reader :champion_id, :summoner_id, :team_id
10
+
11
+ def initialize attributes
12
+ @champion_id = attributes[:championId].to_i
13
+ @summoner_id = attributes[:summonerId].to_i
14
+ @team_id = attributes[:teamId].to_i
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,26 @@
1
+ require 'league_of_legends/dto/base'
2
+ require 'league_of_legends/dto/champion_stats'
3
+
4
+ module ::LeagueOfLegends
5
+ module DTO
6
+ class RankedStats < ::LeagueOfLegends::DTO::Base
7
+
8
+ def self.version
9
+ 'v1.2'
10
+ end
11
+
12
+ attr_reader :summoner_id, :modify_date, :champions
13
+
14
+ def initialize json
15
+ attributes = build_attributes json
16
+
17
+ @summoner_id = attributes[:summonerId].to_i
18
+ @modify_date = Time.at(attributes[:modifyDate]/1000)
19
+ @champions = attributes[:champions].map do |champion|
20
+ ::LeagueOfLegends::DTO::ChampionStats.new(champion)
21
+ end
22
+ end
23
+
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,92 @@
1
+ module ::LeagueOfLegends
2
+ module DTO
3
+ class RawStats
4
+
5
+ def self.version
6
+ ::LeagueOfLegends::DTO::RecentGames.version
7
+ end
8
+
9
+ attr_reader
10
+
11
+ def initialize attributes
12
+ @assists = attributes[:assists].to_i
13
+ @barracks_killed = attributes[:barracksKilled].to_i
14
+ @champions_killed = attributes[:championsKilled].to_i
15
+ @combat_player_score = attributes[:combatPlayerScore].to_i
16
+ @consumables_purchased = attributes[:consumablesPurchased].to_i
17
+ @damage_dealt_player = attributes[:damageDealtPlayer].to_i
18
+ @double_kills = attributes[:doubleKills].to_i
19
+ @first_blood = attributes[:firstBlood].to_i
20
+ @gold = attributes[:gold].to_i
21
+ @gold_earned = attributes[:goldEarned].to_i
22
+ @gold_spent = attributes[:goldSpent].to_i
23
+ @item_0 = attributes[:item0].to_i
24
+ @item_1 = attributes[:item1].to_i
25
+ @item_2 = attributes[:item2].to_i
26
+ @item_3 = attributes[:item3].to_i
27
+ @item_4 = attributes[:item4].to_i
28
+ @item_5 = attributes[:item5].to_i
29
+ @item_6 = attributes[:item6].to_i
30
+ @items_purchased = attributes[:itemsPurchased].to_i
31
+ @killing_sprees = attributes[:killingSprees].to_i
32
+ @largest_critical_strike = attributes[:largestCriticalStrike].to_i
33
+ @largest_killing_spree = attributes[:largestKillingSpree].to_i
34
+ @largest_multi_kill = attributes[:largestMultiKill].to_i
35
+ @legendary_items_created = attributes[:legendaryItemsCreated].to_i
36
+ @level = attributes[:level].to_i
37
+ @magic_damage_dealt_player = attributes[:magicDamageDealtPlayer].to_i
38
+ @magic_damage_dealt_to_champions = attributes[:magicDamageDealtToChampions].to_i
39
+ @magic_damage_taken = attributes[:magicDamageTaken].to_i
40
+ @minions_denied = attributes[:minionsDenied].to_i
41
+ @minions_killed = attributes[:minionsKilled].to_i
42
+ @neutral_minions_killed = attributes[:neutralMinionsKilled].to_i
43
+ @neutral_minions_killed_enemy_jungle = attributes[:neutralMinionsKilledEnemyJungle].to_i
44
+ @neutral_minions_killed_your_jungle = attributes[:neutralMinionsKilledYourJungle].to_i
45
+ @nexus_killed = attributes[:nexusKilled]
46
+ @node_capture = attributes[:nodeCapture].to_i
47
+ @node_capture_assist = attributes[:nodeCaptureAssist].to_i
48
+ @node_neutralize = attributes[:nodeNeutralize].to_i
49
+ @node_neutralize_assist = attributes[:nodeNeutralizeAssist].to_i
50
+ @num_deaths = attributes[:numDeaths].to_i
51
+ @num_items_bought = attributes[:numItemsBought].to_i
52
+ @objective_player_score = attributes[:objectivePlayerScore].to_i
53
+ @penta_kills = attributes[:pentaKills].to_i
54
+ @physical_damage_dealt_player = attributes[:physicalDamageDealtPlayer].to_i
55
+ @physical_damage_dealt_to_champions = attributes[:physicalDamageDealtToChampions].to_i
56
+ @physical_damage_taken = attributes[:physicalDamageTaken].to_i
57
+ @quadra_kills = attributes[:quadraKills].to_i
58
+ @sight_wards_bought = attributes[:sightWardsBought].to_i
59
+ @spell_1_cast = attributes[:spell1Cast].to_i
60
+ @spell_2_cast = attributes[:spell2Cast].to_i
61
+ @spell_3_cast = attributes[:spell3Cast].to_i
62
+ @spell_4_cast = attributes[:spell4Cast].to_i
63
+ @summon_spell_1_cast = attributes[:summonSpell1Cast].to_i
64
+ @summon_spell_2_cast = attributes[:summonSpell2Cast].to_i
65
+ @super_monster_killed = attributes[:superMonsterKilled].to_i
66
+ @team = attributes[:team].to_i
67
+ @team_objective = attributes[:teamObjective].to_i
68
+ @time_played = attributes[:timePlayed].to_i
69
+ @total_damage_dealt = attributes[:totalDamageDealt].to_i
70
+ @total_damage_dealt_to_champions = attributes[:totalDamageDealtToChampions].to_i
71
+ @total_damage_taken = attributes[:totalDamageTaken].to_i
72
+ @total_heal = attributes[:totalHeal].to_i
73
+ @total_player_score = attributes[:totalPlayerScore].to_i
74
+ @total_score_rank = attributes[:totalScoreRank].to_i
75
+ @total_time_crowd_control_dealt = attributes[:totalTimeCrowdControlDealt].to_i
76
+ @total_units_healed = attributes[:totalUnitsHealed].to_i
77
+ @triple_kills = attributes[:tripleKills].to_i
78
+ @true_damage_dealt_player = attributes[:trueDamageDealtPlayer].to_i
79
+ @true_damage_dealt_to_champions = attributes[:trueDamageDealtToChampions].to_i
80
+ @true_damage_taken = attributes[:trueDamageTaken].to_i
81
+ @turrets_killed = attributes[:turretsKilled].to_i
82
+ @unreal_kills = attributes[:unrealKills].to_i
83
+ @victory_point_total = attributes[:victoryPointTotal].to_i
84
+ @vision_wards_bought = attributes[:visionWardsBought].to_i
85
+ @ward_killed = attributes[:wardKilled].to_i
86
+ @ward_placed = attributes[:wardPlaced].to_i
87
+ @win = attributes[:win]
88
+ end
89
+
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,25 @@
1
+ require 'league_of_legends/dto/base'
2
+ require 'league_of_legends/dto/game'
3
+
4
+ module ::LeagueOfLegends
5
+ module DTO
6
+ class RecentGames
7
+
8
+ def self.version
9
+ 'v1.3'
10
+ end
11
+
12
+ attr_reader :games, :summoner_id
13
+
14
+ def initialize json
15
+ attributes = build_attributes json
16
+
17
+ @games = attributes[:games].map do |game|
18
+ ::LeagueOfLegends::DTO::Game.new(game)
19
+ end
20
+ @summoner_id = attributes[:summonerId]
21
+ end
22
+
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,12 @@
1
+ require 'league_of_legends/dto/aggregated_stats'
2
+ require 'league_of_legends/dto/base'
3
+ require 'league_of_legends/dto/champion'
4
+ require 'league_of_legends/dto/champion_list'
5
+ require 'league_of_legends/dto/champion_stats'
6
+ require 'league_of_legends/dto/game'
7
+ require 'league_of_legends/dto/player'
8
+ require 'league_of_legends/dto/player_stats_summary'
9
+ require 'league_of_legends/dto/player_stats_summary_list'
10
+ require 'league_of_legends/dto/ranked_stats'
11
+ require 'league_of_legends/dto/raw_stats'
12
+ require 'league_of_legends/dto/recent_games'
@@ -0,0 +1,30 @@
1
+ require 'league_of_legends'
2
+
3
+ module ::LeagueOfLegends
4
+ module Request
5
+ module Stats
6
+ module BySummoner
7
+ class Ranked < ::LeagueOfLegends::Request::Base
8
+
9
+ attr_reader :summoner_id
10
+
11
+ def initialize api, summoner_id, options = {}
12
+ super(api, options)
13
+ @summoner_id = summoner_id
14
+ end
15
+
16
+ def self.dto_class
17
+ ::LeagueOfLegends::DTO::RankedStats
18
+ end
19
+
20
+ protected
21
+
22
+ def base_url
23
+ super << "stats/by-summoner/#{summoner_id}/ranked"
24
+ end
25
+
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,7 @@
1
+ require 'league_of_legends/request/all'
2
+ require 'league_of_legends/request/base'
3
+ require 'league_of_legends/request/champion'
4
+ require 'league_of_legends/request/mapper'
5
+
6
+ require 'league_of_legends/request/stats/by_summoner/summary'
7
+ require 'league_of_legends/request/stats/by_summoner/ranked'
@@ -1,3 +1,3 @@
1
1
  module LeagueOfLegends
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -1,5 +1,4 @@
1
- require "league_of_legends/version"
2
-
3
- module LeagueOfLegends
4
- # Your code goes here...
5
- end
1
+ require 'league_of_legends/api'
2
+ require 'league_of_legends/dto'
3
+ require 'league_of_legends/request'
4
+ require 'league_of_legends/version'
@@ -0,0 +1,44 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://prod.api.pvp.net/api/lol/euw/v1.2/stats/by-summoner/31747504/ranked?api_key=a1a1a1a1-a1a1-a1a1-a1a1-a1a1a1a1a1a1
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - '*/*'
14
+ User-Agent:
15
+ - Ruby
16
+ Host:
17
+ - prod.api.pvp.net
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Access-Control-Allow-Headers:
24
+ - Content-Type
25
+ Access-Control-Allow-Methods:
26
+ - GET, POST, DELETE, PUT
27
+ Access-Control-Allow-Origin:
28
+ - '*'
29
+ Content-Type:
30
+ - application/json;charset=UTF-8
31
+ Date:
32
+ - Thu, 13 Feb 2014 01:33:04 GMT
33
+ Server:
34
+ - Jetty(9.1.0.v20131115)
35
+ Transfer-Encoding:
36
+ - chunked
37
+ Connection:
38
+ - keep-alive
39
+ body:
40
+ encoding: UTF-8
41
+ string: '{"summonerId":31747504,"modifyDate":1391990692000,"champions":[{"id":59,"name":"JarvanIV","stats":{"totalSessionsPlayed":2,"totalSessionsLost":1,"totalSessionsWon":1,"totalChampionKills":8,"totalDamageDealt":256026,"totalDamageTaken":62473,"mostChampionKillsPerSession":4,"totalMinionKills":112,"totalDoubleKills":0,"totalTripleKills":0,"totalQuadraKills":0,"totalPentaKills":0,"totalUnrealKills":0,"totalDeathsPerSession":9,"totalGoldEarned":25091,"mostSpellsCast":0,"totalTurretsKilled":4,"totalPhysicalDamageDealt":211641,"totalMagicDamageDealt":24715,"totalFirstBlood":0,"totalAssists":39,"maxChampionsKilled":4,"maxNumDeaths":6}},{"id":89,"name":"Leona","stats":{"totalSessionsPlayed":3,"totalSessionsLost":1,"totalSessionsWon":2,"totalChampionKills":4,"totalDamageDealt":79593,"totalDamageTaken":70077,"mostChampionKillsPerSession":3,"totalMinionKills":60,"totalDoubleKills":0,"totalTripleKills":0,"totalQuadraKills":0,"totalPentaKills":0,"totalUnrealKills":0,"totalDeathsPerSession":20,"totalGoldEarned":26551,"mostSpellsCast":0,"totalTurretsKilled":1,"totalPhysicalDamageDealt":24074,"totalMagicDamageDealt":52174,"totalFirstBlood":0,"totalAssists":43,"maxChampionsKilled":3,"maxNumDeaths":8}},{"id":58,"name":"Renekton","stats":{"totalSessionsPlayed":3,"totalSessionsLost":1,"totalSessionsWon":2,"totalChampionKills":12,"totalDamageDealt":424630,"totalDamageTaken":80991,"mostChampionKillsPerSession":7,"totalMinionKills":594,"totalDoubleKills":2,"totalTripleKills":0,"totalQuadraKills":0,"totalPentaKills":0,"totalUnrealKills":0,"totalDeathsPerSession":9,"totalGoldEarned":35129,"mostSpellsCast":0,"totalTurretsKilled":7,"totalPhysicalDamageDealt":352076,"totalMagicDamageDealt":69583,"totalFirstBlood":0,"totalAssists":26,"maxChampionsKilled":7,"maxNumDeaths":5}},{"id":412,"name":"Thresh","stats":{"totalSessionsPlayed":15,"totalSessionsLost":6,"totalSessionsWon":9,"totalChampionKills":31,"totalDamageDealt":452623,"totalDamageTaken":277192,"mostChampionKillsPerSession":9,"totalMinionKills":409,"totalDoubleKills":2,"totalTripleKills":0,"totalQuadraKills":0,"totalPentaKills":0,"totalUnrealKills":0,"totalDeathsPerSession":65,"totalGoldEarned":135349,"mostSpellsCast":0,"totalTurretsKilled":5,"totalPhysicalDamageDealt":119867,"totalMagicDamageDealt":331869,"totalFirstBlood":0,"totalAssists":203,"maxChampionsKilled":9,"maxNumDeaths":11}},{"id":55,"name":"Katarina","stats":{"totalSessionsPlayed":1,"totalSessionsLost":1,"totalSessionsWon":0,"totalChampionKills":0,"totalDamageDealt":52289,"totalDamageTaken":21083,"mostChampionKillsPerSession":0,"totalMinionKills":78,"totalDoubleKills":0,"totalTripleKills":0,"totalQuadraKills":0,"totalPentaKills":0,"totalUnrealKills":0,"totalDeathsPerSession":10,"totalGoldEarned":5220,"mostSpellsCast":0,"totalTurretsKilled":0,"totalPhysicalDamageDealt":6154,"totalMagicDamageDealt":45371,"totalFirstBlood":0,"totalAssists":4,"maxChampionsKilled":0,"maxNumDeaths":10}},{"id":84,"name":"Akali","stats":{"totalSessionsPlayed":2,"totalSessionsLost":0,"totalSessionsWon":2,"totalChampionKills":10,"totalDamageDealt":139566,"totalDamageTaken":30841,"mostChampionKillsPerSession":6,"totalMinionKills":178,"totalDoubleKills":1,"totalTripleKills":0,"totalQuadraKills":0,"totalPentaKills":0,"totalUnrealKills":0,"totalDeathsPerSession":5,"totalGoldEarned":17237,"mostSpellsCast":0,"totalTurretsKilled":0,"totalPhysicalDamageDealt":83164,"totalMagicDamageDealt":55762,"totalFirstBlood":0,"totalAssists":15,"maxChampionsKilled":6,"maxNumDeaths":4}},{"id":154,"name":"Zac","stats":{"totalSessionsPlayed":3,"totalSessionsLost":0,"totalSessionsWon":3,"totalChampionKills":15,"totalDamageDealt":357108,"totalDamageTaken":64680,"mostChampionKillsPerSession":8,"totalMinionKills":281,"totalDoubleKills":1,"totalTripleKills":0,"totalQuadraKills":0,"totalPentaKills":0,"totalUnrealKills":0,"totalDeathsPerSession":6,"totalGoldEarned":33214,"mostSpellsCast":0,"totalTurretsKilled":2,"totalPhysicalDamageDealt":48774,"totalMagicDamageDealt":296717,"totalFirstBlood":0,"totalAssists":35,"maxChampionsKilled":8,"maxNumDeaths":4}},{"id":222,"name":"Jinx","stats":{"totalSessionsPlayed":2,"totalSessionsLost":1,"totalSessionsWon":1,"totalChampionKills":10,"totalDamageDealt":274968,"totalDamageTaken":37226,"mostChampionKillsPerSession":6,"totalMinionKills":398,"totalDoubleKills":2,"totalTripleKills":0,"totalQuadraKills":0,"totalPentaKills":0,"totalUnrealKills":0,"totalDeathsPerSession":11,"totalGoldEarned":24264,"mostSpellsCast":0,"totalTurretsKilled":5,"totalPhysicalDamageDealt":269081,"totalMagicDamageDealt":5029,"totalFirstBlood":0,"totalAssists":19,"maxChampionsKilled":6,"maxNumDeaths":7}},{"id":60,"name":"Elise","stats":{"totalSessionsPlayed":1,"totalSessionsLost":1,"totalSessionsWon":0,"totalChampionKills":7,"totalDamageDealt":76681,"totalDamageTaken":22186,"mostChampionKillsPerSession":7,"totalMinionKills":91,"totalDoubleKills":0,"totalTripleKills":0,"totalQuadraKills":0,"totalPentaKills":0,"totalUnrealKills":0,"totalDeathsPerSession":7,"totalGoldEarned":9439,"mostSpellsCast":0,"totalTurretsKilled":0,"totalPhysicalDamageDealt":34085,"totalMagicDamageDealt":41382,"totalFirstBlood":0,"totalAssists":1,"maxChampionsKilled":7,"maxNumDeaths":7}},{"id":1,"name":"Annie","stats":{"totalSessionsPlayed":2,"totalSessionsLost":2,"totalSessionsWon":0,"totalChampionKills":12,"totalDamageDealt":155218,"totalDamageTaken":54175,"mostChampionKillsPerSession":6,"totalMinionKills":185,"totalDoubleKills":1,"totalTripleKills":0,"totalQuadraKills":0,"totalPentaKills":0,"totalUnrealKills":0,"totalDeathsPerSession":21,"totalGoldEarned":25548,"mostSpellsCast":0,"totalTurretsKilled":1,"totalPhysicalDamageDealt":21504,"totalMagicDamageDealt":131360,"totalFirstBlood":0,"totalAssists":26,"maxChampionsKilled":6,"maxNumDeaths":14}},{"id":0,"name":"Combined","stats":{"totalSessionsPlayed":34,"totalSessionsLost":14,"totalSessionsWon":20,"totalChampionKills":109,"killingSpree":63,"totalDamageDealt":2268702,"totalDamageTaken":720924,"mostChampionKillsPerSession":9,"totalMinionKills":2386,"totalDoubleKills":9,"totalTripleKills":0,"totalQuadraKills":0,"totalPentaKills":0,"totalUnrealKills":0,"totalDeathsPerSession":163,"totalGoldEarned":337042,"mostSpellsCast":0,"totalTurretsKilled":25,"totalPhysicalDamageDealt":1170420,"totalMagicDamageDealt":1053962,"totalNeutralMinionsKilled":468,"totalFirstBlood":0,"totalAssists":411,"totalHeal":133458,"maxLargestKillingSpree":8,"maxLargestCriticalStrike":668,"maxChampionsKilled":9,"maxNumDeaths":14,"maxTimePlayed":3197,"maxTimeSpentLiving":1978,"normalGamesPlayed":0,"rankedSoloGamesPlayed":0,"rankedPremadeGamesPlayed":0,"botGamesPlayed":0}}]}'
42
+ http_version:
43
+ recorded_at: Thu, 13 Feb 2014 01:33:06 GMT
44
+ recorded_with: VCR 2.8.0
@@ -1,5 +1,4 @@
1
- require 'setup_vcr'
2
- require 'league_of_legends/api'
1
+ require_relative 'spec_helper'
3
2
 
4
3
  describe ::LeagueOfLegends::Api do
5
4
 
@@ -1,4 +1,4 @@
1
- require 'league_of_legends/dto/aggregated_stats'
1
+ require_relative '../spec_helper'
2
2
 
3
3
  describe ::LeagueOfLegends::DTO::AggregatedStats do
4
4
 
@@ -7,7 +7,26 @@ describe ::LeagueOfLegends::DTO::AggregatedStats do
7
7
  totalMinionKills: 1530,
8
8
  totalTurretsKilled: 29,
9
9
  totalNeutralMinionsKilled: 339,
10
- totalAssists: 75
10
+ totalAssists: 75,
11
+ totalSessionsPlayed: 2,
12
+ totalSessionsLost: 1,
13
+ totalSessionsWon: 1,
14
+ totalDamageDealt: 256026,
15
+ totalDamageTaken: 62473,
16
+ mostChampionKillsPerSession: 4,
17
+ totalDoubleKills: 0,
18
+ totalTripleKills: 0,
19
+ totalQuadraKills: 0,
20
+ totalPentaKills: 0,
21
+ totalUnrealKills: 0,
22
+ totalDeathsPerSession: 9,
23
+ totalGoldEarned: 25091,
24
+ mostSpellsCast: 0,
25
+ totalPhysicalDamageDealt: 211641,
26
+ totalMagicDamageDealt: 24715,
27
+ totalFirstBlood: 0,
28
+ maxChampionsKilled: 4,
29
+ maxNumDeaths: 6
11
30
  } }
12
31
  let(:dto) { described_class.new(attributes) }
13
32
 
@@ -17,6 +36,26 @@ describe ::LeagueOfLegends::DTO::AggregatedStats do
17
36
  expect(dto.total_turrets_killed).to eq 29
18
37
  expect(dto.total_neutral_minions_killed).to eq 339
19
38
  expect(dto.total_assists).to eq 75
39
+
40
+ expect(dto.total_sessions_played).to eq 2
41
+ expect(dto.total_sessions_lost).to eq 1
42
+ expect(dto.total_sessions_won).to eq 1
43
+ expect(dto.total_damage_dealt).to eq 256026
44
+ expect(dto.total_damage_taken).to eq 62473
45
+ expect(dto.most_champion_kills_per_session).to eq 4
46
+ expect(dto.total_double_kills).to eq 0
47
+ expect(dto.total_triple_kills).to eq 0
48
+ expect(dto.total_quadra_kills).to eq 0
49
+ expect(dto.total_penta_kills).to eq 0
50
+ expect(dto.total_unreal_kills).to eq 0
51
+ expect(dto.total_deaths_per_session).to eq 9
52
+ expect(dto.total_gold_earned).to eq 25091
53
+ expect(dto.most_spells_cast).to eq 0
54
+ expect(dto.total_physical_damage_dealt).to eq 211641
55
+ expect(dto.total_magic_damage_dealt).to eq 24715
56
+ expect(dto.total_first_blood).to eq 0
57
+ expect(dto.max_champions_killed).to eq 4
58
+ expect(dto.max_num_deaths).to eq 6
20
59
  end
21
60
 
22
61
  it "has a version" do
@@ -1,4 +1,4 @@
1
- require 'league_of_legends/dto/base'
1
+ require_relative '../spec_helper'
2
2
 
3
3
  describe ::LeagueOfLegends::DTO::Base do
4
4
 
@@ -1,4 +1,4 @@
1
- require 'league_of_legends/dto/champion_list'
1
+ require_relative '../spec_helper'
2
2
 
3
3
  describe ::LeagueOfLegends::DTO::ChampionList do
4
4
 
@@ -1,4 +1,4 @@
1
- require 'league_of_legends/dto/champion'
1
+ require_relative '../spec_helper'
2
2
 
3
3
  describe ::LeagueOfLegends::DTO::Champion do
4
4
 
@@ -0,0 +1,46 @@
1
+ require_relative '../spec_helper'
2
+
3
+ describe ::LeagueOfLegends::DTO::ChampionStats do
4
+
5
+ let(:json) { {
6
+ :id => 59,
7
+ :name => "JarvanIV",
8
+ :stats => {
9
+ :totalSessionsPlayed => 2,
10
+ :totalSessionsLost => 1,
11
+ :totalSessionsWon => 1,
12
+ :totalChampionKills => 8,
13
+ :totalDamageDealt => 256026,
14
+ :totalDamageTaken => 62473,
15
+ :mostChampionKillsPerSession => 4,
16
+ :totalMinionKills => 112,
17
+ :totalDoubleKills => 0,
18
+ :totalTripleKills => 0,
19
+ :totalQuadraKills => 0,
20
+ :totalPentaKills => 0,
21
+ :totalUnrealKills => 0,
22
+ :totalDeathsPerSession => 9,
23
+ :totalGoldEarned => 25091,
24
+ :mostSpellsCast => 0,
25
+ :totalTurretsKilled => 4,
26
+ :totalPhysicalDamageDealt => 211641,
27
+ :totalMagicDamageDealt => 24715,
28
+ :totalFirstBlood => 0,
29
+ :totalAssists => 39,
30
+ :maxChampionsKilled => 4,
31
+ :maxNumDeaths => 6
32
+ }
33
+ } }
34
+ let(:dto){ described_class.new(json) }
35
+
36
+ it "has attributes" do
37
+ expect(dto.id).to eq 59
38
+ expect(dto.name).to eq 'JarvanIV'
39
+ expect(dto.stats).to be_an_instance_of ::LeagueOfLegends::DTO::AggregatedStats
40
+ end
41
+
42
+ it "has a version" do
43
+ expect(described_class.version).to eq 'v1.2'
44
+ end
45
+
46
+ end
@@ -0,0 +1,36 @@
1
+ require_relative '../spec_helper'
2
+
3
+ describe ::LeagueOfLegends::DTO::Game do
4
+
5
+ let(:json) { '' }
6
+ let(:dto) { described_class.new(json) }
7
+
8
+ it "has attributes" do
9
+ pending "need JSON result"
10
+ expect(dto.champion_id).to eq
11
+ expect(dto.create_date).to eq Time.at(1/1000)
12
+
13
+ expect(dto.fellow_players).to be_an_instance_of Array
14
+ expect(dto.fellow_players.size).to eq
15
+ dto.fellow_players.each do |player|
16
+ expect(player).to be_an_instance_of ::LeagueOfLegends::DTO::Player
17
+ end
18
+
19
+ expect(dto.game_id).to eq
20
+ expect(dto.game_mode).to eq
21
+ expect(dto.game_type).to eq
22
+ expect(dto.invalid).to eq
23
+ expect(dto.level).to eq
24
+ expect(dto.map_id).to eq
25
+ expect(dto.spell_1).to eq
26
+ expect(dto.spell_2).to eq
27
+ expect(dto.stats).to be_an_instance_of ::LeagueOfLegends::DTO::RawStats
28
+ expect(dto.sub_type).to eq
29
+ expect(dto.team_id).to eq
30
+ end
31
+
32
+ it "has a version" do
33
+ expect(described_class.version).to eq 'v1.3'
34
+ end
35
+
36
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../spec_helper'
2
+
3
+ describe ::LeagueOfLegends::DTO::Player do
4
+
5
+ let(:json) { '' }
6
+ let(:dto){ described_class.new(json) }
7
+
8
+ it "has attributes" do
9
+ pending "need JSON result"
10
+ expect(dto.champion_id).to eq
11
+ expect(dto.summoner_id).to eq
12
+ expect(dto.team_id).to eq
13
+ end
14
+
15
+ it "has a version" do
16
+ expect(described_class.version).to eq 'v1.3'
17
+ end
18
+
19
+ end
@@ -1,4 +1,4 @@
1
- require 'league_of_legends/dto/player_stats_summary_list'
1
+ require_relative '../spec_helper'
2
2
 
3
3
  describe ::LeagueOfLegends::DTO::PlayerStatsSummaryList do
4
4
 
@@ -1,4 +1,4 @@
1
- require 'league_of_legends/dto/player_stats_summary'
1
+ require_relative '../spec_helper'
2
2
 
3
3
  describe LeagueOfLegends::DTO::PlayerStatsSummary do
4
4
 
@@ -0,0 +1,24 @@
1
+ require_relative '../spec_helper'
2
+
3
+ describe ::LeagueOfLegends::DTO::RankedStats do
4
+
5
+ let(:json) { '{"summonerId":31747504,"modifyDate":1391990692000,"champions":[{"id":59,"name":"JarvanIV","stats":{"totalSessionsPlayed":2,"totalSessionsLost":1,"totalSessionsWon":1,"totalChampionKills":8,"totalDamageDealt":256026,"totalDamageTaken":62473,"mostChampionKillsPerSession":4,"totalMinionKills":112,"totalDoubleKills":0,"totalTripleKills":0,"totalQuadraKills":0,"totalPentaKills":0,"totalUnrealKills":0,"totalDeathsPerSession":9,"totalGoldEarned":25091,"mostSpellsCast":0,"totalTurretsKilled":4,"totalPhysicalDamageDealt":211641,"totalMagicDamageDealt":24715,"totalFirstBlood":0,"totalAssists":39,"maxChampionsKilled":4,"maxNumDeaths":6}},{"id":89,"name":"Leona","stats":{"totalSessionsPlayed":3,"totalSessionsLost":1,"totalSessionsWon":2,"totalChampionKills":4,"totalDamageDealt":79593,"totalDamageTaken":70077,"mostChampionKillsPerSession":3,"totalMinionKills":60,"totalDoubleKills":0,"totalTripleKills":0,"totalQuadraKills":0,"totalPentaKills":0,"totalUnrealKills":0,"totalDeathsPerSession":20,"totalGoldEarned":26551,"mostSpellsCast":0,"totalTurretsKilled":1,"totalPhysicalDamageDealt":24074,"totalMagicDamageDealt":52174,"totalFirstBlood":0,"totalAssists":43,"maxChampionsKilled":3,"maxNumDeaths":8}},{"id":58,"name":"Renekton","stats":{"totalSessionsPlayed":3,"totalSessionsLost":1,"totalSessionsWon":2,"totalChampionKills":12,"totalDamageDealt":424630,"totalDamageTaken":80991,"mostChampionKillsPerSession":7,"totalMinionKills":594,"totalDoubleKills":2,"totalTripleKills":0,"totalQuadraKills":0,"totalPentaKills":0,"totalUnrealKills":0,"totalDeathsPerSession":9,"totalGoldEarned":35129,"mostSpellsCast":0,"totalTurretsKilled":7,"totalPhysicalDamageDealt":352076,"totalMagicDamageDealt":69583,"totalFirstBlood":0,"totalAssists":26,"maxChampionsKilled":7,"maxNumDeaths":5}},{"id":412,"name":"Thresh","stats":{"totalSessionsPlayed":15,"totalSessionsLost":6,"totalSessionsWon":9,"totalChampionKills":31,"totalDamageDealt":452623,"totalDamageTaken":277192,"mostChampionKillsPerSession":9,"totalMinionKills":409,"totalDoubleKills":2,"totalTripleKills":0,"totalQuadraKills":0,"totalPentaKills":0,"totalUnrealKills":0,"totalDeathsPerSession":65,"totalGoldEarned":135349,"mostSpellsCast":0,"totalTurretsKilled":5,"totalPhysicalDamageDealt":119867,"totalMagicDamageDealt":331869,"totalFirstBlood":0,"totalAssists":203,"maxChampionsKilled":9,"maxNumDeaths":11}},{"id":55,"name":"Katarina","stats":{"totalSessionsPlayed":1,"totalSessionsLost":1,"totalSessionsWon":0,"totalChampionKills":0,"totalDamageDealt":52289,"totalDamageTaken":21083,"mostChampionKillsPerSession":0,"totalMinionKills":78,"totalDoubleKills":0,"totalTripleKills":0,"totalQuadraKills":0,"totalPentaKills":0,"totalUnrealKills":0,"totalDeathsPerSession":10,"totalGoldEarned":5220,"mostSpellsCast":0,"totalTurretsKilled":0,"totalPhysicalDamageDealt":6154,"totalMagicDamageDealt":45371,"totalFirstBlood":0,"totalAssists":4,"maxChampionsKilled":0,"maxNumDeaths":10}},{"id":84,"name":"Akali","stats":{"totalSessionsPlayed":2,"totalSessionsLost":0,"totalSessionsWon":2,"totalChampionKills":10,"totalDamageDealt":139566,"totalDamageTaken":30841,"mostChampionKillsPerSession":6,"totalMinionKills":178,"totalDoubleKills":1,"totalTripleKills":0,"totalQuadraKills":0,"totalPentaKills":0,"totalUnrealKills":0,"totalDeathsPerSession":5,"totalGoldEarned":17237,"mostSpellsCast":0,"totalTurretsKilled":0,"totalPhysicalDamageDealt":83164,"totalMagicDamageDealt":55762,"totalFirstBlood":0,"totalAssists":15,"maxChampionsKilled":6,"maxNumDeaths":4}},{"id":154,"name":"Zac","stats":{"totalSessionsPlayed":3,"totalSessionsLost":0,"totalSessionsWon":3,"totalChampionKills":15,"totalDamageDealt":357108,"totalDamageTaken":64680,"mostChampionKillsPerSession":8,"totalMinionKills":281,"totalDoubleKills":1,"totalTripleKills":0,"totalQuadraKills":0,"totalPentaKills":0,"totalUnrealKills":0,"totalDeathsPerSession":6,"totalGoldEarned":33214,"mostSpellsCast":0,"totalTurretsKilled":2,"totalPhysicalDamageDealt":48774,"totalMagicDamageDealt":296717,"totalFirstBlood":0,"totalAssists":35,"maxChampionsKilled":8,"maxNumDeaths":4}},{"id":222,"name":"Jinx","stats":{"totalSessionsPlayed":2,"totalSessionsLost":1,"totalSessionsWon":1,"totalChampionKills":10,"totalDamageDealt":274968,"totalDamageTaken":37226,"mostChampionKillsPerSession":6,"totalMinionKills":398,"totalDoubleKills":2,"totalTripleKills":0,"totalQuadraKills":0,"totalPentaKills":0,"totalUnrealKills":0,"totalDeathsPerSession":11,"totalGoldEarned":24264,"mostSpellsCast":0,"totalTurretsKilled":5,"totalPhysicalDamageDealt":269081,"totalMagicDamageDealt":5029,"totalFirstBlood":0,"totalAssists":19,"maxChampionsKilled":6,"maxNumDeaths":7}},{"id":60,"name":"Elise","stats":{"totalSessionsPlayed":1,"totalSessionsLost":1,"totalSessionsWon":0,"totalChampionKills":7,"totalDamageDealt":76681,"totalDamageTaken":22186,"mostChampionKillsPerSession":7,"totalMinionKills":91,"totalDoubleKills":0,"totalTripleKills":0,"totalQuadraKills":0,"totalPentaKills":0,"totalUnrealKills":0,"totalDeathsPerSession":7,"totalGoldEarned":9439,"mostSpellsCast":0,"totalTurretsKilled":0,"totalPhysicalDamageDealt":34085,"totalMagicDamageDealt":41382,"totalFirstBlood":0,"totalAssists":1,"maxChampionsKilled":7,"maxNumDeaths":7}},{"id":1,"name":"Annie","stats":{"totalSessionsPlayed":2,"totalSessionsLost":2,"totalSessionsWon":0,"totalChampionKills":12,"totalDamageDealt":155218,"totalDamageTaken":54175,"mostChampionKillsPerSession":6,"totalMinionKills":185,"totalDoubleKills":1,"totalTripleKills":0,"totalQuadraKills":0,"totalPentaKills":0,"totalUnrealKills":0,"totalDeathsPerSession":21,"totalGoldEarned":25548,"mostSpellsCast":0,"totalTurretsKilled":1,"totalPhysicalDamageDealt":21504,"totalMagicDamageDealt":131360,"totalFirstBlood":0,"totalAssists":26,"maxChampionsKilled":6,"maxNumDeaths":14}},{"id":0,"name":"Combined","stats":{"totalSessionsPlayed":34,"totalSessionsLost":14,"totalSessionsWon":20,"totalChampionKills":109,"killingSpree":63,"totalDamageDealt":2268702,"totalDamageTaken":720924,"mostChampionKillsPerSession":9,"totalMinionKills":2386,"totalDoubleKills":9,"totalTripleKills":0,"totalQuadraKills":0,"totalPentaKills":0,"totalUnrealKills":0,"totalDeathsPerSession":163,"totalGoldEarned":337042,"mostSpellsCast":0,"totalTurretsKilled":25,"totalPhysicalDamageDealt":1170420,"totalMagicDamageDealt":1053962,"totalNeutralMinionsKilled":468,"totalFirstBlood":0,"totalAssists":411,"totalHeal":133458,"maxLargestKillingSpree":8,"maxLargestCriticalStrike":668,"maxChampionsKilled":9,"maxNumDeaths":14,"maxTimePlayed":3197,"maxTimeSpentLiving":1978,"normalGamesPlayed":0,"rankedSoloGamesPlayed":0,"rankedPremadeGamesPlayed":0,"botGamesPlayed":0}}]}' }
6
+ let(:dto){ described_class.new(json) }
7
+
8
+ it "has attributes" do
9
+ expect(dto.summoner_id).to eq 31747504
10
+ expect(dto.modify_date).to eq Time.at(1391990692000/1000)
11
+
12
+ expect(dto.champions).to be_an_instance_of Array
13
+ expect(dto.champions.size).to eq 11
14
+
15
+ dto.champions.each do |champion|
16
+ expect(champion).to be_an_instance_of ::LeagueOfLegends::DTO::ChampionStats
17
+ end
18
+ end
19
+
20
+ it "has a version" do
21
+ expect(described_class.version).to eq 'v1.2'
22
+ end
23
+
24
+ end
@@ -0,0 +1,93 @@
1
+ require_relative '../spec_helper'
2
+
3
+ describe ::LeagueOfLegends::DTO::RawStats do
4
+
5
+ let(:json) { '' }
6
+ let(:dto){ described_class.new(json) }
7
+
8
+ it "has attributes" do
9
+ pending "need JSON result"
10
+
11
+ expect(dto.assists).to eq
12
+ expect(dto.barracks_killed).to eq
13
+ expect(dto.champions_killed).to eq
14
+ expect(dto.combat_player_score).to eq
15
+ expect(dto.consumables_purchased).to eq
16
+ expect(dto.damage_dealt_player).to eq
17
+ expect(dto.double_kills).to eq
18
+ expect(dto.first_blood).to eq
19
+ expect(dto.gold).to eq
20
+ expect(dto.gold_earned).to eq
21
+ expect(dto.gold_spent).to eq
22
+ expect(dto.item_0).to eq
23
+ expect(dto.item_1).to eq
24
+ expect(dto.item_2).to eq
25
+ expect(dto.item_3).to eq
26
+ expect(dto.item_4).to eq
27
+ expect(dto.item_5).to eq
28
+ expect(dto.item_6).to eq
29
+ expect(dto.items_purchased).to eq
30
+ expect(dto.killing_sprees).to eq
31
+ expect(dto.largest_critical_strike).to eq
32
+ expect(dto.largest_killing_spree).to eq
33
+ expect(dto.largest_multi_kill).to eq
34
+ expect(dto.legendary_items_created).to eq
35
+ expect(dto.level).to eq
36
+ expect(dto.magic_damage_dealt_player).to eq
37
+ expect(dto.magic_damage_dealt_to_champions).to eq
38
+ expect(dto.magic_damage_taken).to eq
39
+ expect(dto.minions_denied).to eq
40
+ expect(dto.minions_killed).to eq
41
+ expect(dto.neutral_minions_killed).to eq
42
+ expect(dto.neutral_minions_killed_enemy_jungle).to eq
43
+ expect(dto.neutral_minions_killed_your_jungle).to eq
44
+ expect(dto.nexus_killed).to eq
45
+ expect(dto.node_capture).to eq
46
+ expect(dto.node_capture_assist).to eq
47
+ expect(dto.node_neutralize).to eq
48
+ expect(dto.node_neutralize_assist).to eq
49
+ expect(dto.num_deaths).to eq
50
+ expect(dto.num_items_bought).to eq
51
+ expect(dto.objective_player_score).to eq
52
+ expect(dto.penta_kills).to eq
53
+ expect(dto.physical_damage_dealt_player).to eq
54
+ expect(dto.physical_damage_dealt_to_champions).to eq
55
+ expect(dto.physical_damage_taken).to eq
56
+ expect(dto.quadra_kills).to eq
57
+ expect(dto.sight_wards_bought).to eq
58
+ expect(dto.spell_1_cast).to eq
59
+ expect(dto.spell_2_cast).to eq
60
+ expect(dto.spell_3_cast).to eq
61
+ expect(dto.spell_4_cast).to eq
62
+ expect(dto.summon_spell_1_cast).to eq
63
+ expect(dto.summon_spell_2_cast).to eq
64
+ expect(dto.super_monster_killed).to eq
65
+ expect(dto.team).to eq
66
+ expect(dto.team_objective).to eq
67
+ expect(dto.time_played).to eq
68
+ expect(dto.total_damage_dealt).to eq
69
+ expect(dto.total_damage_dealt_to_champions).to eq
70
+ expect(dto.total_damage_taken).to eq
71
+ expect(dto.total_heal).to eq
72
+ expect(dto.total_player_score).to eq
73
+ expect(dto.total_score_rank).to eq
74
+ expect(dto.total_time_crowd_control_dealt).to eq
75
+ expect(dto.total_units_healed).to eq
76
+ expect(dto.triple_kills).to eq
77
+ expect(dto.true_damage_dealt_player).to eq
78
+ expect(dto.true_damage_dealt_to_champions).to eq
79
+ expect(dto.true_damage_taken).to eq
80
+ expect(dto.turrets_killed).to eq
81
+ expect(dto.unreal_kills).to eq
82
+ expect(dto.victory_point_total).to eq
83
+ expect(dto.vision_wards_bought).to eq
84
+ expect(dto.ward_killed).to eq
85
+ expect(dto.ward_placed).to eq
86
+ expect(dto.win).to eq
87
+ end
88
+
89
+ it "has a version" do
90
+ expect(described_class.version).to eq 'v1.3'
91
+ end
92
+
93
+ end
@@ -0,0 +1,22 @@
1
+ require_relative '../spec_helper'
2
+
3
+ describe ::LeagueOfLegends::DTO::RecentGames do
4
+
5
+ let(:json) { '' }
6
+ let(:dto){ described_class.new(json) }
7
+
8
+ it "has attributes" do
9
+ pending "need JSON result"
10
+ expect(dto.games).to be_an_instance_of Array
11
+ expect(dto.games.size).to eq 3
12
+
13
+ dto.games.each do |game|
14
+ expect(game).to be_an_instance_of ::LeagueOfLegends::DTO::Game
15
+ end
16
+ end
17
+
18
+ it "has a version" do
19
+ expect(described_class.version).to eq 'v1.3'
20
+ end
21
+
22
+ end
@@ -1,4 +1,4 @@
1
- require 'league_of_legends/request/base'
1
+ require_relative '../spec_helper'
2
2
 
3
3
  describe ::LeagueOfLegends::Request::Base do
4
4
 
@@ -1,6 +1,4 @@
1
- require 'league_of_legends/api'
2
- require 'league_of_legends/request/champion'
3
- require 'league_of_legends/dto/champion_list'
1
+ require_relative '../spec_helper'
4
2
 
5
3
  describe ::LeagueOfLegends::Request::Champion do
6
4
 
@@ -1,4 +1,4 @@
1
- require 'league_of_legends/request/mapper'
1
+ require_relative '../spec_helper'
2
2
 
3
3
  describe ::LeagueOfLegends::Request::Mapper do
4
4
 
@@ -0,0 +1,25 @@
1
+ require_relative '../../../spec_helper'
2
+
3
+ describe ::LeagueOfLegends::Request::Stats::BySummoner::Ranked do
4
+
5
+ let(:api) { ::LeagueOfLegends::Api.new 'a1a1a1a1-a1a1-a1a1-a1a1-a1a1a1a1a1a1' }
6
+
7
+ let(:request) { described_class.new api, 31747504 }
8
+
9
+ it "has the required parameters" do
10
+ expect(described_class.dto_class).to eq ::LeagueOfLegends::DTO::RankedStats
11
+ expect(described_class.version).to eq 'v1.2'
12
+ expect(request.region).to eq 'euw'
13
+ expect(request.api_key).to be_an_instance_of String
14
+ expect(request.api_key.length).to eq 36
15
+
16
+ expect(request.summoner_id).to eq 31747504
17
+ end
18
+
19
+ it "can be sent and get a response" do
20
+ VCR.use_cassette('ranked_spec stats by_summoner') do
21
+ expect(request.response).to be_an_instance_of ::LeagueOfLegends::DTO::RankedStats
22
+ end
23
+ end
24
+
25
+ end
@@ -1,5 +1,4 @@
1
- require 'league_of_legends/request/stats/by_summoner/summary'
2
-
1
+ require_relative '../../../spec_helper'
3
2
 
4
3
  describe ::LeagueOfLegends::Request::Stats::BySummoner::Summary do
5
4
 
@@ -0,0 +1,2 @@
1
+ require 'league_of_legends'
2
+ require 'setup_vcr'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: league_of_legends
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francisco Orvalho
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-30 00:00:00.000000000 Z
11
+ date: 2014-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -98,6 +98,7 @@ extensions: []
98
98
  extra_rdoc_files: []
99
99
  files:
100
100
  - .gitignore
101
+ - .travis.yml
101
102
  - Gemfile
102
103
  - LICENSE.txt
103
104
  - README.md
@@ -105,33 +106,51 @@ files:
105
106
  - league_of_legends.gemspec
106
107
  - lib/league_of_legends.rb
107
108
  - lib/league_of_legends/api.rb
109
+ - lib/league_of_legends/dto.rb
108
110
  - lib/league_of_legends/dto/aggregated_stats.rb
109
111
  - lib/league_of_legends/dto/base.rb
110
112
  - lib/league_of_legends/dto/champion.rb
111
113
  - lib/league_of_legends/dto/champion_list.rb
114
+ - lib/league_of_legends/dto/champion_stats.rb
115
+ - lib/league_of_legends/dto/game.rb
116
+ - lib/league_of_legends/dto/player.rb
112
117
  - lib/league_of_legends/dto/player_stats_summary.rb
113
118
  - lib/league_of_legends/dto/player_stats_summary_list.rb
119
+ - lib/league_of_legends/dto/ranked_stats.rb
120
+ - lib/league_of_legends/dto/raw_stats.rb
121
+ - lib/league_of_legends/dto/recent_games.rb
122
+ - lib/league_of_legends/request.rb
114
123
  - lib/league_of_legends/request/all.rb
115
124
  - lib/league_of_legends/request/base.rb
116
125
  - lib/league_of_legends/request/champion.rb
117
126
  - lib/league_of_legends/request/mapper.rb
127
+ - lib/league_of_legends/request/stats/by_summoner/ranked.rb
118
128
  - lib/league_of_legends/request/stats/by_summoner/summary.rb
119
129
  - lib/league_of_legends/version.rb
120
130
  - spec/fixtures/vcr_cassettes/api_spec_champions.yml
121
131
  - spec/fixtures/vcr_cassettes/api_spec_summoner_stats_summary.yml
122
132
  - spec/fixtures/vcr_cassettes/champion_spec_f2p.yml
133
+ - spec/fixtures/vcr_cassettes/ranked_spec_stats_by_summoner.yml
123
134
  - spec/fixtures/vcr_cassettes/summary_spec_stats_by_summoner.yml
124
135
  - spec/league_of_legends/api_spec.rb
125
136
  - spec/league_of_legends/dto/aggregated_stats_spec.rb
126
137
  - spec/league_of_legends/dto/base_spec.rb
127
138
  - spec/league_of_legends/dto/champion_list_spec.rb
128
139
  - spec/league_of_legends/dto/champion_spec.rb
140
+ - spec/league_of_legends/dto/champion_stats_spec.rb
141
+ - spec/league_of_legends/dto/game_spec.rb
142
+ - spec/league_of_legends/dto/player_spec.rb
129
143
  - spec/league_of_legends/dto/player_stats_summary_list_spec.rb
130
144
  - spec/league_of_legends/dto/player_stats_summary_spec.rb
145
+ - spec/league_of_legends/dto/ranked_stats_spec.rb
146
+ - spec/league_of_legends/dto/raw_stats_spec.rb
147
+ - spec/league_of_legends/dto/recent_games_spec.rb
131
148
  - spec/league_of_legends/request/base_spec.rb
132
149
  - spec/league_of_legends/request/champion_spec.rb
133
150
  - spec/league_of_legends/request/mapper_spec.rb
151
+ - spec/league_of_legends/request/stats/by_summoner/ranked_spec.rb
134
152
  - spec/league_of_legends/request/stats/by_summoner/summary_spec.rb
153
+ - spec/league_of_legends/spec_helper.rb
135
154
  - spec/setup_vcr.rb
136
155
  homepage: http://github.com/forvalho/league_of_legends
137
156
  licenses:
@@ -161,17 +180,26 @@ test_files:
161
180
  - spec/fixtures/vcr_cassettes/api_spec_champions.yml
162
181
  - spec/fixtures/vcr_cassettes/api_spec_summoner_stats_summary.yml
163
182
  - spec/fixtures/vcr_cassettes/champion_spec_f2p.yml
183
+ - spec/fixtures/vcr_cassettes/ranked_spec_stats_by_summoner.yml
164
184
  - spec/fixtures/vcr_cassettes/summary_spec_stats_by_summoner.yml
165
185
  - spec/league_of_legends/api_spec.rb
166
186
  - spec/league_of_legends/dto/aggregated_stats_spec.rb
167
187
  - spec/league_of_legends/dto/base_spec.rb
168
188
  - spec/league_of_legends/dto/champion_list_spec.rb
169
189
  - spec/league_of_legends/dto/champion_spec.rb
190
+ - spec/league_of_legends/dto/champion_stats_spec.rb
191
+ - spec/league_of_legends/dto/game_spec.rb
192
+ - spec/league_of_legends/dto/player_spec.rb
170
193
  - spec/league_of_legends/dto/player_stats_summary_list_spec.rb
171
194
  - spec/league_of_legends/dto/player_stats_summary_spec.rb
195
+ - spec/league_of_legends/dto/ranked_stats_spec.rb
196
+ - spec/league_of_legends/dto/raw_stats_spec.rb
197
+ - spec/league_of_legends/dto/recent_games_spec.rb
172
198
  - spec/league_of_legends/request/base_spec.rb
173
199
  - spec/league_of_legends/request/champion_spec.rb
174
200
  - spec/league_of_legends/request/mapper_spec.rb
201
+ - spec/league_of_legends/request/stats/by_summoner/ranked_spec.rb
175
202
  - spec/league_of_legends/request/stats/by_summoner/summary_spec.rb
203
+ - spec/league_of_legends/spec_helper.rb
176
204
  - spec/setup_vcr.rb
177
205
  has_rdoc: