ruby-lol 0.9.6 → 0.9.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6165077c10b64e99aabca3a6a7207929728cdba
4
- data.tar.gz: 221c539e169a9bf1a92c47584b5cd829c805ee65
3
+ metadata.gz: 50e56acf28e90955be0cffc6e2816e0a61ab8f56
4
+ data.tar.gz: b839622f7058915031509ca441595823c415ea58
5
5
  SHA512:
6
- metadata.gz: b337da9167f98813f0c4208e046830efe71a40e1d77f8ae8029533e57ffd077cd4d7eac19d9e90c1ec6627197b3deaf17f0e0c0f98431fbb8109a6a5ce99bbfb
7
- data.tar.gz: cbaaca91e03e763bb600f79586d5b822ee3b1180f2f83b9c91419caca1c41a63bdf052dfaac0f9318bae5b1ace5813ac9829ee05648c44c05b4654076d9bb735
6
+ metadata.gz: 7fafbd32fef3a729dd442269817148c96b069e43316cb141ad56e5f20ebe997a72143282327b09dc40e79b7c4b78869bbfb674a4cd073ec10067d6608c657850
7
+ data.tar.gz: c9ea2b94f43afffb692b2915d2a967e40a330051b2767a14fd19f3372669a4a6b169a5ccdf8ee6e69ab4265b70b0153dea64dd46b3c39c3d87dc14adece523c0
data/README.md CHANGED
@@ -87,5 +87,7 @@ Or install it yourself as:
87
87
 
88
88
  ## Changelog
89
89
 
90
+ - 0.9.7 Updated LeagueReqeust to API v2.3
91
+ - 0.9.6 Updated SummonerRequest and GameRequest to API v1.3
90
92
  - 0.9.5 Fixed documentation
91
93
  - 0.9.4 Completed support for updated API
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 = []
@@ -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.2"
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
- # @return [Array] an array of champions
10
+ # @param [String]
11
+ # @return [Array]
11
12
  def get summoner_id
12
- response = perform_request(api_url("league/by-summoner/#{summoner_id}"))[summoner_id.to_s]
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
@@ -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
- perform_request(api_url("summoner/#{summoner_ids.join(",")}/runes")).inject({}) do |ack, data|
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
- perform_request(api_url("summoner/#{summoner_ids.join(",")}/masteries")).inject({}) do |ack, data|
49
- ack[data.first] = data.last["pages"].map {|m| MasteryPage.new m}
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
@@ -1,3 +1,3 @@
1
1
  module Lol
2
- VERSION = "0.9.6"
2
+ VERSION = "0.9.7"
3
3
  end
@@ -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.2")
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")