taric 0.3.4 → 0.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ed730eb8b2667d33a95af44abaf5c831037391bc
4
- data.tar.gz: e2f13b12aa6482ab736b24c66a9c46fa6056831f
3
+ metadata.gz: 0c0fdb566e176d431e051afd9ffecebc2ddcd13c
4
+ data.tar.gz: 6212b36f3c1ad25fae66445b8b87157a817c5b55
5
5
  SHA512:
6
- metadata.gz: 13b97c1f084eeffeb955e36b0f16be1eb10ccdb9c5d6a8306564396e4a011bbd8f268af8ec947855f1792404db4c244d65ed6bae0b0dcbb8a27316ff4b240749
7
- data.tar.gz: 55b7792f019d3e1d0c0c8e4dfc883d350bd0d457545a2cad0ecccb377c9e1a14180cdb3b84fb5aab4ed92b2835472cf6b2b1531d67ed9ae0dd389b26f5852f07
6
+ metadata.gz: 9861731d289437dae1d24db2b97e80116c09277c35e482ef5895228866e3010447499e6b85911ce53d6e920e246efc4de9460c0557d109af95da154602088cfb
7
+ data.tar.gz: 9b4f75b171d2dcb125ca8d702615c7a8b8c47501d35e022a3962a4a03901fb6ab0459c748bbadc34a621dea81fd7dc9f85ae1ac33752d468b823947fb1b158aa
@@ -7,7 +7,7 @@ module Taric
7
7
  }.curry
8
8
 
9
9
  DEFAULT_RESPONSE_HANDLER = -> response {
10
- response.body
10
+ response
11
11
  }
12
12
 
13
13
  PARALLEL_REQUESTOR = -> connection, urls {
@@ -15,7 +15,7 @@ module Taric
15
15
  }.curry
16
16
 
17
17
  PARALLEL_RESPONSE_HANDLER = -> responses {
18
- responses.map{|response| {body: response.body, status: response.status}}
18
+ responses.map{|response| response}
19
19
  }
20
20
 
21
21
  def initialize(options = {})
@@ -1,5 +1,4 @@
1
1
  require 'faraday_middleware/parse_oj'
2
- require 'taric/faraday_middleware/http_exception'
3
2
 
4
3
  module Taric
5
4
  module Connection
@@ -9,8 +8,7 @@ module Taric
9
8
  }.merge(config.connection_opts)
10
9
 
11
10
  Faraday::Connection.new(options) do |conn|
12
- conn.use Taric::FaradayMiddleware::HttpException
13
- conn.response :oj, :content_type => /\bjson$/ unless config.raw
11
+ conn.response :oj, content_type: /\bjson$/ unless config.raw
14
12
  conn.adapter config.adapter
15
13
  end
16
14
  end
@@ -4,10 +4,16 @@ module Taric
4
4
  SHARDS = Addressable::Template.new 'http://status.leagueoflegends.com/shards'
5
5
  SHARD = Addressable::Template.new 'http://status.leagueoflegends.com/shards/{region}'
6
6
 
7
+ # Region metadata.
8
+ #
9
+ # @return [Array] of region metadata in hashes
7
10
  def shards
8
11
  response_for SHARDS
9
12
  end
10
13
 
14
+ # Region metadata by region.
15
+ # @param region [String] region to load
16
+ # @return [Hash] region info
11
17
  def shard(region:)
12
18
  response_for SHARD, {region: region}
13
19
  end
@@ -9,12 +9,22 @@ module Taric
9
9
  RANKED = Addressable::Template.new "#{BASE_STATS_URL}/ranked{?api_key,season}"
10
10
  SUMMARY = Addressable::Template.new "#{BASE_STATS_URL}/summary{?api_key,season}"
11
11
 
12
- # @see https://developer.riotgames.com/api/methods#!/961/3297
12
+ # Ranked stats for summoner.
13
+ #
14
+ # @see https://developer.riotgames.com/api/methods#!/1018/3452
15
+ # @param summoner_id [Fixnum] ID of summoner
16
+ # @param season [String] Optional - valid season
17
+ # @return [Hash] ranked stats
13
18
  def ranked_stats(summoner_id: , season: nil)
14
19
  response_for RANKED, {summonerId: summoner_id, season: season}
15
20
  end
16
21
 
17
- # @see https://developer.riotgames.com/api/methods#!/961/3298
22
+ # Summary stats for summoner.
23
+ #
24
+ # @see https://developer.riotgames.com/api/methods#!/1018/3453
25
+ # @param summoner_id [Fixnum] ID of summoner
26
+ # @param season [String] Optional - valid season
27
+ # @return [Hash] various aggregate stats
18
28
  def summary_stats(summoner_id: , season: nil)
