esi-sdk 2.1.3 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -8
- data/.yardext.rb +5 -5
- data/CHANGELOG.md +21 -0
- data/Gemfile +15 -15
- data/Gemfile.lock +10 -6
- data/Rakefile +105 -138
- data/bin/console +3 -3
- data/esi-sdk.gemspec +18 -17
- data/exe/esi-sdk +1 -1
- data/lib/esi/client/alliance.rb +5 -5
- data/lib/esi/client/assets.rb +4 -4
- data/lib/esi/client/calendar.rb +5 -5
- data/lib/esi/client/character.rb +16 -14
- data/lib/esi/client/clones.rb +2 -2
- data/lib/esi/client/contacts.rb +9 -9
- data/lib/esi/client/contracts.rb +3 -3
- data/lib/esi/client/corporation.rb +15 -15
- data/lib/esi/client/dogma.rb +7 -7
- data/lib/esi/client/faction_warfare.rb +14 -14
- data/lib/esi/client/fittings.rb +3 -3
- data/lib/esi/client/fleets.rb +14 -14
- data/lib/esi/client/incursions.rb +2 -2
- data/lib/esi/client/industry.rb +8 -8
- data/lib/esi/client/insurance.rb +2 -2
- data/lib/esi/client/killmails.rb +1 -1
- data/lib/esi/client/location.rb +3 -3
- data/lib/esi/client/loyalty.rb +2 -2
- data/lib/esi/client/mail.rb +8 -8
- data/lib/esi/client/market.rb +12 -12
- data/lib/esi/client/opportunities.rb +7 -7
- data/lib/esi/client/planetary_interaction.rb +3 -3
- data/lib/esi/client/routes.rb +4 -4
- data/lib/esi/client/search.rb +5 -5
- data/lib/esi/client/skills.rb +3 -3
- data/lib/esi/client/sovereignty.rb +6 -6
- data/lib/esi/client/status.rb +2 -2
- data/lib/esi/client/universe.rb +45 -45
- data/lib/esi/client/user_interface.rb +14 -14
- data/lib/esi/client/wallet.rb +6 -6
- data/lib/esi/client/wars.rb +4 -4
- data/lib/esi/client.rb +116 -87
- data/lib/esi/version.rb +1 -1
- data/lib/esi-sdk.rb +2 -2
- metadata +22 -8
@@ -30,7 +30,7 @@ module ESI
|
|
30
30
|
#
|
31
31
|
# @see https://esi.evetech.net/ui/#/User Interface/post_ui_autopilot_waypoint
|
32
32
|
def post_ui_autopilot_waypoint(add_to_beginning:, clear_other_waypoints:, destination_id:, headers: {}, params: {})
|
33
|
-
post_ui_autopilot_waypoint_raw(add_to_beginning: add_to_beginning, clear_other_waypoints: clear_other_waypoints, destination_id: destination_id, headers: headers, params: params)
|
33
|
+
parse_response(post_ui_autopilot_waypoint_raw(add_to_beginning: add_to_beginning, clear_other_waypoints: clear_other_waypoints, destination_id: destination_id, headers: headers, params: params))
|
34
34
|
end
|
35
35
|
|
36
36
|
# Set a solar system as autopilot waypoint.
|
@@ -59,8 +59,8 @@ module ESI
|
|
59
59
|
#
|
60
60
|
# @see https://esi.evetech.net/ui/#/User Interface/post_ui_autopilot_waypoint
|
61
61
|
def post_ui_autopilot_waypoint_raw(add_to_beginning:, clear_other_waypoints:, destination_id:, headers: {}, params: {})
|
62
|
-
params.merge!(
|
63
|
-
post(
|
62
|
+
params.merge!('add_to_beginning' => add_to_beginning, 'clear_other_waypoints' => clear_other_waypoints, 'destination_id' => destination_id)
|
63
|
+
post('/ui/autopilot/waypoint/', headers: headers, params: params)
|
64
64
|
end
|
65
65
|
|
66
66
|
# Open the contract window inside the client.
|
@@ -87,7 +87,7 @@ module ESI
|
|
87
87
|
#
|
88
88
|
# @see https://esi.evetech.net/ui/#/User Interface/post_ui_openwindow_contract
|
89
89
|
def post_ui_openwindow_contract(contract_id:, headers: {}, params: {})
|
90
|
-
post_ui_openwindow_contract_raw(contract_id: contract_id, headers: headers, params: params)
|
90
|
+
parse_response(post_ui_openwindow_contract_raw(contract_id: contract_id, headers: headers, params: params))
|
91
91
|
end
|
92
92
|
|
93
93
|
# Open the contract window inside the client.
|
@@ -114,8 +114,8 @@ module ESI
|
|
114
114
|
#
|
115
115
|
# @see https://esi.evetech.net/ui/#/User Interface/post_ui_openwindow_contract
|
116
116
|
def post_ui_openwindow_contract_raw(contract_id:, headers: {}, params: {})
|
117
|
-
params.merge!(
|
118
|
-
post(
|
117
|
+
params.merge!('contract_id' => contract_id)
|
118
|
+
post('/ui/openwindow/contract/', headers: headers, params: params)
|
119
119
|
end
|
120
120
|
|
121
121
|
# Open the information window for a character, corporation or alliance inside the client.
|
@@ -142,7 +142,7 @@ module ESI
|
|
142
142
|
#
|
143
143
|
# @see https://esi.evetech.net/ui/#/User Interface/post_ui_openwindow_information
|
144
144
|
def post_ui_openwindow_information(target_id:, headers: {}, params: {})
|
145
|
-
post_ui_openwindow_information_raw(target_id: target_id, headers: headers, params: params)
|
145
|
+
parse_response(post_ui_openwindow_information_raw(target_id: target_id, headers: headers, params: params))
|
146
146
|
end
|
147
147
|
|
148
148
|
# Open the information window for a character, corporation or alliance inside the client.
|
@@ -169,8 +169,8 @@ module ESI
|
|
169
169
|
#
|
170
170
|
# @see https://esi.evetech.net/ui/#/User Interface/post_ui_openwindow_information
|
171
171
|
def post_ui_openwindow_information_raw(target_id:, headers: {}, params: {})
|
172
|
-
params.merge!(
|
173
|
-
post(
|
172
|
+
params.merge!('target_id' => target_id)
|
173
|
+
post('/ui/openwindow/information/', headers: headers, params: params)
|
174
174
|
end
|
175
175
|
|
176
176
|
# Open the market details window for a specific typeID inside the client.
|
@@ -197,7 +197,7 @@ module ESI
|
|
197
197
|
#
|
198
198
|
# @see https://esi.evetech.net/ui/#/User Interface/post_ui_openwindow_marketdetails
|
199
199
|
def post_ui_openwindow_marketdetails(type_id:, headers: {}, params: {})
|
200
|
-
post_ui_openwindow_marketdetails_raw(type_id: type_id, headers: headers, params: params)
|
200
|
+
parse_response(post_ui_openwindow_marketdetails_raw(type_id: type_id, headers: headers, params: params))
|
201
201
|
end
|
202
202
|
|
203
203
|
# Open the market details window for a specific typeID inside the client.
|
@@ -224,8 +224,8 @@ module ESI
|
|
224
224
|
#
|
225
225
|
# @see https://esi.evetech.net/ui/#/User Interface/post_ui_openwindow_marketdetails
|
226
226
|
def post_ui_openwindow_marketdetails_raw(type_id:, headers: {}, params: {})
|
227
|
-
params.merge!(
|
228
|
-
post(
|
227
|
+
params.merge!('type_id' => type_id)
|
228
|
+
post('/ui/openwindow/marketdetails/', headers: headers, params: params)
|
229
229
|
end
|
230
230
|
|
231
231
|
# Open the New Mail window, according to settings from the request if applicable.
|
@@ -253,7 +253,7 @@ module ESI
|
|
253
253
|
#
|
254
254
|
# @see https://esi.evetech.net/ui/#/User Interface/post_ui_openwindow_newmail
|
255
255
|
def post_ui_openwindow_newmail(new_mail:, headers: {}, params: {})
|
256
|
-
post_ui_openwindow_newmail_raw(new_mail: new_mail, headers: headers, params: params)
|
256
|
+
parse_response(post_ui_openwindow_newmail_raw(new_mail: new_mail, headers: headers, params: params))
|
257
257
|
end
|
258
258
|
|
259
259
|
# Open the New Mail window, according to settings from the request if applicable.
|
@@ -281,7 +281,7 @@ module ESI
|
|
281
281
|
#
|
282
282
|
# @see https://esi.evetech.net/ui/#/User Interface/post_ui_openwindow_newmail
|
283
283
|
def post_ui_openwindow_newmail_raw(new_mail:, headers: {}, params: {})
|
284
|
-
post(
|
284
|
+
post('/ui/openwindow/newmail/', headers: headers, params: params, payload: new_mail)
|
285
285
|
end
|
286
286
|
end
|
287
287
|
end
|
data/lib/esi/client/wallet.rb
CHANGED
@@ -29,7 +29,7 @@ module ESI
|
|
29
29
|
#
|
30
30
|
# @see https://esi.evetech.net/ui/#/Wallet/get_characters_character_id_wallet
|
31
31
|
def get_character_wallet(character_id:, headers: {}, params: {})
|
32
|
-
get_character_wallet_raw(character_id: character_id, headers: headers, params: params)
|
32
|
+
parse_response(get_character_wallet_raw(character_id: character_id, headers: headers, params: params))
|
33
33
|
end
|
34
34
|
alias get_characters_character_id_wallet get_character_wallet
|
35
35
|
|
@@ -145,7 +145,7 @@ module ESI
|
|
145
145
|
#
|
146
146
|
# @see https://esi.evetech.net/ui/#/Wallet/get_characters_character_id_wallet_transactions
|
147
147
|
def get_character_wallet_transactions(character_id:, from_id: nil, headers: {}, params: {})
|
148
|
-
get_character_wallet_transactions_raw(character_id: character_id, from_id: from_id, headers: headers, params: params)
|
148
|
+
parse_response(get_character_wallet_transactions_raw(character_id: character_id, from_id: from_id, headers: headers, params: params))
|
149
149
|
end
|
150
150
|
alias get_characters_character_id_wallet_transactions get_character_wallet_transactions
|
151
151
|
|
@@ -176,7 +176,7 @@ module ESI
|
|
176
176
|
#
|
177
177
|
# @see https://esi.evetech.net/ui/#/Wallet/get_characters_character_id_wallet_transactions
|
178
178
|
def get_character_wallet_transactions_raw(character_id:, from_id: nil, headers: {}, params: {})
|
179
|
-
params.merge!(
|
179
|
+
params.merge!('from_id' => from_id)
|
180
180
|
get("/characters/#{character_id}/wallet/transactions/", headers: headers, params: params)
|
181
181
|
end
|
182
182
|
|
@@ -206,7 +206,7 @@ module ESI
|
|
206
206
|
#
|
207
207
|
# @see https://esi.evetech.net/ui/#/Wallet/get_corporations_corporation_id_wallets
|
208
208
|
def get_corporation_wallets(corporation_id:, headers: {}, params: {})
|
209
|
-
get_corporation_wallets_raw(corporation_id: corporation_id, headers: headers, params: params)
|
209
|
+
parse_response(get_corporation_wallets_raw(corporation_id: corporation_id, headers: headers, params: params))
|
210
210
|
end
|
211
211
|
alias get_corporations_corporation_id_wallets get_corporation_wallets
|
212
212
|
|
@@ -326,7 +326,7 @@ module ESI
|
|
326
326
|
#
|
327
327
|
# @see https://esi.evetech.net/ui/#/Wallet/get_corporations_corporation_id_wallets_division_transactions
|
328
328
|
def get_corporation_wallets_division_transactions(corporation_id:, division:, from_id: nil, headers: {}, params: {})
|
329
|
-
get_corporation_wallets_division_transactions_raw(corporation_id: corporation_id, division: division, from_id: from_id, headers: headers, params: params)
|
329
|
+
parse_response(get_corporation_wallets_division_transactions_raw(corporation_id: corporation_id, division: division, from_id: from_id, headers: headers, params: params))
|
330
330
|
end
|
331
331
|
alias get_corporations_corporation_id_wallets_division_transactions get_corporation_wallets_division_transactions
|
332
332
|
|
@@ -358,7 +358,7 @@ module ESI
|
|
358
358
|
#
|
359
359
|
# @see https://esi.evetech.net/ui/#/Wallet/get_corporations_corporation_id_wallets_division_transactions
|
360
360
|
def get_corporation_wallets_division_transactions_raw(corporation_id:, division:, from_id: nil, headers: {}, params: {})
|
361
|
-
params.merge!(
|
361
|
+
params.merge!('from_id' => from_id)
|
362
362
|
get("/corporations/#{corporation_id}/wallets/#{division}/transactions/", headers: headers, params: params)
|
363
363
|
end
|
364
364
|
end
|
data/lib/esi/client/wars.rb
CHANGED
@@ -25,7 +25,7 @@ module ESI
|
|
25
25
|
#
|
26
26
|
# @see https://esi.evetech.net/ui/#/Wars/get_wars_war_id
|
27
27
|
def get_war(war_id:, headers: {}, params: {})
|
28
|
-
get_war_raw(war_id: war_id, headers: headers, params: params)
|
28
|
+
parse_response(get_war_raw(war_id: war_id, headers: headers, params: params))
|
29
29
|
end
|
30
30
|
alias get_wars_war_id get_war
|
31
31
|
|
@@ -122,7 +122,7 @@ module ESI
|
|
122
122
|
#
|
123
123
|
# @see https://esi.evetech.net/ui/#/Wars/get_wars
|
124
124
|
def get_wars(max_war_id: nil, headers: {}, params: {})
|
125
|
-
get_wars_raw(max_war_id: max_war_id, headers: headers, params: params)
|
125
|
+
parse_response(get_wars_raw(max_war_id: max_war_id, headers: headers, params: params))
|
126
126
|
end
|
127
127
|
|
128
128
|
# Return a list of wars.
|
@@ -145,8 +145,8 @@ module ESI
|
|
145
145
|
#
|
146
146
|
# @see https://esi.evetech.net/ui/#/Wars/get_wars
|
147
147
|
def get_wars_raw(max_war_id: nil, headers: {}, params: {})
|
148
|
-
params.merge!(
|
149
|
-
get(
|
148
|
+
params.merge!('max_war_id' => max_war_id)
|
149
|
+
get('/wars/', headers: headers, params: params)
|
150
150
|
end
|
151
151
|
end
|
152
152
|
end
|
data/lib/esi/client.rb
CHANGED
@@ -1,41 +1,43 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
require_relative
|
9
|
-
require_relative
|
10
|
-
require_relative
|
11
|
-
require_relative
|
12
|
-
require_relative
|
13
|
-
require_relative
|
14
|
-
require_relative
|
15
|
-
require_relative
|
16
|
-
require_relative
|
17
|
-
require_relative
|
18
|
-
require_relative
|
19
|
-
require_relative
|
20
|
-
require_relative
|
21
|
-
require_relative
|
22
|
-
require_relative
|
23
|
-
require_relative
|
24
|
-
require_relative
|
25
|
-
require_relative
|
26
|
-
require_relative
|
27
|
-
require_relative
|
28
|
-
require_relative
|
29
|
-
require_relative
|
30
|
-
require_relative
|
31
|
-
require_relative
|
32
|
-
require_relative
|
33
|
-
require_relative
|
34
|
-
require_relative
|
35
|
-
require_relative
|
36
|
-
require_relative
|
37
|
-
require_relative
|
38
|
-
require_relative
|
3
|
+
require 'typhoeus'
|
4
|
+
require 'oj'
|
5
|
+
require 'retriable'
|
6
|
+
require 'timeout'
|
7
|
+
|
8
|
+
require_relative './errors'
|
9
|
+
require_relative './client/alliance'
|
10
|
+
require_relative './client/contacts'
|
11
|
+
require_relative './client/character'
|
12
|
+
require_relative './client/assets'
|
13
|
+
require_relative './client/skills'
|
14
|
+
require_relative './client/bookmarks'
|
15
|
+
require_relative './client/calendar'
|
16
|
+
require_relative './client/clones'
|
17
|
+
require_relative './client/contracts'
|
18
|
+
require_relative './client/fittings'
|
19
|
+
require_relative './client/fleets'
|
20
|
+
require_relative './client/faction_warfare'
|
21
|
+
require_relative './client/industry'
|
22
|
+
require_relative './client/killmails'
|
23
|
+
require_relative './client/location'
|
24
|
+
require_relative './client/loyalty'
|
25
|
+
require_relative './client/mail'
|
26
|
+
require_relative './client/opportunities'
|
27
|
+
require_relative './client/market'
|
28
|
+
require_relative './client/planetary_interaction'
|
29
|
+
require_relative './client/search'
|
30
|
+
require_relative './client/wallet'
|
31
|
+
require_relative './client/corporation'
|
32
|
+
require_relative './client/dogma'
|
33
|
+
require_relative './client/incursions'
|
34
|
+
require_relative './client/insurance'
|
35
|
+
require_relative './client/routes'
|
36
|
+
require_relative './client/sovereignty'
|
37
|
+
require_relative './client/status'
|
38
|
+
require_relative './client/user_interface'
|
39
|
+
require_relative './client/universe'
|
40
|
+
require_relative './client/wars'
|
39
41
|
|
40
42
|
module ESI
|
41
43
|
# Client for the EVE Swagger Interface (ESI) API.
|
@@ -73,8 +75,8 @@ module ESI
|
|
73
75
|
include ESI::Client::Universe
|
74
76
|
include ESI::Client::War
|
75
77
|
|
76
|
-
DEFAULT_BASE_URL =
|
77
|
-
DEFAULT_VERSION =
|
78
|
+
DEFAULT_BASE_URL = 'https://esi.evetech.net'
|
79
|
+
DEFAULT_VERSION = 'latest'
|
78
80
|
|
79
81
|
ERROR_MAPPING = {
|
80
82
|
400 => ESI::Errors::BadRequestError,
|
@@ -89,38 +91,26 @@ module ESI
|
|
89
91
|
520 => ESI::Errors::EveServerError
|
90
92
|
}.freeze
|
91
93
|
|
92
|
-
attr_reader :base_url, :
|
94
|
+
attr_reader :base_url, :user_agent, :version, :authorization_token, :retries
|
93
95
|
|
94
96
|
# Returns a new {ESI::Client}.
|
95
97
|
#
|
96
|
-
# See the [faraday-http-cache](https://github.com/sourcelevel/faraday-http-cache) documentation for information on
|
97
|
-
# how to set up caching via the `cache` parameter.
|
98
|
-
#
|
99
98
|
# @param user_agent [String] Value of the `User-Agent` header for HTTP calls
|
100
99
|
# @param base_url [String] The base URL of the ESI API
|
101
100
|
# @param version [String] The version of the ESI API
|
102
|
-
# @param
|
103
|
-
|
104
|
-
# @option cache [Object] :store The cache store (e.g. `Rails.cache`)
|
105
|
-
# @option cache [Object] :logger The logger (e.g. `Rails.logger`)
|
106
|
-
# @option cache [Object] :instrumenter The instrumenter (e.g. `ActiveSupport::Notifications`)
|
107
|
-
# @param instrumentation [Hash] The instrumentation configuration to use
|
108
|
-
# @option instrumentation [String] :name The name to use for instrumentation
|
109
|
-
# @option instrumentation [Object] :instrumenter The instrumenter to use (e.g. `ActiveSupport::Notifications`)
|
110
|
-
def initialize(user_agent:, base_url: DEFAULT_BASE_URL, version: DEFAULT_VERSION, cache: {}, instrumentation: {}, logger: nil) # rubocop:disable Layout/LineLength, Metrics/ParameterLists
|
101
|
+
# @param retries [Integer] Number of times to try a request before raising an error.
|
102
|
+
def initialize(user_agent:, base_url: DEFAULT_BASE_URL, version: DEFAULT_VERSION, retries: 10)
|
111
103
|
@base_url = base_url
|
112
|
-
@cache = cache
|
113
|
-
@instrumentation = instrumentation
|
114
104
|
@user_agent = user_agent
|
115
105
|
@version = version
|
116
|
-
@
|
106
|
+
@retries = retries
|
117
107
|
end
|
118
108
|
|
119
109
|
# Set the `Authorization` header for subsequent requests.
|
120
110
|
#
|
121
111
|
# @param token [String] The [EVE SSO JWT token](https://docs.esi.evetech.net/docs/sso/) to use
|
122
|
-
def authorize(
|
123
|
-
|
112
|
+
def authorize(_token)
|
113
|
+
@authorization_token = authorization_token
|
124
114
|
end
|
125
115
|
|
126
116
|
# Make a `DELETE` request to the ESI endpoint.
|
@@ -163,64 +153,103 @@ module ESI
|
|
163
153
|
|
164
154
|
private
|
165
155
|
|
166
|
-
|
156
|
+
RETRIABLE_ERRORS = [
|
157
|
+
ESI::Errors::ErrorLimitedError,
|
158
|
+
ESI::Errors::InternalServerError,
|
159
|
+
ESI::Errors::ServiceUnavailableError,
|
160
|
+
ESI::Errors::GatewayTimeoutError,
|
161
|
+
ESI::Errors::EveServerError
|
162
|
+
].freeze
|
163
|
+
|
164
|
+
def make_request(method, path, params: {}, headers: {}, payload: nil) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
165
|
+
headers.merge!(Authorization: "Bearer #{authorization_token}") if authorization_token
|
167
166
|
versioned_path = "/#{version}#{path}"
|
168
|
-
|
169
|
-
|
167
|
+
url = "#{base_url}#{versioned_path}"
|
168
|
+
json = payload ? Oj.dump(payload) : nil
|
169
|
+
request = Typhoeus::Request.new(url, method: method, params: params, headers: headers, body: json)
|
170
|
+
request.on_complete { |response| raise_error(response) unless response.success? }
|
171
|
+
|
172
|
+
hydra.queue(request)
|
173
|
+
|
174
|
+
with_retries(on_retry: ->(*_) { hydra.queue(request) }) { hydra.run }
|
170
175
|
|
171
|
-
|
176
|
+
response = request.response
|
177
|
+
|
178
|
+
return paginate(response, url, params, headers) if paginated?(response)
|
172
179
|
|
173
180
|
response
|
174
|
-
rescue HTTPX::Error
|
175
|
-
raise_error(response)
|
176
181
|
end
|
177
182
|
|
178
|
-
def paginate(
|
179
|
-
response_headers = normalize_headers(
|
180
|
-
page_count = response_headers[
|
181
|
-
|
182
|
-
|
183
|
-
|
183
|
+
def paginate(orig_response, url, params, headers) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
184
|
+
response_headers = normalize_headers(orig_response.headers)
|
185
|
+
page_count = response_headers['x-pages'].to_i
|
186
|
+
pages = [orig_response]
|
187
|
+
|
188
|
+
return pages if page_count == 1
|
189
|
+
|
190
|
+
pending_pages = page_count.times.to_a.map { |n| n + 1 }[1..]
|
191
|
+
|
192
|
+
with_retries do
|
193
|
+
while pending_pages.any?
|
194
|
+
pending_pages.each do |page|
|
195
|
+
request = Typhoeus::Request.new(url, params: params.merge(page: page), headers: headers)
|
196
|
+
request.on_complete do |response|
|
197
|
+
raise_error(response) unless response.success?
|
198
|
+
|
199
|
+
pages << response
|
200
|
+
pending_pages.delete(page)
|
201
|
+
end
|
202
|
+
hydra.queue(request)
|
203
|
+
end
|
204
|
+
hydra.run
|
205
|
+
end
|
184
206
|
end
|
185
|
-
responses = requests.any? ? Array(session.request(*requests)) : []
|
186
|
-
responses.unshift(response)
|
187
207
|
|
188
|
-
|
189
|
-
|
190
|
-
end
|
208
|
+
pages.sort_by { |response| response.request.options[:params][:page].to_i }
|
209
|
+
end
|
191
210
|
|
192
|
-
|
211
|
+
def parse_response(response)
|
212
|
+
Oj.load(response.body, bigdecimal_load: :float)
|
193
213
|
end
|
194
214
|
|
195
215
|
def paginated?(response)
|
196
216
|
headers = normalize_headers(response.headers)
|
197
|
-
headers.key?(
|
217
|
+
headers.key?('x-pages')
|
198
218
|
end
|
199
219
|
|
200
220
|
def concat_responses(responses)
|
201
|
-
responses.map(
|
221
|
+
responses.map { |r| parse_response(r) }.reduce([], :concat)
|
202
222
|
end
|
203
223
|
|
204
224
|
def normalize_headers(headers)
|
205
225
|
headers.to_h.transform_keys(&:downcase)
|
206
226
|
end
|
207
227
|
|
208
|
-
def
|
209
|
-
|
210
|
-
|
228
|
+
def with_retries(opts = {}, &block)
|
229
|
+
Retriable.retriable(retry_options.merge(opts), &block)
|
230
|
+
end
|
231
|
+
|
232
|
+
def retry_options
|
233
|
+
{ on: RETRIABLE_ERRORS, tries: retries }
|
211
234
|
end
|
212
235
|
|
213
|
-
def
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
236
|
+
def raise_error(res)
|
237
|
+
json = begin
|
238
|
+
Oj.load(res.body)
|
239
|
+
rescue StandardError
|
240
|
+
res.body
|
241
|
+
end
|
242
|
+
|
243
|
+
raise (ERROR_MAPPING[res.code] || ESI::Errors::ClientError).new("(#{res.code}) #{json['error']}",
|
244
|
+
response: res)
|
220
245
|
end
|
221
246
|
|
222
247
|
def default_headers
|
223
|
-
{
|
248
|
+
{ 'User-Agent': user_agent, Accept: 'application/json' }
|
249
|
+
end
|
250
|
+
|
251
|
+
def hydra
|
252
|
+
@hydra ||= Typhoeus::Hydra.new
|
224
253
|
end
|
225
254
|
end
|
226
255
|
end
|
data/lib/esi/version.rb
CHANGED
data/lib/esi-sdk.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: esi-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bokobo Shahni
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: oj
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '3.13'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '3.13'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: retriable
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: typhoeus
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.4'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.4'
|
41
55
|
description: ESI SDK is a Ruby API client for the EVE Swagger Interface (ESI), the
|
42
56
|
official API for the EVE Online MMORPG.
|
43
57
|
email:
|
@@ -122,7 +136,7 @@ metadata:
|
|
122
136
|
homepage_uri: https://github.com/bokoboshahni/esi-sdk
|
123
137
|
source_code_uri: https://github.com/bokoboshahni/esi-sdk
|
124
138
|
changelog_uri: https://github.com/bokoboshahni/blob/main/CHANGELOG.md
|
125
|
-
post_install_message:
|
139
|
+
post_install_message:
|
126
140
|
rdoc_options: []
|
127
141
|
require_paths:
|
128
142
|
- lib
|
@@ -138,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
152
|
version: '0'
|
139
153
|
requirements: []
|
140
154
|
rubygems_version: 3.2.22
|
141
|
-
signing_key:
|
155
|
+
signing_key:
|
142
156
|
specification_version: 4
|
143
157
|
summary: API client for the EVE Swagger Interface (ESI)
|
144
158
|
test_files: []
|