eve_online 0.37.0 → 0.38.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +3 -17
- data/.fasterer.yml +2 -0
- data/Appraisals +4 -2
- data/CHANGELOG.md +5 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +51 -31
- data/README.md +0 -1
- data/eve_online.gemspec +4 -2
- data/lib/eve_online.rb +4 -6
- data/lib/eve_online/esi/base.rb +53 -86
- data/lib/eve_online/esi/character_assets_locations.rb +1 -1
- data/lib/eve_online/esi/character_assets_names.rb +1 -1
- data/lib/eve_online/esi/corporation_assets_locations.rb +1 -1
- data/lib/eve_online/esi/corporation_assets_names.rb +1 -1
- data/lib/eve_online/esi/faraday_middlewares/raise_errors.rb +40 -0
- data/lib/eve_online/version.rb +1 -1
- metadata +35 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b0901d9d2b00008e029a12fb3e586da93862acb00548179d26f7a0765c7dde0
|
4
|
+
data.tar.gz: d84f24fbfb9dea652708d1a2e78df29984868e48709f9f0bbec78dab9e01a90c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 255486b61894bbdb23e6dd22f9da0f3f2561b6092c00e7eae19ce66a94617c2289c1bbcf0796cbb0204d7cb5f483b3e9a888b01e0558f98ce8daac0799ab1ebd
|
7
|
+
data.tar.gz: 45170de6d973bc6d12b00c81525670ce767e15014bb9cb8629c30ce0517f6cc0106d8ba46e0291ce384be51689e470c800f9fd052162c6bfa8b503b955abfb71
|
data/.circleci/config.yml
CHANGED
@@ -1,19 +1,6 @@
|
|
1
1
|
version: 2
|
2
2
|
|
3
3
|
jobs:
|
4
|
-
ruby-2.5.8:
|
5
|
-
docker:
|
6
|
-
- image: circleci/ruby:2.5.8
|
7
|
-
steps:
|
8
|
-
- checkout
|
9
|
-
- run: rm Gemfile.lock
|
10
|
-
- run: rm .ruby-version
|
11
|
-
- run: bundle install
|
12
|
-
- run: bundle exec appraisal install || true
|
13
|
-
- run: bundle exec appraisal rake
|
14
|
-
- run: bundle exec standardrb
|
15
|
-
# - run: bundle exec fasterer
|
16
|
-
- run: bundle exec mdl README.md CHANGELOG.md TODO.md
|
17
4
|
ruby-2.6.6:
|
18
5
|
docker:
|
19
6
|
- image: circleci/ruby:2.6.6
|
@@ -25,7 +12,7 @@ jobs:
|
|
25
12
|
- run: bundle exec appraisal install || true
|
26
13
|
- run: bundle exec appraisal rake
|
27
14
|
- run: bundle exec standardrb
|
28
|
-
|
15
|
+
- run: bundle exec fasterer
|
29
16
|
- run: bundle exec mdl README.md CHANGELOG.md TODO.md
|
30
17
|
ruby-2.7.2:
|
31
18
|
docker:
|
@@ -38,7 +25,7 @@ jobs:
|
|
38
25
|
- run: bundle exec appraisal install || true
|
39
26
|
- run: bundle exec appraisal rake
|
40
27
|
- run: bundle exec standardrb
|
41
|
-
|
28
|
+
- run: bundle exec fasterer
|
42
29
|
- run: bundle exec mdl README.md CHANGELOG.md TODO.md
|
43
30
|
ruby-3.0.0:
|
44
31
|
docker:
|
@@ -51,14 +38,13 @@ jobs:
|
|
51
38
|
- run: bundle exec appraisal install || true
|
52
39
|
- run: bundle exec appraisal rake
|
53
40
|
- run: bundle exec standardrb
|
54
|
-
|
41
|
+
- run: bundle exec fasterer
|
55
42
|
- run: bundle exec mdl README.md CHANGELOG.md TODO.md
|
56
43
|
|
57
44
|
workflows:
|
58
45
|
version: 2
|
59
46
|
tests:
|
60
47
|
jobs:
|
61
|
-
- ruby-2.5.8
|
62
48
|
- ruby-2.6.6
|
63
49
|
- ruby-2.7.2
|
64
50
|
- ruby-3.0.0
|
data/.fasterer.yml
ADDED
data/Appraisals
CHANGED
@@ -10,6 +10,8 @@ appraise "activesupport_61" do
|
|
10
10
|
gem "activesupport", "~> 6.1.0"
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
if Gem::Version.new(RUBY_VERSION) > Gem::Version.new("2.7.0")
|
14
|
+
appraise "activesupport_edge" do
|
15
|
+
gem "activesupport", git: "https://github.com/rails/rails", require: "activesupport", branch: "main"
|
16
|
+
end
|
15
17
|
end
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
eve_online (0.
|
4
|
+
eve_online (0.38.0)
|
5
5
|
activesupport (>= 5.2.0)
|
6
|
+
faraday
|
7
|
+
faraday_middleware
|
6
8
|
|
7
9
|
GEM
|
8
10
|
remote: https://rubygems.org/
|
9
11
|
specs:
|
10
|
-
activesupport (6.1.
|
12
|
+
activesupport (6.1.3)
|
11
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
14
|
i18n (>= 1.6, < 2)
|
13
15
|
minitest (>= 5.1)
|
@@ -15,21 +17,32 @@ GEM
|
|
15
17
|
zeitwerk (~> 2.3)
|
16
18
|
addressable (2.7.0)
|
17
19
|
public_suffix (>= 2.0.2, < 5.0)
|
18
|
-
appraisal (2.
|
20
|
+
appraisal (2.4.0)
|
19
21
|
bundler
|
20
22
|
rake
|
21
23
|
thor (>= 0.14.0)
|
22
|
-
ast (2.4.
|
24
|
+
ast (2.4.2)
|
23
25
|
awesome_print (1.8.0)
|
24
|
-
chef-utils (16.
|
26
|
+
chef-utils (16.10.17)
|
25
27
|
coderay (1.1.3)
|
26
|
-
|
28
|
+
colorize (0.8.1)
|
29
|
+
concurrent-ruby (1.1.8)
|
27
30
|
crack (0.4.5)
|
28
31
|
rexml
|
29
32
|
diff-lcs (1.4.4)
|
30
|
-
docile (1.3.
|
33
|
+
docile (1.3.5)
|
34
|
+
faraday (1.3.0)
|
35
|
+
faraday-net_http (~> 1.0)
|
36
|
+
multipart-post (>= 1.2, < 3)
|
37
|
+
ruby2_keywords
|
38
|
+
faraday-net_http (1.0.1)
|
39
|
+
faraday_middleware (1.0.0)
|
40
|
+
faraday (~> 1.0)
|
41
|
+
fasterer (0.9.0)
|
42
|
+
colorize (~> 0.7)
|
43
|
+
ruby_parser (>= 3.14.1)
|
31
44
|
hashdiff (1.0.1)
|
32
|
-
i18n (1.8.
|
45
|
+
i18n (1.8.9)
|
33
46
|
concurrent-ruby (~> 1.0)
|
34
47
|
kramdown (2.3.0)
|
35
48
|
rexml
|
@@ -43,28 +56,29 @@ GEM
|
|
43
56
|
mixlib-shellout
|
44
57
|
method_source (1.0.0)
|
45
58
|
mini_portile2 (2.5.0)
|
46
|
-
minitest (5.14.
|
59
|
+
minitest (5.14.4)
|
47
60
|
mixlib-cli (2.1.8)
|
48
61
|
mixlib-config (3.0.9)
|
49
62
|
tomlrb
|
50
|
-
mixlib-shellout (3.2.
|
63
|
+
mixlib-shellout (3.2.5)
|
51
64
|
chef-utils
|
52
|
-
|
65
|
+
multipart-post (2.1.1)
|
66
|
+
nokogiri (1.11.1)
|
53
67
|
mini_portile2 (~> 2.5.0)
|
54
68
|
racc (~> 1.4)
|
55
|
-
nokogiri (1.11.
|
69
|
+
nokogiri (1.11.1-x86_64-darwin)
|
56
70
|
racc (~> 1.4)
|
57
71
|
parallel (1.20.1)
|
58
72
|
parser (3.0.0.0)
|
59
73
|
ast (~> 2.4.1)
|
60
|
-
pry (0.
|
74
|
+
pry (0.14.0)
|
61
75
|
coderay (~> 1.1)
|
62
76
|
method_source (~> 1.0)
|
63
77
|
public_suffix (4.0.6)
|
64
78
|
racc (1.5.2)
|
65
79
|
rainbow (3.0.0)
|
66
80
|
rake (13.0.3)
|
67
|
-
regexp_parser (2.
|
81
|
+
regexp_parser (2.1.1)
|
68
82
|
rexml (3.2.4)
|
69
83
|
rspec (3.10.0)
|
70
84
|
rspec-core (~> 3.10.0)
|
@@ -78,41 +92,45 @@ GEM
|
|
78
92
|
rspec-its (1.3.0)
|
79
93
|
rspec-core (>= 3.0.0)
|
80
94
|
rspec-expectations (>= 3.0.0)
|
81
|
-
rspec-mocks (3.10.
|
95
|
+
rspec-mocks (3.10.2)
|
82
96
|
diff-lcs (>= 1.2.0, < 2.0)
|
83
97
|
rspec-support (~> 3.10.0)
|
84
|
-
rspec-support (3.10.
|
85
|
-
rubocop (1.
|
98
|
+
rspec-support (3.10.2)
|
99
|
+
rubocop (1.10.0)
|
86
100
|
parallel (~> 1.10)
|
87
|
-
parser (>=
|
101
|
+
parser (>= 3.0.0.0)
|
88
102
|
rainbow (>= 2.2.2, < 4.0)
|
89
|
-
regexp_parser (>= 1.8)
|
103
|
+
regexp_parser (>= 1.8, < 3.0)
|
90
104
|
rexml
|
91
|
-
rubocop-ast (>= 1.
|
105
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
92
106
|
ruby-progressbar (~> 1.7)
|
93
|
-
unicode-display_width (>= 1.4.0, <
|
94
|
-
rubocop-ast (1.4.
|
107
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
108
|
+
rubocop-ast (1.4.1)
|
95
109
|
parser (>= 2.7.1.5)
|
96
|
-
rubocop-performance (1.9.
|
110
|
+
rubocop-performance (1.9.2)
|
97
111
|
rubocop (>= 0.90.0, < 2.0)
|
98
112
|
rubocop-ast (>= 0.4.0)
|
99
113
|
ruby-progressbar (1.11.0)
|
100
|
-
|
114
|
+
ruby2_keywords (0.0.4)
|
115
|
+
ruby_parser (3.15.1)
|
116
|
+
sexp_processor (~> 4.9)
|
117
|
+
sexp_processor (4.15.2)
|
118
|
+
simplecov (0.21.2)
|
101
119
|
docile (~> 1.1)
|
102
120
|
simplecov-html (~> 0.11)
|
103
121
|
simplecov_json_formatter (~> 0.1)
|
104
122
|
simplecov-html (0.12.3)
|
105
123
|
simplecov_json_formatter (0.1.2)
|
106
|
-
standard (0.
|
107
|
-
rubocop (= 1.
|
108
|
-
rubocop-performance (= 1.9.
|
109
|
-
thor (1.0
|
124
|
+
standard (0.13.0)
|
125
|
+
rubocop (= 1.10.0)
|
126
|
+
rubocop-performance (= 1.9.2)
|
127
|
+
thor (1.1.0)
|
110
128
|
tomlrb (2.0.1)
|
111
129
|
tzinfo (2.0.4)
|
112
130
|
concurrent-ruby (~> 1.0)
|
113
|
-
unicode-display_width (
|
131
|
+
unicode-display_width (2.0.0)
|
114
132
|
vcr (6.0.0)
|
115
|
-
webmock (3.
|
133
|
+
webmock (3.12.0)
|
116
134
|
addressable (>= 2.3.6)
|
117
135
|
crack (>= 0.3.2)
|
118
136
|
hashdiff (>= 0.4.0, < 2.0.0)
|
@@ -121,12 +139,14 @@ GEM
|
|
121
139
|
PLATFORMS
|
122
140
|
ruby
|
123
141
|
x86_64-darwin-19
|
142
|
+
x86_64-darwin-20
|
124
143
|
|
125
144
|
DEPENDENCIES
|
126
145
|
appraisal
|
127
146
|
awesome_print
|
128
147
|
bundler
|
129
148
|
eve_online!
|
149
|
+
fasterer
|
130
150
|
mdl
|
131
151
|
nokogiri
|
132
152
|
pry
|
@@ -139,4 +159,4 @@ DEPENDENCIES
|
|
139
159
|
webmock
|
140
160
|
|
141
161
|
BUNDLED WITH
|
142
|
-
2.2.
|
162
|
+
2.2.11
|
data/README.md
CHANGED
data/eve_online.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.authors = ["Igor Zubkov"]
|
11
11
|
spec.email = ["igor.zubkov@gmail.com"]
|
12
12
|
|
13
|
-
spec.summary = "EveOnline ESI API
|
13
|
+
spec.summary = "EveOnline ESI API"
|
14
14
|
spec.description = "EveOnline ESI API."
|
15
15
|
spec.homepage = "https://github.com/evemonk/eve_online"
|
16
16
|
spec.license = "MIT"
|
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|bin)/}) }
|
27
27
|
spec.require_paths = ["lib"]
|
28
28
|
|
29
|
-
spec.required_ruby_version = ">= 2.
|
29
|
+
spec.required_ruby_version = ">= 2.6"
|
30
30
|
|
31
31
|
spec.add_development_dependency "bundler"
|
32
32
|
spec.add_development_dependency "rake"
|
@@ -38,5 +38,7 @@ Gem::Specification.new do |spec|
|
|
38
38
|
spec.add_development_dependency "mdl"
|
39
39
|
spec.add_development_dependency "appraisal"
|
40
40
|
|
41
|
+
spec.add_runtime_dependency "faraday"
|
42
|
+
spec.add_runtime_dependency "faraday_middleware"
|
41
43
|
spec.add_runtime_dependency "activesupport", ">= 5.2.0"
|
42
44
|
end
|
data/lib/eve_online.rb
CHANGED
@@ -134,6 +134,10 @@ module EveOnline
|
|
134
134
|
autoload :War, "eve_online/esi/war"
|
135
135
|
autoload :WarKillmails, "eve_online/esi/war_killmails"
|
136
136
|
|
137
|
+
module FaradayMiddlewares
|
138
|
+
autoload :RaiseErrors, "eve_online/esi/faraday_middlewares/raise_errors"
|
139
|
+
end
|
140
|
+
|
137
141
|
module Models
|
138
142
|
autoload :Base, "eve_online/esi/models/base"
|
139
143
|
|
@@ -237,9 +241,3 @@ module EveOnline
|
|
237
241
|
autoload :BlueprintCopyTime, "eve_online/formulas/blueprint_copy_time"
|
238
242
|
end
|
239
243
|
end
|
240
|
-
|
241
|
-
# class Net::HTTPErrorLimited < Net::HTTPClientError # 420
|
242
|
-
# HAS_BODY = false
|
243
|
-
# end
|
244
|
-
#
|
245
|
-
# Net::HTTPResponse::CODE_TO_OBJ.merge!("420"=>Net::HTTPErrorLimited)
|
data/lib/eve_online/esi/base.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "
|
4
|
-
require "
|
5
|
-
require "json"
|
3
|
+
require "faraday"
|
4
|
+
require "faraday_middleware"
|
6
5
|
require "active_support/time"
|
7
6
|
|
8
7
|
module EveOnline
|
@@ -10,23 +9,20 @@ module EveOnline
|
|
10
9
|
class Base
|
11
10
|
API_HOST = "esi.evetech.net"
|
12
11
|
|
13
|
-
attr_reader :token, :
|
14
|
-
:language
|
12
|
+
attr_reader :token, :_read_timeout, :_open_timeout, :_write_timeout,
|
13
|
+
:_etag, :language, :adapter, :middlewares
|
15
14
|
|
16
|
-
|
17
|
-
attr_reader :_write_timeout
|
18
|
-
end
|
15
|
+
attr_writer :token
|
19
16
|
|
20
17
|
def initialize(options = {})
|
21
18
|
@token = options.fetch(:token, nil)
|
22
|
-
@parser = options.fetch(:parser, JSON)
|
23
19
|
@_read_timeout = options.fetch(:read_timeout, 60)
|
24
20
|
@_open_timeout = options.fetch(:open_timeout, 60)
|
25
|
-
|
26
|
-
@_write_timeout = options.fetch(:write_timeout, 60)
|
27
|
-
end
|
21
|
+
@_write_timeout = options.fetch(:write_timeout, 60)
|
28
22
|
@_etag = options.fetch(:etag, nil)
|
29
23
|
@language = options.fetch(:language, "en-us")
|
24
|
+
@adapter = options.fetch(:adapter, Faraday.default_adapter)
|
25
|
+
@middlewares = options.fetch(:middlewares, [])
|
30
26
|
end
|
31
27
|
|
32
28
|
def url
|
@@ -42,33 +38,31 @@ module EveOnline
|
|
42
38
|
end
|
43
39
|
|
44
40
|
def http_method
|
45
|
-
|
41
|
+
:get
|
46
42
|
end
|
47
43
|
|
48
44
|
def read_timeout
|
49
|
-
|
45
|
+
connection.options.read_timeout
|
50
46
|
end
|
51
47
|
|
52
48
|
def read_timeout=(value)
|
53
|
-
|
49
|
+
connection.options.read_timeout = value
|
54
50
|
end
|
55
51
|
|
56
52
|
def open_timeout
|
57
|
-
|
53
|
+
connection.options.open_timeout
|
58
54
|
end
|
59
55
|
|
60
56
|
def open_timeout=(value)
|
61
|
-
|
57
|
+
connection.options.open_timeout = value
|
62
58
|
end
|
63
59
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
end
|
60
|
+
def write_timeout
|
61
|
+
connection.options.write_timeout
|
62
|
+
end
|
68
63
|
|
69
|
-
|
70
|
-
|
71
|
-
end
|
64
|
+
def write_timeout=(value)
|
65
|
+
connection.options.write_timeout = value
|
72
66
|
end
|
73
67
|
|
74
68
|
def etag=(value)
|
@@ -76,56 +70,53 @@ module EveOnline
|
|
76
70
|
end
|
77
71
|
|
78
72
|
def etag
|
79
|
-
resource.
|
73
|
+
resource.headers["etag"]&.gsub("W/", "")&.gsub('"', "")
|
80
74
|
end
|
81
75
|
|
82
76
|
def page
|
83
77
|
end
|
84
78
|
|
85
79
|
def total_pages
|
86
|
-
resource.
|
80
|
+
resource.headers["x-pages"]&.to_i
|
87
81
|
end
|
88
82
|
|
89
83
|
def error_limit_remain
|
90
|
-
resource.
|
84
|
+
resource.headers["x-esi-error-limit-remain"]&.to_i
|
91
85
|
end
|
92
86
|
|
93
87
|
def error_limit_reset
|
94
|
-
resource.
|
88
|
+
resource.headers["x-esi-error-limit-reset"]&.to_i
|
95
89
|
end
|
96
90
|
|
97
|
-
def
|
98
|
-
|
99
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
100
|
-
http.read_timeout = _read_timeout
|
101
|
-
http.open_timeout = _open_timeout
|
102
|
-
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.6.0")
|
103
|
-
http.write_timeout = _write_timeout
|
104
|
-
end
|
105
|
-
http.use_ssl = true
|
106
|
-
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
107
|
-
# http.set_debug_output($stdout)
|
108
|
-
http
|
109
|
-
end
|
91
|
+
def request_id
|
92
|
+
resource.headers["x-esi-request-id"]
|
110
93
|
end
|
111
94
|
|
112
|
-
def
|
113
|
-
@
|
114
|
-
request = "Net::HTTP::#{http_method}".constantize.new(uri.request_uri)
|
115
|
-
|
116
|
-
request["User-Agent"] = user_agent
|
117
|
-
request["Accept"] = "application/json"
|
118
|
-
request["Authorization"] = "Bearer #{token}" if token
|
119
|
-
request["If-None-Match"] = _etag if _etag
|
120
|
-
request["Content-Type"] = "application/json" if http_method == "Post"
|
121
|
-
request.body = payload if http_method == "Post"
|
122
|
-
|
123
|
-
request
|
124
|
-
end
|
95
|
+
def add_middleware(middleware)
|
96
|
+
@middlewares << middleware
|
125
97
|
end
|
126
98
|
|
127
|
-
|
128
|
-
|
99
|
+
def connection
|
100
|
+
@connection ||= Faraday.new { |f|
|
101
|
+
f.headers["User-Agent"] = user_agent
|
102
|
+
f.headers["If-None-Match"] = _etag if _etag
|
103
|
+
f.authorization :Bearer, token if token
|
104
|
+
f.options.read_timeout = _read_timeout
|
105
|
+
f.options.open_timeout = _open_timeout
|
106
|
+
f.options.write_timeout = _write_timeout
|
107
|
+
f.use FaradayMiddlewares::RaiseErrors
|
108
|
+
middlewares.each do |middleware|
|
109
|
+
if middleware[:esi].present?
|
110
|
+
f.use middleware[:class], esi: middleware[:esi]
|
111
|
+
else
|
112
|
+
f.use middleware[:class]
|
113
|
+
end
|
114
|
+
end
|
115
|
+
# f.use Faraday::Response::Logger
|
116
|
+
# f.use FaradayMiddleware::FollowRedirects, limit: 5
|
117
|
+
f.response :json, content_type: "application/json"
|
118
|
+
f.adapter adapter
|
119
|
+
}
|
129
120
|
end
|
130
121
|
|
131
122
|
def uri
|
@@ -159,49 +150,25 @@ module EveOnline
|
|
159
150
|
end
|
160
151
|
|
161
152
|
def resource
|
162
|
-
@resource ||=
|
163
|
-
rescue
|
153
|
+
@resource ||= connection.public_send(http_method, uri)
|
154
|
+
rescue Faraday::ConnectionFailed, Faraday::TimeoutError
|
164
155
|
raise EveOnline::Exceptions::Timeout
|
165
156
|
end
|
166
157
|
|
167
158
|
def not_modified?
|
168
|
-
resource.
|
159
|
+
resource.status == 304
|
169
160
|
end
|
170
161
|
|
171
162
|
def content
|
172
|
-
|
173
|
-
when Net::HTTPOK
|
174
|
-
# TODO: memoize resource.body as @content
|
175
|
-
resource.body
|
176
|
-
when Net::HTTPCreated
|
177
|
-
# TODO: write
|
178
|
-
raise NotImplementedError
|
179
|
-
when Net::HTTPNoContent
|
180
|
-
raise EveOnline::Exceptions::NoContent
|
181
|
-
when Net::HTTPNotModified
|
163
|
+
if not_modified?
|
182
164
|
raise EveOnline::Exceptions::NotModified
|
183
|
-
when Net::HTTPBadRequest
|
184
|
-
raise EveOnline::Exceptions::BadRequest
|
185
|
-
when Net::HTTPUnauthorized
|
186
|
-
raise EveOnline::Exceptions::Unauthorized
|
187
|
-
when Net::HTTPForbidden
|
188
|
-
raise EveOnline::Exceptions::Forbidden
|
189
|
-
when Net::HTTPNotFound
|
190
|
-
raise EveOnline::Exceptions::ResourceNotFound
|
191
|
-
when Net::HTTPInternalServerError
|
192
|
-
raise EveOnline::Exceptions::InternalServerError
|
193
|
-
when Net::HTTPBadGateway
|
194
|
-
raise EveOnline::Exceptions::BadGateway
|
195
|
-
when Net::HTTPServiceUnavailable
|
196
|
-
raise EveOnline::Exceptions::ServiceUnavailable
|
197
165
|
else
|
198
|
-
|
199
|
-
raise NotImplementedError
|
166
|
+
resource.body
|
200
167
|
end
|
201
168
|
end
|
202
169
|
|
203
170
|
def response
|
204
|
-
@response ||=
|
171
|
+
@response ||= content
|
205
172
|
end
|
206
173
|
|
207
174
|
private
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "faraday"
|
4
|
+
|
5
|
+
module EveOnline
|
6
|
+
module ESI
|
7
|
+
module FaradayMiddlewares
|
8
|
+
class RaiseErrors < Faraday::Middleware
|
9
|
+
def call(env)
|
10
|
+
@app.call(env).on_complete do |environment|
|
11
|
+
on_complete(environment)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def on_complete(env)
|
16
|
+
case env[:status]
|
17
|
+
when 204
|
18
|
+
raise EveOnline::Exceptions::NoContent
|
19
|
+
when 400
|
20
|
+
raise EveOnline::Exceptions::BadRequest
|
21
|
+
when 401
|
22
|
+
raise EveOnline::Exceptions::Unauthorized
|
23
|
+
when 403
|
24
|
+
raise EveOnline::Exceptions::Forbidden
|
25
|
+
when 404
|
26
|
+
raise EveOnline::Exceptions::ResourceNotFound
|
27
|
+
when 420
|
28
|
+
raise EveOnline::Exceptions::ErrorLimited
|
29
|
+
when 500
|
30
|
+
raise EveOnline::Exceptions::InternalServerError
|
31
|
+
when 502
|
32
|
+
raise EveOnline::Exceptions::BadGateway
|
33
|
+
when 503
|
34
|
+
raise EveOnline::Exceptions::ServiceUnavailable
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/eve_online/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eve_online
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.38.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Zubkov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -136,6 +136,34 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: faraday
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: faraday_middleware
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :runtime
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
139
167
|
- !ruby/object:Gem::Dependency
|
140
168
|
name: activesupport
|
141
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -159,6 +187,7 @@ extra_rdoc_files: []
|
|
159
187
|
files:
|
160
188
|
- ".circleci/config.yml"
|
161
189
|
- ".deepsource.toml"
|
190
|
+
- ".fasterer.yml"
|
162
191
|
- ".github/FUNDING.yml"
|
163
192
|
- ".gitignore"
|
164
193
|
- ".mdlrc"
|
@@ -225,6 +254,7 @@ files:
|
|
225
254
|
- lib/eve_online/esi/dogma_attributes.rb
|
226
255
|
- lib/eve_online/esi/dogma_effect.rb
|
227
256
|
- lib/eve_online/esi/dogma_effects.rb
|
257
|
+
- lib/eve_online/esi/faraday_middlewares/raise_errors.rb
|
228
258
|
- lib/eve_online/esi/killmail.rb
|
229
259
|
- lib/eve_online/esi/market_group.rb
|
230
260
|
- lib/eve_online/esi/market_groups.rb
|
@@ -379,15 +409,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
379
409
|
requirements:
|
380
410
|
- - ">="
|
381
411
|
- !ruby/object:Gem::Version
|
382
|
-
version: '2.
|
412
|
+
version: '2.6'
|
383
413
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
384
414
|
requirements:
|
385
415
|
- - ">="
|
386
416
|
- !ruby/object:Gem::Version
|
387
417
|
version: '0'
|
388
418
|
requirements: []
|
389
|
-
rubygems_version: 3.2.
|
419
|
+
rubygems_version: 3.2.11
|
390
420
|
signing_key:
|
391
421
|
specification_version: 4
|
392
|
-
summary: EveOnline ESI API
|
422
|
+
summary: EveOnline ESI API
|
393
423
|
test_files: []
|