19
29
  response_for SUMMARY, {summonerId: summoner_id, season: season}
20
30
  end
@@ -40,14 +40,26 @@ module Taric
40
40
  response_for SUMMONERS_BY_IDS, {summonerIds: summoner_ids}
41
41
  end
42
42
 
43
+ # Masteries keyed by summoner ID.
44
+ #
45
+ # @param summoner_ids [String] comma separated list of Summoner IDs
46
+ # @return [Hash] masteries by Summoner ID
43
47
  def summoner_masteries(summoner_ids:)
44
48
  response_for MASTERIES, {summonerIds: summoner_ids}
45
49
  end
46
50
 
51
+ # Summoner names keyed by ID.
52
+ #
53
+ # @param summoner_ids [String] comma separated list of Summoner IDs
54
+ # @return [Hash] id to name mapping
47
55
  def summoner_ids_to_names(summoner_ids:)
48
56
  response_for NAMES, {summonerIds: summoner_ids}
49
57
  end
50
58
 
59
+ # Runes keyed by summoner ID.
60
+ #
61
+ # @param summoner_ids [String] comma separated list of Summoner IDs
62
+ # @return [Hash] runes by Summoner ID
51
63
  def summoner_runes(summoner_ids:)
52
64
  response_for RUNES, {summonerIds: summoner_ids}
53
65
  end
@@ -10,12 +10,20 @@ module Taric
10
10
  TEAMS_BY_SUMMONER_IDS = Addressable::Template.new "#{BASE_TEAM_URL}/by-summoner/{summonerIds}"
11
11
  TEAMS_BY_TEAM_IDS = Addressable::Template.new "#{BASE_TEAM_URL}/{teamIds}"
12
12
 
13
- # @see https://developer.riotgames.com/api/methods#!/937/3247
13
+ # Teams by summoner ids.
14
+ #
15
+ # @param summoner_ids [String] comma separated list of summoner ids
16
+ # @return [Hash] team info by summoner id
17
+ # @see https://developer.riotgames.com/api/methods#!/986/3358
14
18
  def teams_by_summoner_ids(summoner_ids:)
15
19
  response_for TEAMS_BY_SUMMONER_IDS, {summonerIds: summoner_ids}
16
20
  end
17
21
 
18
- # @see https://developer.riotgames.com/api/methods#!/937/3246
22
+ # Teams by team ids.
23
+ #
24
+ # @param team_ids [String] comma separated list of team ids
25
+ # @return [Hash] team info by team IDs
26
+ # @see https://developer.riotgames.com/api/methods#!/986/3357
19
27
  def teams(team_ids:)
20
28
  response_for TEAMS_BY_TEAM_IDS, {teamIds: team_ids}
21
29
  end
@@ -1,3 +1,3 @@
1
1
  module Taric
2
- VERSION = '0.3.4'
2
+ VERSION = '0.4.0'
3
3
  end
@@ -27,10 +27,11 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency 'webmock', '~> 1.20'
28
28
  spec.add_development_dependency 'rspec', '~> 3.2'
29
29
  spec.add_development_dependency 'coveralls', '~> 0.7'
30
+ spec.add_development_dependency 'typhoeus', '~> 0.8.0'
30
31
 
31
32
  spec.add_runtime_dependency 'memoist', '~> 0.11'
32
- spec.add_runtime_dependency('addressable', '~> 2.3')
33
- spec.add_runtime_dependency('oj', '~> 2.12')
34
- spec.add_runtime_dependency('faraday_middleware', '~> 0.9')
35
- spec.add_runtime_dependency('faraday_middleware-parse_oj', '~> 0.3.0')
33
+ spec.add_runtime_dependency 'addressable', '~> 2.3'
34
+ spec.add_runtime_dependency 'oj', '~> 2.12'
35
+ spec.add_runtime_dependency 'faraday_middleware', '~> 0.9'
36
+ spec.add_runtime_dependency 'faraday_middleware-parse_oj', '~> 0.3.0'
36
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taric
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joseph Yi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-31 00:00:00.000000000 Z
11
+ date: 2015-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -86,6 +86,20 @@ dependencies:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0.7'
89
+ - !ruby/object:Gem::Dependency
90
+ name: typhoeus
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: 0.8.0
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: 0.8.0
89
103
  - !ruby/object:Gem::Dependency
90
104
  name: memoist
91
105
  requirement: !ruby/object:Gem::Requirement