league_of_legends 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/league_of_legends/dto.rb +1 -0
- data/lib/league_of_legends/dto/league_item_list.rb +23 -0
- data/lib/league_of_legends/request.rb +1 -0
- data/lib/league_of_legends/request/all.rb +0 -0
- data/lib/league_of_legends/request/league/by_summoner/entry.rb +30 -0
- data/lib/league_of_legends/request/mapper.rb +3 -0
- data/lib/league_of_legends/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/league_by_summoner_entry.yml +45 -0
- data/spec/league_of_legends/dto/league_item_list_spec.rb +51 -0
- data/spec/league_of_legends/request/league/by_summoner/entry_spec.rb +25 -0
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7da05bba10f4c2f20cd742376f4b4f39c27f8a4b
|
4
|
+
data.tar.gz: aae565e655bec0b804016bcb866a0df13cea9b5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e23d3f1973e7a080ac0f58311e6c4b54509483cc439d037256aedb99f561ba201bebde19e5eab74518fbe1d808f34f6a803df261e3916e410b21346c42f065e
|
7
|
+
data.tar.gz: 86d7bc9e8114198c6b8fd7489e27d8193ed768551969c0921f435c823573a652c109d2a127e01ece71d01be1033e9eacb11912ece44e621743328f8a4f116088
|
@@ -6,6 +6,7 @@ require 'league_of_legends/dto/champion_stats'
|
|
6
6
|
require 'league_of_legends/dto/game'
|
7
7
|
require 'league_of_legends/dto/league'
|
8
8
|
require 'league_of_legends/dto/league_item'
|
9
|
+
require 'league_of_legends/dto/league_item_list'
|
9
10
|
require 'league_of_legends/dto/mini_series'
|
10
11
|
require 'league_of_legends/dto/player'
|
11
12
|
require 'league_of_legends/dto/player_stats_summary'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'league_of_legends/dto'
|
2
|
+
|
3
|
+
module ::LeagueOfLegends
|
4
|
+
module DTO
|
5
|
+
class LeagueItemList < ::LeagueOfLegends::DTO::Base
|
6
|
+
|
7
|
+
def self.version
|
8
|
+
::LeagueOfLegends::DTO::League.version
|
9
|
+
end
|
10
|
+
|
11
|
+
attr_reader :list
|
12
|
+
|
13
|
+
def initialize json
|
14
|
+
attributes = build_attributes json
|
15
|
+
|
16
|
+
@list = attributes.map do |item|
|
17
|
+
::LeagueOfLegends::DTO::LeagueItem.new(item)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -2,6 +2,7 @@ require 'league_of_legends/request/all'
|
|
2
2
|
require 'league_of_legends/request/base'
|
3
3
|
require 'league_of_legends/request/champion'
|
4
4
|
require 'league_of_legends/request/game/by_summoner/recent'
|
5
|
+
require 'league_of_legends/request/league/by_summoner/entry'
|
5
6
|
require 'league_of_legends/request/league/challenger'
|
6
7
|
require 'league_of_legends/request/mapper'
|
7
8
|
require 'league_of_legends/request/stats/by_summoner/ranked'
|
File without changes
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'league_of_legends/dto'
|
2
|
+
|
3
|
+
module ::LeagueOfLegends
|
4
|
+
module Request
|
5
|
+
module League
|
6
|
+
module BySummoner
|
7
|
+
class Entry < ::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::LeagueItemList
|
18
|
+
end
|
19
|
+
|
20
|
+
protected
|
21
|
+
|
22
|
+
def base_url
|
23
|
+
super << "league/by-summoner/#{summoner_id}/entry"
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://prod.api.pvp.net/api/lol/euw/v2.3/league/by-summoner/31747504/entry?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
|
+
- Sat, 15 Feb 2014 21:23:31 GMT
|
33
|
+
Server:
|
34
|
+
- Jetty(9.1.0.v20131115)
|
35
|
+
Content-Length:
|
36
|
+
- '280'
|
37
|
+
Connection:
|
38
|
+
- keep-alive
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: '[{"playerOrTeamId":"31747504","playerOrTeamName":"IXIOneManArmyIXI","leagueName":"Ashe''s
|
42
|
+
Cavaliers","queueType":"RANKED_SOLO_5x5","tier":"SILVER","rank":"II","leaguePoints":0,"wins":19,"isHotStreak":false,"isVeteran":false,"isFreshBlood":false,"isInactive":false,"lastPlayed":-1}]'
|
43
|
+
http_version:
|
44
|
+
recorded_at: Sat, 15 Feb 2014 21:23:31 GMT
|
45
|
+
recorded_with: VCR 2.8.0
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe ::LeagueOfLegends::DTO::LeagueItemList do
|
4
|
+
|
5
|
+
let(:json) { '[
|
6
|
+
{
|
7
|
+
"isHotStreak": false,
|
8
|
+
"isFreshBlood": true,
|
9
|
+
"leagueName": "Miss Fortune\'s Weaponmasters",
|
10
|
+
"isVeteran": false,
|
11
|
+
"tier": "CHALLENGER",
|
12
|
+
"lastPlayed": -1,
|
13
|
+
"playerOrTeamId": "19331582",
|
14
|
+
"leaguePoints": 248,
|
15
|
+
"rank": "I",
|
16
|
+
"isInactive": false,
|
17
|
+
"queueType": "RANKED_SOLO_5x5",
|
18
|
+
"playerOrTeamName": "Gripex",
|
19
|
+
"wins": 85
|
20
|
+
},
|
21
|
+
{
|
22
|
+
"isHotStreak": false,
|
23
|
+
"isFreshBlood": true,
|
24
|
+
"leagueName": "Miss Fortune\'s Weaponmasters",
|
25
|
+
"isVeteran": false,
|
26
|
+
"tier": "CHALLENGER",
|
27
|
+
"lastPlayed": -1,
|
28
|
+
"playerOrTeamId": "22432605",
|
29
|
+
"leaguePoints": 79,
|
30
|
+
"rank": "I",
|
31
|
+
"isInactive": false,
|
32
|
+
"queueType": "RANKED_SOLO_5x5",
|
33
|
+
"playerOrTeamName": "Wygon",
|
34
|
+
"wins": 141
|
35
|
+
}
|
36
|
+
]' }
|
37
|
+
let(:dto){ described_class.new(json) }
|
38
|
+
|
39
|
+
it "has attributes" do
|
40
|
+
expect(dto.list).to be_an_instance_of Array
|
41
|
+
expect(dto.list.count).to eq 2
|
42
|
+
dto.list.each do |item|
|
43
|
+
expect(item).to be_an_instance_of ::LeagueOfLegends::DTO::LeagueItem
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
it "has a version" do
|
48
|
+
expect(described_class.version).to eq 'v2.3'
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require_relative '../../../spec_helper'
|
2
|
+
|
3
|
+
describe ::LeagueOfLegends::Request::League::BySummoner::Entry 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::LeagueItemList
|
11
|
+
expect(described_class.version).to eq 'v2.3'
|
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('league by_summoner entry') do
|
21
|
+
expect(request.response).to be_an_instance_of ::LeagueOfLegends::DTO::LeagueItemList
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
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
|
+
version: 0.0.9
|
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-02-
|
11
|
+
date: 2014-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -115,6 +115,7 @@ files:
|
|
115
115
|
- lib/league_of_legends/dto/game.rb
|
116
116
|
- lib/league_of_legends/dto/league.rb
|
117
117
|
- lib/league_of_legends/dto/league_item.rb
|
118
|
+
- lib/league_of_legends/dto/league_item_list.rb
|
118
119
|
- lib/league_of_legends/dto/mini_series.rb
|
119
120
|
- lib/league_of_legends/dto/player.rb
|
120
121
|
- lib/league_of_legends/dto/player_stats_summary.rb
|
@@ -123,9 +124,11 @@ files:
|
|
123
124
|
- lib/league_of_legends/dto/raw_stats.rb
|
124
125
|
- lib/league_of_legends/dto/recent_games.rb
|
125
126
|
- lib/league_of_legends/request.rb
|
127
|
+
- lib/league_of_legends/request/all.rb
|
126
128
|
- lib/league_of_legends/request/base.rb
|
127
129
|
- lib/league_of_legends/request/champion.rb
|
128
130
|
- lib/league_of_legends/request/game/by_summoner/recent.rb
|
131
|
+
- lib/league_of_legends/request/league/by_summoner/entry.rb
|
129
132
|
- lib/league_of_legends/request/league/challenger.rb
|
130
133
|
- lib/league_of_legends/request/mapper.rb
|
131
134
|
- lib/league_of_legends/request/stats/by_summoner/ranked.rb
|
@@ -135,6 +138,7 @@ files:
|
|
135
138
|
- spec/fixtures/vcr_cassettes/api_spec_summoner_stats_summary.yml
|
136
139
|
- spec/fixtures/vcr_cassettes/champion_spec_f2p.yml
|
137
140
|
- spec/fixtures/vcr_cassettes/game_spec.yml
|
141
|
+
- spec/fixtures/vcr_cassettes/league_by_summoner_entry.yml
|
138
142
|
- spec/fixtures/vcr_cassettes/league_challenger_type.yml
|
139
143
|
- spec/fixtures/vcr_cassettes/ranked_spec_stats_by_summoner.yml
|
140
144
|
- spec/fixtures/vcr_cassettes/summary_spec_stats_by_summoner.yml
|
@@ -145,6 +149,7 @@ files:
|
|
145
149
|
- spec/league_of_legends/dto/champion_spec.rb
|
146
150
|
- spec/league_of_legends/dto/champion_stats_spec.rb
|
147
151
|
- spec/league_of_legends/dto/game_spec.rb
|
152
|
+
- spec/league_of_legends/dto/league_item_list_spec.rb
|
148
153
|
- spec/league_of_legends/dto/league_item_spec.rb
|
149
154
|
- spec/league_of_legends/dto/league_spec.rb
|
150
155
|
- spec/league_of_legends/dto/mini_series_spec.rb
|
@@ -157,6 +162,7 @@ files:
|
|
157
162
|
- spec/league_of_legends/request/base_spec.rb
|
158
163
|
- spec/league_of_legends/request/champion_spec.rb
|
159
164
|
- spec/league_of_legends/request/game/by_summoner/recent_spec.rb
|
165
|
+
- spec/league_of_legends/request/league/by_summoner/entry_spec.rb
|
160
166
|
- spec/league_of_legends/request/league/challenger_spec.rb
|
161
167
|
- spec/league_of_legends/request/mapper_spec.rb
|
162
168
|
- spec/league_of_legends/request/stats/by_summoner/ranked_spec.rb
|
@@ -192,6 +198,7 @@ test_files:
|
|
192
198
|
- spec/fixtures/vcr_cassettes/api_spec_summoner_stats_summary.yml
|
193
199
|
- spec/fixtures/vcr_cassettes/champion_spec_f2p.yml
|
194
200
|
- spec/fixtures/vcr_cassettes/game_spec.yml
|
201
|
+
- spec/fixtures/vcr_cassettes/league_by_summoner_entry.yml
|
195
202
|
- spec/fixtures/vcr_cassettes/league_challenger_type.yml
|
196
203
|
- spec/fixtures/vcr_cassettes/ranked_spec_stats_by_summoner.yml
|
197
204
|
- spec/fixtures/vcr_cassettes/summary_spec_stats_by_summoner.yml
|
@@ -202,6 +209,7 @@ test_files:
|
|
202
209
|
- spec/league_of_legends/dto/champion_spec.rb
|
203
210
|
- spec/league_of_legends/dto/champion_stats_spec.rb
|
204
211
|
- spec/league_of_legends/dto/game_spec.rb
|
212
|
+
- spec/league_of_legends/dto/league_item_list_spec.rb
|
205
213
|
- spec/league_of_legends/dto/league_item_spec.rb
|
206
214
|
- spec/league_of_legends/dto/league_spec.rb
|
207
215
|
- spec/league_of_legends/dto/mini_series_spec.rb
|
@@ -214,6 +222,7 @@ test_files:
|
|
214
222
|
- spec/league_of_legends/request/base_spec.rb
|
215
223
|
- spec/league_of_legends/request/champion_spec.rb
|
216
224
|
- spec/league_of_legends/request/game/by_summoner/recent_spec.rb
|
225
|
+
- spec/league_of_legends/request/league/by_summoner/entry_spec.rb
|
217
226
|
- spec/league_of_legends/request/league/challenger_spec.rb
|
218
227
|
- spec/league_of_legends/request/mapper_spec.rb
|
219
228
|
- spec/league_of_legends/request/stats/by_summoner/ranked_spec.rb
|