ruby-lol 0.9.6 → 0.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/lol/league.rb +5 -1
- data/lib/lol/league_request.rb +4 -4
- data/lib/lol/summoner_request.rb +13 -7
- data/lib/lol/version.rb +1 -1
- data/spec/api_version_spec.rb +1 -1
- data/spec/fixtures/v2.3/get-league.json +1470 -0
- data/spec/lol/league_spec.rb +2 -2
- data/spec/lol/mastery_page_spec.rb +3 -3
- data/spec/lol/rune_page_spec.rb +3 -3
- data/spec/lol/rune_slot_spec.rb +3 -3
- metadata +4 -36
- data/spec/fixtures/v1.1/get-game.json +0 -1
- data/spec/fixtures/v1.1/get-ranked_stats.json +0 -1
- data/spec/fixtures/v1.1/get-stats.json +0 -1
- data/spec/fixtures/v1.1/get-summoner-by-name.json +0 -8
- data/spec/fixtures/v1.1/get-summoner-masteries.json +0 -1
- data/spec/fixtures/v1.1/get-summoner-name.json +0 -10
- data/spec/fixtures/v1.1/get-summoner-runes.json +0 -1
- data/spec/fixtures/v1.1/get-summoner.json +0 -8
- data/spec/fixtures/v1.2/get-game.json +0 -1
- data/spec/fixtures/v1.2/get-summoner-by-name.json +0 -1
- data/spec/fixtures/v1.2/get-summoner-masteries.json +0 -1
- data/spec/fixtures/v1.2/get-summoner-name.json +0 -1
- data/spec/fixtures/v1.2/get-summoner-runes.json +0 -1
- data/spec/fixtures/v1.2/get-summoner.json +0 -1
- data/spec/fixtures/v2.1/get-league.json +0 -1075
- data/spec/fixtures/v2.1/get-team.json +0 -962
- data/spec/fixtures/v2.2/get-league.json +0 -876
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50e56acf28e90955be0cffc6e2816e0a61ab8f56
|
4
|
+
data.tar.gz: b839622f7058915031509ca441595823c415ea58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fafbd32fef3a729dd442269817148c96b069e43316cb141ad56e5f20ebe997a72143282327b09dc40e79b7c4b78869bbfb674a4cd073ec10067d6608c657850
|
7
|
+
data.tar.gz: c9ea2b94f43afffb692b2915d2a967e40a330051b2767a14fd19f3372669a4a6b169a5ccdf8ee6e69ab4265b70b0153dea64dd46b3c39c3d87dc14adece523c0
|
data/README.md
CHANGED
data/lib/lol/league.rb
CHANGED
@@ -17,9 +17,13 @@ module Lol
|
|
17
17
|
# @return [String] summoners / teams in queue
|
18
18
|
attr_reader :entries
|
19
19
|
|
20
|
+
# @!attribute [r] participant_id
|
21
|
+
# @return [String] summoner id of league participant
|
22
|
+
attr_reader :participant_id
|
23
|
+
|
20
24
|
private
|
21
25
|
|
22
|
-
attr_writer :timestamp, :name, :tier, :queue
|
26
|
+
attr_writer :timestamp, :name, :tier, :queue, :participant_id
|
23
27
|
|
24
28
|
def entries= list
|
25
29
|
@entries = []
|
data/lib/lol/league_request.rb
CHANGED
@@ -3,14 +3,14 @@ module Lol
|
|
3
3
|
# Returns the supported API Version
|
4
4
|
# @return [String] the supported api version
|
5
5
|
def self.api_version
|
6
|
-
"v2.
|
6
|
+
"v2.3"
|
7
7
|
end
|
8
8
|
|
9
9
|
# Retrieves leagues data for summoner, including leagues for all of summoner's teams, v2.1
|
10
|
-
# @
|
10
|
+
# @param [String]
|
11
|
+
# @return [Array]
|
11
12
|
def get summoner_id
|
12
|
-
|
13
|
-
response.is_a?(Hash) ? [League.new(response)] : response.map {|l| League.new l}
|
13
|
+
perform_request(api_url("league/by-summoner/#{summoner_id}")).map {|l| League.new l}
|
14
14
|
end
|
15
15
|
|
16
16
|
end
|
data/lib/lol/summoner_request.rb
CHANGED
@@ -35,21 +35,27 @@ module Lol
|
|
35
35
|
# @param [Array] summoner_ids
|
36
36
|
# @return [Array] array of Lol::RunePage
|
37
37
|
def runes *summoner_ids
|
38
|
-
|
39
|
-
ack[data.first] = data.last["pages"].map {|m| RunePage.new m}
|
40
|
-
ack
|
41
|
-
end
|
38
|
+
extract_pages RunePage, "runes", summoner_ids
|
42
39
|
end
|
43
40
|
|
44
41
|
# Get mastery pages by summoner ID
|
45
42
|
# @param [Array] summoner_ids
|
46
43
|
# @return [Array] array of Lol::MasteryPage
|
47
44
|
def masteries *summoner_ids
|
48
|
-
|
49
|
-
|
45
|
+
extract_pages MasteryPage, "masteries", summoner_ids
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
# Extract pages by summoner ID
|
51
|
+
# @param klass [Class] class used to instance objects in arrays
|
52
|
+
# @param page_type [String] path of the request
|
53
|
+
# @param *summoner_ids [Array] array of summoner_ids
|
54
|
+
def extract_pages klass, page_type, *summoner_ids
|
55
|
+
perform_request(api_url("summoner/#{summoner_ids.join(",")}/#{page_type}")).inject({}) do |ack, data|
|
56
|
+
ack[data.first] = data.last["pages"].map {|m| klass.new m}
|
50
57
|
ack
|
51
58
|
end
|
52
59
|
end
|
53
|
-
|
54
60
|
end
|
55
61
|
end
|
data/lib/lol/version.rb
CHANGED
data/spec/api_version_spec.rb
CHANGED
@@ -15,7 +15,7 @@ end
|
|
15
15
|
describe "API Versions" do
|
16
16
|
check_api_version(ChampionRequest, "v1.1")
|
17
17
|
check_api_version(GameRequest, "v1.3")
|
18
|
-
check_api_version(LeagueRequest, "v2.
|
18
|
+
check_api_version(LeagueRequest, "v2.3")
|
19
19
|
check_api_version(StatsRequest, "v1.2")
|
20
20
|
check_api_version(SummonerRequest, "v1.3")
|
21
21
|
check_api_version(TeamRequest, "v2.2")
|