esi-sdk 1.1.3 → 1.2.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 +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +7 -1
- data/README.md +15 -0
- data/Rakefile +30 -26
- data/esi-sdk.gemspec +1 -0
- data/lib/esi/client.rb +66 -44
- data/lib/esi/client/alliance.rb +7 -7
- data/lib/esi/client/assets.rb +20 -16
- data/lib/esi/client/bookmarks.rb +8 -8
- data/lib/esi/client/calendar.rb +15 -14
- data/lib/esi/client/character.rb +31 -29
- data/lib/esi/client/clones.rb +4 -4
- data/lib/esi/client/contacts.rb +26 -24
- data/lib/esi/client/contracts.rb +22 -22
- data/lib/esi/client/corporation.rb +46 -46
- data/lib/esi/client/dogma.rb +9 -9
- data/lib/esi/client/faction_warfare.rb +10 -10
- data/lib/esi/client/fittings.rb +9 -8
- data/lib/esi/client/fleets.rb +49 -42
- data/lib/esi/client/incursions.rb +1 -1
- data/lib/esi/client/industry.rb +19 -19
- data/lib/esi/client/insurance.rb +1 -1
- data/lib/esi/client/killmails.rb +7 -7
- data/lib/esi/client/location.rb +6 -6
- data/lib/esi/client/loyalty.rb +4 -4
- data/lib/esi/client/mail.rb +26 -23
- data/lib/esi/client/market.rb +25 -25
- data/lib/esi/client/opportunities.rb +8 -8
- data/lib/esi/client/planetary_interaction.rb +9 -9
- data/lib/esi/client/routes.rb +6 -6
- data/lib/esi/client/search.rb +7 -7
- data/lib/esi/client/skills.rb +6 -6
- data/lib/esi/client/sovereignty.rb +3 -3
- data/lib/esi/client/status.rb +1 -1
- data/lib/esi/client/universe.rb +51 -49
- data/lib/esi/client/user_interface.rb +19 -14
- data/lib/esi/client/wallet.rb +18 -18
- data/lib/esi/client/wars.rb +7 -7
- data/lib/esi/errors.rb +11 -0
- data/lib/esi/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32e80c8b57db70012c9002de31f5533508fc5144d6d416b5d5f3c1dd588805df
|
4
|
+
data.tar.gz: 1f20d6ef7531035b260c4b5d936ff4bed4f6ac1d9e3222a771c7717c4b8f236c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2d30b0b42a5b16e4756f30fd5ed490e5129db9caa7e67ccac5bbc26ae17cb316589d38ce466daea8cb3b2eb4b2553a4385e8d780a1d786b56ce2cf61422d26b
|
7
|
+
data.tar.gz: 40b27c822b0356183a25b88aa6ddad08b975c152b772beae0ee2c047a4579483a9c8333879371db5e21c954bfffa75244e812df529331fe7d712bcf105943ecb
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# ESI SDK Changelog
|
2
2
|
|
3
|
+
# [1.2.0](https://github.com/bokoboshahni/esi-sdk-ruby/compare/v1.1.3...v1.2.0) (2021-07-20)
|
4
|
+
|
5
|
+
|
6
|
+
### Features
|
7
|
+
|
8
|
+
* Client improvements ([bad70ae](https://github.com/bokoboshahni/esi-sdk-ruby/commit/bad70ae4d97b8b0f93019b5b4dac73f97aad7dc0))
|
9
|
+
|
3
10
|
## [1.1.3](https://github.com/bokoboshahni/esi-sdk-ruby/compare/v1.1.2...v1.1.3) (2021-07-19)
|
4
11
|
|
5
12
|
|
data/Gemfile.lock
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
esi-sdk (1.
|
4
|
+
esi-sdk (1.2.0)
|
5
5
|
faraday (~> 1.5)
|
6
6
|
faraday-http-cache (~> 2.2)
|
7
7
|
faraday_middleware (~> 1.0)
|
8
|
+
typhoeus (~> 1.4)
|
8
9
|
|
9
10
|
GEM
|
10
11
|
remote: https://rubygems.org/
|
@@ -23,6 +24,8 @@ GEM
|
|
23
24
|
rexml
|
24
25
|
diff-lcs (1.4.4)
|
25
26
|
docile (1.4.0)
|
27
|
+
ethon (0.14.0)
|
28
|
+
ffi (>= 1.15.0)
|
26
29
|
faraday (1.5.1)
|
27
30
|
faraday-em_http (~> 1.0)
|
28
31
|
faraday-em_synchrony (~> 1.0)
|
@@ -44,6 +47,7 @@ GEM
|
|
44
47
|
faraday-patron (1.0.0)
|
45
48
|
faraday_middleware (1.0.0)
|
46
49
|
faraday (~> 1.0)
|
50
|
+
ffi (1.15.3)
|
47
51
|
hashdiff (1.0.1)
|
48
52
|
i18n (1.8.10)
|
49
53
|
concurrent-ruby (~> 1.0)
|
@@ -102,6 +106,8 @@ GEM
|
|
102
106
|
simplecov_json_formatter (~> 0.1)
|
103
107
|
simplecov-html (0.12.3)
|
104
108
|
simplecov_json_formatter (0.1.3)
|
109
|
+
typhoeus (1.4.0)
|
110
|
+
ethon (>= 0.9.0)
|
105
111
|
tzinfo (2.0.4)
|
106
112
|
concurrent-ruby (~> 1.0)
|
107
113
|
unicode-display_width (2.0.0)
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+

|
2
|
+
|
1
3
|
# EVE Swagger Interface (ESI) SDK
|
2
4
|
|
3
5
|
ESI SDK is a Ruby API client for the EVE Swagger Interface (ESI), the official API for the [EVE Online](https://eveonline.com) MMORPG.
|
@@ -53,6 +55,19 @@ response = client.get_character(character_id: 2113024536)
|
|
53
55
|
|
54
56
|
See the documentation for [ESI::Client](https://bokoboshahni.github.io/esi-sdk-ruby/ESI/Client.html) for detailed information on each endpoint.
|
55
57
|
|
58
|
+
### Caching
|
59
|
+
|
60
|
+
Caching is handled via the [faraday-http-cache](https://github.com/sourcelevel/faraday-http-cache) middleware. When instantiating an `ESI::Client` instance, cache configuration can be passed via the `cache` parameter:
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
client = ESI::Client.new(
|
64
|
+
user_agent: 'My ESI Bot/1.0; +(https://example.com)',
|
65
|
+
cache: { store: Rails.cache, logger: Rails.logger, instrumenter: ActiveSupport::Notifications }
|
66
|
+
)
|
67
|
+
```
|
68
|
+
|
69
|
+
See the [faraday-http-cache](https://github.com/sourcelevel/faraday-http-cache) documentation for more details on what configuration options are available.
|
70
|
+
|
56
71
|
## Development
|
57
72
|
|
58
73
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/Rakefile
CHANGED
@@ -142,7 +142,7 @@ task :generate do
|
|
142
142
|
end
|
143
143
|
|
144
144
|
param_tags = operation[:params].map do |p|
|
145
|
-
"# @param #{p["name"]} [
|
145
|
+
"# @param #{p["name"]} [#{p["type"].capitalize}] #{p["description"]}"
|
146
146
|
end
|
147
147
|
|
148
148
|
if operation[:body]
|
@@ -161,14 +161,26 @@ task :generate do
|
|
161
161
|
end
|
162
162
|
|
163
163
|
operation[:query]&.each do |p|
|
164
|
-
|
165
|
-
|
164
|
+
p_tag = "# @param #{p["name"]} [#{p["type"].capitalize}] "
|
165
|
+
p_tag += (p["description"]).to_s
|
166
|
+
p_tag += ". Must be one of: #{p["enum"].map { |e| "`#{e}`" }.join(", ")}" if p["enum"]
|
167
|
+
p_str = if p["default"] && p["type"] == "integer"
|
168
|
+
"#{p["name"]}: #{p["default"]}"
|
169
|
+
elsif p["default"] && p["type"] == "string"
|
170
|
+
"#{p["name"]}: \"#{p["default"]}\""
|
171
|
+
elsif !p["required"]
|
172
|
+
"#{p["name"]}: nil"
|
173
|
+
else
|
174
|
+
"#{p["name"]}:"
|
175
|
+
end
|
176
|
+
signature_params << p_str
|
177
|
+
param_tags << p_tag
|
166
178
|
end
|
167
179
|
|
168
|
-
|
169
|
-
|
170
|
-
param_tags << "# @param params [Hash] Additional query string parameters"
|
180
|
+
signature_params += %w[headers params].map do |p|
|
181
|
+
"#{p}: {}"
|
171
182
|
end
|
183
|
+
param_tags << "# @param params [Hash] Additional query string parameters"
|
172
184
|
|
173
185
|
param_tags += [
|
174
186
|
"# @param headers [Hash] Additional headers"
|
@@ -188,9 +200,6 @@ task :generate do
|
|
188
200
|
description += "# @see https://esi.evetech.net/ui/#/#{operation[:tag]}/#{operation[:name]}"
|
189
201
|
description.gsub!(/^$\n/m, "")
|
190
202
|
|
191
|
-
signature_params += %w[headers].map do |p|
|
192
|
-
"#{p}: {}"
|
193
|
-
end
|
194
203
|
signature = "(#{signature_params.join(", ")})"
|
195
204
|
path_parts = operation[:path].split("/")
|
196
205
|
path_parts.map! do |p|
|
@@ -202,16 +211,12 @@ task :generate do
|
|
202
211
|
end
|
203
212
|
path = "#{path_parts.join("/")}/"
|
204
213
|
|
205
|
-
http_call_params = %w[headers].map { |p| "#{p}: #{p}" }
|
206
|
-
http_call_params <<
|
207
|
-
"params: params"
|
208
|
-
elsif operation[:body]
|
209
|
-
"payload: #{body_param["name"]}"
|
210
|
-
end
|
214
|
+
http_call_params = %w[headers params].map { |p| "#{p}: #{p}" }
|
215
|
+
http_call_params << ("payload: #{body_param["name"]}" if operation[:body])
|
211
216
|
|
212
217
|
if operation[:query].any?
|
213
|
-
http_call = "
|
214
|
-
http_call += "#{operation[:method]}(\"#{path}
|
218
|
+
http_call = "params.merge!(#{operation[:query].map { |q| "'#{q["name"]}' => #{q["name"]}" }.join(", ")})\n"
|
219
|
+
http_call += "#{operation[:method]}(\"#{path}\", #{http_call_params.join(", ")})"
|
215
220
|
else
|
216
221
|
http_call = "#{operation[:method]}(\"#{path}\", #{http_call_params.join(", ")})"
|
217
222
|
end
|
@@ -269,11 +274,6 @@ task :generate do
|
|
269
274
|
success_params = operation[:params].map { |p| "#{p["name"]}: \"1234567890\"" }
|
270
275
|
success_params += operation[:query].map { |p| "#{p["name"]}: \"1234567890\"" }
|
271
276
|
|
272
|
-
if operation[:query].any?
|
273
|
-
query = URI.encode_www_form(operation[:query].map { |q| [q["name"], "1234567890"] })
|
274
|
-
success_path = "#{success_path}?#{query}"
|
275
|
-
end
|
276
|
-
|
277
277
|
if operation[:body]
|
278
278
|
body_param = operation[:body]
|
279
279
|
body_name = body_param["name"]
|
@@ -287,12 +287,14 @@ task :generate do
|
|
287
287
|
success_params << "#{body_name}: #{body_value}"
|
288
288
|
end
|
289
289
|
|
290
|
+
with_query = operation[:query].any? ? ".with(query: { #{operation[:query].map { |p| "#{p["name"]}: \"1234567890\"" }.join(", ")} })" : ""
|
291
|
+
|
290
292
|
describe = " describe \"##{method_name}\" do\n"
|
291
293
|
describe += " context \"when the response is #{success_code}\" do\n"
|
292
294
|
describe += " let(:response) { #{success_response_body} }\n"
|
293
295
|
describe += "\n"
|
294
296
|
describe += " before do\n"
|
295
|
-
describe += " stub_request(:#{operation[:method]}, \"https://esi.evetech.net/latest#{success_path}\").to_return(body: response.to_json)\n"
|
297
|
+
describe += " stub_request(:#{operation[:method]}, \"https://esi.evetech.net/latest#{success_path}\")#{with_query}.to_return(body: response.to_json)\n"
|
296
298
|
describe += " end\n"
|
297
299
|
describe += "\n"
|
298
300
|
describe += " it \"returns the response\" do\n"
|
@@ -303,13 +305,15 @@ task :generate do
|
|
303
305
|
describe += "\n"
|
304
306
|
|
305
307
|
error_contexts = operation[:errors].map do |(code, error)|
|
308
|
+
next if %w[502 503 504].include?(code)
|
309
|
+
|
306
310
|
error_response_body = error["examples"]["application/json"].inspect
|
307
311
|
|
308
312
|
context = " context \"when the response is #{code}\" do\n"
|
309
313
|
context += " let(:response) { #{error_response_body} }\n"
|
310
314
|
context += "\n"
|
311
315
|
context += " before do\n"
|
312
|
-
context += " stub_request(:#{operation[:method]}, \"https://esi.evetech.net/latest#{success_path}\").to_return(body: response.to_json, status: #{code})\n"
|
316
|
+
context += " stub_request(:#{operation[:method]}, \"https://esi.evetech.net/latest#{success_path}\")#{with_query}.to_return(body: response.to_json, status: #{code})\n"
|
313
317
|
context += " end\n"
|
314
318
|
context += "\n"
|
315
319
|
context += " it \"raises a #{error_mapping[code.to_i]} error\" do\n"
|
@@ -327,8 +331,8 @@ task :generate do
|
|
327
331
|
spec_content = <<~SPEC_FILE
|
328
332
|
# frozen_string_literal: true
|
329
333
|
|
330
|
-
RSpec.describe ESI::Client::#{module_name} do
|
331
|
-
subject(:client) { ESI::Client.new(user_agent: \"
|
334
|
+
RSpec.describe ESI::Client::#{module_name}, type: :stub do
|
335
|
+
subject(:client) { ESI::Client.new(user_agent: \"esi-sdk-ruby Tests/1.0; +(https://github.com/bokoboshahni/esi-sdk-ruby)\") }
|
332
336
|
|
333
337
|
#{describe_blocks.join("\n\n")}
|
334
338
|
end
|
data/esi-sdk.gemspec
CHANGED
data/lib/esi/client.rb
CHANGED
@@ -4,6 +4,8 @@ require "faraday"
|
|
4
4
|
require "faraday-http-cache"
|
5
5
|
require "faraday_middleware"
|
6
6
|
require "timeout"
|
7
|
+
require "typhoeus"
|
8
|
+
require "typhoeus/adapters/faraday"
|
7
9
|
|
8
10
|
require_relative "./errors"
|
9
11
|
require_relative "./client/alliance"
|
@@ -95,18 +97,23 @@ module ESI
|
|
95
97
|
|
96
98
|
# Returns a new {ESI::Client}.
|
97
99
|
#
|
100
|
+
# See the [faraday-http-cache](https://github.com/sourcelevel/faraday-http-cache) documentation for information on
|
101
|
+
# how to set up caching via the `cache` parameter.
|
102
|
+
#
|
98
103
|
# @param user_agent [String] Value of the `User-Agent` header for HTTP calls
|
99
104
|
# @param base_url [String] The base URL of the ESI API
|
100
105
|
# @param version [String] The version of the ESI API
|
101
106
|
# @param cache [Hash] The cache configuration to use
|
107
|
+
# @param max_concurrency [Integer] Maximum concurrent requests for pagination
|
102
108
|
# @option cache [Object] :store The cache store (e.g. `Rails.cache`)
|
103
109
|
# @option cache [Object] :logger The logger (e.g. `Rails.logger`)
|
104
110
|
# @option cache [Object] :instrumenter The instrumenter (e.g. `ActiveSupport::Notifications`)
|
105
|
-
def initialize(user_agent:, base_url: DEFAULT_BASE_URL, version: DEFAULT_VERSION, cache: {})
|
111
|
+
def initialize(user_agent:, base_url: DEFAULT_BASE_URL, version: DEFAULT_VERSION, cache: {}, max_concurrency: 50)
|
106
112
|
@base_url = base_url
|
107
113
|
@cache = cache
|
108
114
|
@user_agent = user_agent
|
109
115
|
@version = version
|
116
|
+
@hydra = Typhoeus::Hydra.new(max_concurrency: max_concurrency)
|
110
117
|
end
|
111
118
|
|
112
119
|
# Set the `Authorization` header for subsequent requests.
|
@@ -122,89 +129,104 @@ module ESI
|
|
122
129
|
ESI_RETRY_EXCEPTIONS = [Errno::ETIMEDOUT, Timeout::Error, Faraday::TimeoutError, Faraday::ConnectionFailed,
|
123
130
|
Faraday::ParsingError, SocketError].freeze
|
124
131
|
|
132
|
+
attr_reader :hydra
|
133
|
+
|
125
134
|
def delete(path, params: {}, headers: {})
|
126
135
|
response = make_delete_request(path, params: params, headers: headers)
|
136
|
+
raise_error(response) unless response.success?
|
127
137
|
response.body
|
128
138
|
end
|
129
139
|
|
130
140
|
def get(path, params: {}, headers: {})
|
131
141
|
response = make_get_request(path, params: params, headers: headers)
|
142
|
+
raise_error(response) unless response.success?
|
132
143
|
|
133
|
-
|
144
|
+
response_headers = normalize_headers(response.headers)
|
145
|
+
return paginate(response, path, params, headers) if paginated?(response_headers)
|
134
146
|
|
135
147
|
response.body
|
136
148
|
end
|
137
149
|
|
138
|
-
def post(path, payload: {}, headers: {})
|
139
|
-
response = make_post_request(path, payload: payload, headers: headers)
|
150
|
+
def post(path, payload: {}, params: {}, headers: {})
|
151
|
+
response = make_post_request(path, payload: payload, params: params, headers: headers)
|
152
|
+
raise_error(response) unless response.success?
|
140
153
|
response.body
|
141
154
|
end
|
142
155
|
|
143
|
-
def put(path, payload: {}, headers: {})
|
144
|
-
response = make_put_request(path, payload: payload, headers: headers)
|
156
|
+
def put(path, payload: {}, params: {}, headers: {})
|
157
|
+
response = make_put_request(path, payload: payload, params: params, headers: headers)
|
158
|
+
raise_error(response) unless response.success?
|
145
159
|
response.body
|
146
160
|
end
|
147
161
|
|
148
|
-
def paginate(response, params, headers)
|
162
|
+
def paginate(response, path, params, headers) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
149
163
|
all_items = response.body
|
150
|
-
|
151
|
-
page_count.
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
164
|
+
response_headers = normalize_headers(response.headers)
|
165
|
+
page_count = response_headers["x-pages"].to_i - 1
|
166
|
+
|
167
|
+
responses = []
|
168
|
+
url_encoded_connection.in_parallel(hydra) do
|
169
|
+
page_count.times do |n|
|
170
|
+
page_number = n + 2
|
171
|
+
params = params.merge(page: page_number)
|
172
|
+
responses << make_get_request(path, params: params, headers: headers)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
unless responses.all?(&:success?)
|
176
|
+
raise ESI::Errors::PaginationError.new("Error paginating request", response: response,
|
177
|
+
responses: responses)
|
156
178
|
end
|
157
179
|
|
158
|
-
all_items
|
180
|
+
all_items + responses.map(&:body).flatten
|
159
181
|
end
|
160
182
|
|
161
183
|
def make_delete_request(path, params: {}, headers: {})
|
162
|
-
|
163
|
-
|
164
|
-
raise_error(res) unless res.success?
|
165
|
-
|
166
|
-
res
|
184
|
+
params.delete_if { |_, v| v.nil? }
|
185
|
+
url_encoded_connection.delete("/#{version}#{path}", params, headers)
|
167
186
|
end
|
168
187
|
|
169
188
|
def make_get_request(path, params: {}, headers: {})
|
170
|
-
|
171
|
-
|
172
|
-
raise_error(res) unless res.success?
|
173
|
-
|
174
|
-
res
|
189
|
+
params.delete_if { |_, v| v.nil? }
|
190
|
+
url_encoded_connection.get("/#{version}#{path}", params, headers)
|
175
191
|
end
|
176
192
|
|
177
|
-
def make_post_request(path, payload: {}, headers: {})
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
193
|
+
def make_post_request(path, payload: {}, params: {}, headers: {})
|
194
|
+
params.delete_if { |_, v| v.nil? }
|
195
|
+
json_encoded_connection.post("/#{version}#{path}") do |req|
|
196
|
+
req.params = params
|
197
|
+
req.headers = req.headers.merge(headers)
|
198
|
+
req.body = payload.to_json
|
199
|
+
end
|
183
200
|
end
|
184
201
|
|
185
|
-
def make_put_request(path, payload: {}, headers: {})
|
186
|
-
|
187
|
-
|
188
|
-
|
202
|
+
def make_put_request(path, payload: {}, params: {}, headers: {})
|
203
|
+
params.delete_if { |_, v| v.nil? }
|
204
|
+
json_encoded_connection.put("/#{version}#{path}") do |req|
|
205
|
+
req.params = params
|
206
|
+
req.headers = req.headers.merge(headers)
|
207
|
+
req.body = payload.to_json
|
208
|
+
end
|
209
|
+
end
|
189
210
|
|
190
|
-
|
211
|
+
def paginated?(headers)
|
212
|
+
headers["x-pages"] && headers["x-pages"].to_i > 1
|
191
213
|
end
|
192
214
|
|
193
|
-
def
|
194
|
-
|
215
|
+
def normalize_headers(headers)
|
216
|
+
headers.transform_keys(&:downcase)
|
195
217
|
end
|
196
218
|
|
197
219
|
def raise_error(res)
|
198
|
-
raise (ERROR_MAPPING[res.status] ||
|
220
|
+
raise (ERROR_MAPPING[res.status] || ESI::Errors::ClientError).new("(#{res.status}) #{res["error"]}",
|
221
|
+
response: res)
|
199
222
|
end
|
200
223
|
|
201
224
|
def url_encoded_connection
|
202
225
|
@url_encoded_connection ||= Faraday.new(base_url, headers: default_headers) do |f|
|
203
226
|
f.use :http_cache, **cache unless cache.empty?
|
204
|
-
f.request :
|
205
|
-
f.request :retry, { exceptions: ESI_RETRY_EXCEPTIONS }
|
206
|
-
f.response :follow_redirects
|
227
|
+
f.request :retry, { exceptions: ESI_RETRY_EXCEPTIONS, max: 10, retry_statuses: [502, 503, 504] }
|
207
228
|
f.response :json
|
229
|
+
f.adapter :typhoeus
|
208
230
|
end
|
209
231
|
end
|
210
232
|
|
@@ -212,14 +234,14 @@ module ESI
|
|
212
234
|
@json_encoded_connection ||= Faraday.new(base_url, headers: default_headers) do |f|
|
213
235
|
f.use :http_cache, **cache unless cache.empty?
|
214
236
|
f.request :json
|
215
|
-
f.request :retry, { exceptions: ESI_RETRY_EXCEPTIONS }
|
216
|
-
f.response :follow_redirects
|
237
|
+
f.request :retry, { exceptions: ESI_RETRY_EXCEPTIONS, max: 10, retry_statuses: [502, 503, 504] }
|
217
238
|
f.response :json
|
239
|
+
f.adapter :typhoeus
|
218
240
|
end
|
219
241
|
end
|
220
242
|
|
221
243
|
def default_headers
|
222
|
-
{ "User-Agent": user_agent }
|
244
|
+
{ "User-Agent": user_agent, Accept: "application/json" }
|
223
245
|
end
|
224
246
|
end
|
225
247
|
end
|
data/lib/esi/client/alliance.rb
CHANGED
@@ -13,7 +13,7 @@ module ESI
|
|
13
13
|
# @esi_version v3
|
14
14
|
# @esi_version v4
|
15
15
|
#
|
16
|
-
# @param alliance_id [Integer
|
16
|
+
# @param alliance_id [Integer] An EVE alliance ID
|
17
17
|
# @param params [Hash] Additional query string parameters
|
18
18
|
# @param headers [Hash] Additional headers
|
19
19
|
#
|
@@ -25,7 +25,7 @@ module ESI
|
|
25
25
|
# @raise [ESI::Errors::GatewayTimeoutError] Gateway timeout
|
26
26
|
#
|
27
27
|
# @see https://esi.evetech.net/ui/#/Alliance/get_alliances_alliance_id
|
28
|
-
def get_alliance(alliance_id:,
|
28
|
+
def get_alliance(alliance_id:, headers: {}, params: {})
|
29
29
|
get("/alliances/#{alliance_id}/", headers: headers, params: params)
|
30
30
|
end
|
31
31
|
alias get_alliances_alliance_id get_alliance
|
@@ -39,7 +39,7 @@ module ESI
|
|
39
39
|
# @esi_version v1
|
40
40
|
# @esi_version v2
|
41
41
|
#
|
42
|
-
# @param alliance_id [Integer
|
42
|
+
# @param alliance_id [Integer] An EVE alliance ID
|
43
43
|
# @param params [Hash] Additional query string parameters
|
44
44
|
# @param headers [Hash] Additional headers
|
45
45
|
#
|
@@ -50,7 +50,7 @@ module ESI
|
|
50
50
|
# @raise [ESI::Errors::GatewayTimeoutError] Gateway timeout
|
51
51
|
#
|
52
52
|
# @see https://esi.evetech.net/ui/#/Alliance/get_alliances_alliance_id_corporations
|
53
|
-
def get_alliance_corporations(alliance_id:,
|
53
|
+
def get_alliance_corporations(alliance_id:, headers: {}, params: {})
|
54
54
|
get("/alliances/#{alliance_id}/corporations/", headers: headers, params: params)
|
55
55
|
end
|
56
56
|
alias get_alliances_alliance_id_corporations get_alliance_corporations
|
@@ -60,7 +60,7 @@ module ESI
|
|
60
60
|
# @esi_version legacy
|
61
61
|
# @esi_version v1
|
62
62
|
#
|
63
|
-
# @param alliance_id [Integer
|
63
|
+
# @param alliance_id [Integer] An EVE alliance ID
|
64
64
|
# @param params [Hash] Additional query string parameters
|
65
65
|
# @param headers [Hash] Additional headers
|
66
66
|
#
|
@@ -72,7 +72,7 @@ module ESI
|
|
72
72
|
# @raise [ESI::Errors::GatewayTimeoutError] Gateway timeout
|
73
73
|
#
|
74
74
|
# @see https://esi.evetech.net/ui/#/Alliance/get_alliances_alliance_id_icons
|
75
|
-
def get_alliance_icons(alliance_id:,
|
75
|
+
def get_alliance_icons(alliance_id:, headers: {}, params: {})
|
76
76
|
get("/alliances/#{alliance_id}/icons/", headers: headers, params: params)
|
77
77
|
end
|
78
78
|
alias get_alliances_alliance_id_icons get_alliance_icons
|
@@ -96,7 +96,7 @@ module ESI
|
|
96
96
|
# @raise [ESI::Errors::GatewayTimeoutError] Gateway timeout
|
97
97
|
#
|
98
98
|
# @see https://esi.evetech.net/ui/#/Alliance/get_alliances
|
99
|
-
def get_alliances(
|
99
|
+
def get_alliances(headers: {}, params: {})
|
100
100
|
get("/alliances/", headers: headers, params: params)
|
101
101
|
end
|
102
102
|
end
|