taric 0.1.9 → 0.1.10
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/lib/taric/connection.rb +2 -0
- data/lib/taric/faraday_middleware/http_exception.rb +39 -0
- data/lib/taric/operation/match.rb +1 -0
- data/lib/taric/version.rb +1 -1
- data/taric.gemspec +0 -1
- metadata +4 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6bfcbab8cadbc69eed998276bb942b277d10e7f9
|
4
|
+
data.tar.gz: 4e11bee4f4ec4c6e1bacb4de88d52d8ff0688ab4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a45310ecadc28b664de9e9b940aee98a479db9b6e587dd86deba68b30a223a8a7c8614107cf9225285439e7226948af9abf9dbe38a88f515341392e6e6e6d49
|
7
|
+
data.tar.gz: 1dd307f26f91437154ce4fdc8521d1ec427d19cef8ce37226279501fb3d837c19ef62781fb3117ab4ee7d293c491a05efb9c25423643fb7f6499420eb2c0e842
|
data/lib/taric/connection.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'faraday_middleware/parse_oj'
|
2
|
+
require 'taric/faraday_middleware/http_exception'
|
2
3
|
|
3
4
|
module Taric
|
4
5
|
module Connection
|
@@ -8,6 +9,7 @@ module Taric
|
|
8
9
|
}.merge(config.connection_opts)
|
9
10
|
|
10
11
|
Faraday::Connection.new(options) do |conn|
|
12
|
+
conn.use Taric::FaradayMiddleware::HttpException
|
11
13
|
conn.response :oj, :content_type => /\bjson$/
|
12
14
|
conn.adapter config.adapter
|
13
15
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
|
3
|
+
module Taric
|
4
|
+
module FaradayMiddleware
|
5
|
+
class Unauthorized < StandardError; end
|
6
|
+
class BadRequest < StandardError; end
|
7
|
+
class RateLimitExceeded < StandardError; end
|
8
|
+
class InternalServerError < StandardError; end
|
9
|
+
class ServiceUnavailable < StandardError; end
|
10
|
+
class GatewayTimeout < StandardError; end
|
11
|
+
class Forbidden < StandardError; end
|
12
|
+
class NotFound < StandardError; end
|
13
|
+
|
14
|
+
class HttpException < Faraday::Response::Middleware
|
15
|
+
def call(env)
|
16
|
+
@app.call(env).on_complete do |response|
|
17
|
+
case response[:status]
|
18
|
+
when 400
|
19
|
+
raise Taric::FaradayMiddleware::BadRequest, 'Bad parameter, check API documentation'
|
20
|
+
when 401
|
21
|
+
raise Taric::FaradayMiddleware::Unauthorized, 'Check API key'
|
22
|
+
when 403
|
23
|
+
raise Taric::FaradayMiddleware::Forbidden, 'Forbidden'
|
24
|
+
when 404
|
25
|
+
raise Taric::FaradayMiddleware::NotFound, 'Data not found'
|
26
|
+
when 429
|
27
|
+
raise Taric::FaradayMiddleware::RateLimitExceeded, 'Rate limit exceeded'
|
28
|
+
when 500
|
29
|
+
raise Taric::FaradayMiddleware::InternalServerError, 'Internal server error'
|
30
|
+
when 503
|
31
|
+
raise Taric::FaradayMiddleware::ServiceUnavailable, 'Service unavailable'
|
32
|
+
when 504
|
33
|
+
raise Taric::FaradayMiddleware::GatewayTimeout, 'Gateway timeout'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -12,6 +12,7 @@ module Taric
|
|
12
12
|
# @see https://developer.riotgames.com/api/methods#!/967/3313
|
13
13
|
# @param id [Fixnum] id of match
|
14
14
|
# @param include_timeline [Boolean] optional, true includes timestamps on events
|
15
|
+
# @return match data for id.
|
15
16
|
def match(id:, include_timeline: nil)
|
16
17
|
response_for MATCH, {matchId: id, includeTimeline: include_timeline}
|
17
18
|
end
|
data/lib/taric/version.rb
CHANGED
data/taric.gemspec
CHANGED
@@ -28,7 +28,6 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency 'rspec', '~> 3.2'
|
29
29
|
spec.add_development_dependency 'coveralls', '~> 0.7'
|
30
30
|
|
31
|
-
spec.add_dependency 'faraday', "~> 0.9"
|
32
31
|
spec.add_dependency 'typhoeus', "~> 0.3"
|
33
32
|
spec.add_runtime_dependency 'memoist', '~> 0.11'
|
34
33
|
spec.add_runtime_dependency('addressable', '~> 2.3')
|
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.1.
|
4
|
+
version: 0.1.10
|
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-03-
|
11
|
+
date: 2015-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -86,20 +86,6 @@ dependencies:
|
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0.7'
|
89
|
-
- !ruby/object:Gem::Dependency
|
90
|
-
name: faraday
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
92
|
-
requirements:
|
93
|
-
- - "~>"
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: '0.9'
|
96
|
-
type: :runtime
|
97
|
-
prerelease: false
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
99
|
-
requirements:
|
100
|
-
- - "~>"
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '0.9'
|
103
89
|
- !ruby/object:Gem::Dependency
|
104
90
|
name: typhoeus
|
105
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -205,6 +191,7 @@ files:
|
|
205
191
|
- lib/taric/client.rb
|
206
192
|
- lib/taric/configuration.rb
|
207
193
|
- lib/taric/connection.rb
|
194
|
+
- lib/taric/faraday_middleware/http_exception.rb
|
208
195
|
- lib/taric/operation/api.rb
|
209
196
|
- lib/taric/operation/base.rb
|
210
197
|
- lib/taric/operation/champion.rb
|
@@ -241,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
241
228
|
version: '0'
|
242
229
|
requirements: []
|
243
230
|
rubyforge_project:
|
244
|
-
rubygems_version: 2.4.
|
231
|
+
rubygems_version: 2.4.6
|
245
232
|
signing_key:
|
246
233
|
specification_version: 4
|
247
234
|
summary: An outrageous Riot Games LoL API Client
|