esi-sdk 1.1.1
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 +7 -0
- data/.editorconfig +9 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +36 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.github/ISSUE_TEMPLATE/support.md +7 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +37 -0
- data/.github/dependabot.yml +17 -0
- data/.github/workflows/cicd.yml +181 -0
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/.rubocop.yml +36 -0
- data/.ruby-version +1 -0
- data/.yardext.rb +18 -0
- data/.yardopts +17 -0
- data/CHANGELOG.md +17 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/CONTRIBUTING.md +69 -0
- data/Gemfile +24 -0
- data/Gemfile.lock +141 -0
- data/LICENSE.txt +21 -0
- data/README.md +87 -0
- data/Rakefile +349 -0
- data/SECURITY.md +13 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/esi-sdk.gemspec +32 -0
- data/exe/esi-sdk +4 -0
- data/lib/esi/client/alliance.rb +104 -0
- data/lib/esi/client/assets.rb +179 -0
- data/lib/esi/client/bookmarks.rb +126 -0
- data/lib/esi/client/calendar.rb +139 -0
- data/lib/esi/client/character.rb +389 -0
- data/lib/esi/client/clones.rb +69 -0
- data/lib/esi/client/contacts.rb +277 -0
- data/lib/esi/client/contracts.rb +274 -0
- data/lib/esi/client/corporation.rb +626 -0
- data/lib/esi/client/dogma.rb +117 -0
- data/lib/esi/client/faction_warfare.rb +196 -0
- data/lib/esi/client/fittings.rb +93 -0
- data/lib/esi/client/fleets.rb +428 -0
- data/lib/esi/client/incursions.rb +30 -0
- data/lib/esi/client/industry.rb +237 -0
- data/lib/esi/client/insurance.rb +30 -0
- data/lib/esi/client/killmails.rb +95 -0
- data/lib/esi/client/location.rb +100 -0
- data/lib/esi/client/loyalty.rb +61 -0
- data/lib/esi/client/mail.rb +244 -0
- data/lib/esi/client/market.rb +302 -0
- data/lib/esi/client/opportunities.rb +124 -0
- data/lib/esi/client/planetary_interaction.rb +122 -0
- data/lib/esi/client/routes.rb +37 -0
- data/lib/esi/client/search.rb +68 -0
- data/lib/esi/client/skills.rb +97 -0
- data/lib/esi/client/sovereignty.rb +74 -0
- data/lib/esi/client/status.rb +31 -0
- data/lib/esi/client/universe.rb +640 -0
- data/lib/esi/client/user_interface.rb +145 -0
- data/lib/esi/client/wallet.rb +191 -0
- data/lib/esi/client/wars.rb +82 -0
- data/lib/esi/client.rb +225 -0
- data/lib/esi/errors.rb +51 -0
- data/lib/esi/version.rb +5 -0
- data/lib/esi-sdk.rb +8 -0
- data/release.config.js +32 -0
- data/yard/fulldoc/html/css/pygments-default.css +69 -0
- data/yard/fulldoc/html/setup.rb +6 -0
- data/yard/layout/html/setup.rb +6 -0
- metadata +156 -0
@@ -0,0 +1,145 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ESI
|
4
|
+
class Client
|
5
|
+
# ESI user interface operations.
|
6
|
+
module UserInterface
|
7
|
+
# Set a solar system as autopilot waypoint.
|
8
|
+
#
|
9
|
+
# This endpoint requires authorization (see {ESI::Client#authorize}).
|
10
|
+
#
|
11
|
+
# @esi_scope esi-ui.write_waypoint.v1
|
12
|
+
#
|
13
|
+
# @esi_version dev
|
14
|
+
# @esi_version legacy
|
15
|
+
# @esi_version v2
|
16
|
+
#
|
17
|
+
# @param add_to_beginning [Boolean] Whether this solar system should be added to the beginning of all waypoints
|
18
|
+
# @param clear_other_waypoints [Boolean] Whether clean other waypoints beforing adding this one
|
19
|
+
# @param destination_id [Integer] The destination to travel to, can be solar system, station or structure's id
|
20
|
+
# @param headers [Hash] Additional headers
|
21
|
+
#
|
22
|
+
# @raise [ESI::Errors::BadRequestError] Bad request
|
23
|
+
# @raise [ESI::Errors::UnauthorizedError] Unauthorized
|
24
|
+
# @raise [ESI::Errors::ForbiddenError] Forbidden
|
25
|
+
# @raise [ESI::Errors::ErrorLimitedError] Error limited
|
26
|
+
# @raise [ESI::Errors::InternalServerError] Internal server error
|
27
|
+
# @raise [ESI::Errors::ServiceUnavailableError] Service unavailable
|
28
|
+
# @raise [ESI::Errors::GatewayTimeoutError] Gateway timeout
|
29
|
+
#
|
30
|
+
# @see https://esi.evetech.net/ui/#/User Interface/post_ui_autopilot_waypoint
|
31
|
+
def post_ui_autopilot_waypoint(add_to_beginning:, clear_other_waypoints:, destination_id:, headers: {})
|
32
|
+
query_string = URI.encode_www_form([["add_to_beginning", add_to_beginning], ["clear_other_waypoints", clear_other_waypoints], ["destination_id", destination_id]])
|
33
|
+
post("/ui/autopilot/waypoint/?#{query_string}", headers: headers)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Open the contract window inside the client.
|
37
|
+
#
|
38
|
+
# This endpoint requires authorization (see {ESI::Client#authorize}).
|
39
|
+
#
|
40
|
+
# @esi_scope esi-ui.open_window.v1
|
41
|
+
#
|
42
|
+
# @esi_version dev
|
43
|
+
# @esi_version legacy
|
44
|
+
# @esi_version v1
|
45
|
+
#
|
46
|
+
# @param contract_id [Integer] The contract to open
|
47
|
+
# @param headers [Hash] Additional headers
|
48
|
+
#
|
49
|
+
# @raise [ESI::Errors::BadRequestError] Bad request
|
50
|
+
# @raise [ESI::Errors::UnauthorizedError] Unauthorized
|
51
|
+
# @raise [ESI::Errors::ForbiddenError] Forbidden
|
52
|
+
# @raise [ESI::Errors::ErrorLimitedError] Error limited
|
53
|
+
# @raise [ESI::Errors::InternalServerError] Internal server error
|
54
|
+
# @raise [ESI::Errors::ServiceUnavailableError] Service unavailable
|
55
|
+
# @raise [ESI::Errors::GatewayTimeoutError] Gateway timeout
|
56
|
+
#
|
57
|
+
# @see https://esi.evetech.net/ui/#/User Interface/post_ui_openwindow_contract
|
58
|
+
def post_ui_openwindow_contract(contract_id:, headers: {})
|
59
|
+
query_string = URI.encode_www_form([["contract_id", contract_id]])
|
60
|
+
post("/ui/openwindow/contract/?#{query_string}", headers: headers)
|
61
|
+
end
|
62
|
+
|
63
|
+
# Open the information window for a character, corporation or alliance inside the client.
|
64
|
+
#
|
65
|
+
# This endpoint requires authorization (see {ESI::Client#authorize}).
|
66
|
+
#
|
67
|
+
# @esi_scope esi-ui.open_window.v1
|
68
|
+
#
|
69
|
+
# @esi_version dev
|
70
|
+
# @esi_version legacy
|
71
|
+
# @esi_version v1
|
72
|
+
#
|
73
|
+
# @param target_id [Integer] The target to open
|
74
|
+
# @param headers [Hash] Additional headers
|
75
|
+
#
|
76
|
+
# @raise [ESI::Errors::BadRequestError] Bad request
|
77
|
+
# @raise [ESI::Errors::UnauthorizedError] Unauthorized
|
78
|
+
# @raise [ESI::Errors::ForbiddenError] Forbidden
|
79
|
+
# @raise [ESI::Errors::ErrorLimitedError] Error limited
|
80
|
+
# @raise [ESI::Errors::InternalServerError] Internal server error
|
81
|
+
# @raise [ESI::Errors::ServiceUnavailableError] Service unavailable
|
82
|
+
# @raise [ESI::Errors::GatewayTimeoutError] Gateway timeout
|
83
|
+
#
|
84
|
+
# @see https://esi.evetech.net/ui/#/User Interface/post_ui_openwindow_information
|
85
|
+
def post_ui_openwindow_information(target_id:, headers: {})
|
86
|
+
query_string = URI.encode_www_form([["target_id", target_id]])
|
87
|
+
post("/ui/openwindow/information/?#{query_string}", headers: headers)
|
88
|
+
end
|
89
|
+
|
90
|
+
# Open the market details window for a specific typeID inside the client.
|
91
|
+
#
|
92
|
+
# This endpoint requires authorization (see {ESI::Client#authorize}).
|
93
|
+
#
|
94
|
+
# @esi_scope esi-ui.open_window.v1
|
95
|
+
#
|
96
|
+
# @esi_version dev
|
97
|
+
# @esi_version legacy
|
98
|
+
# @esi_version v1
|
99
|
+
#
|
100
|
+
# @param type_id [Integer] The item type to open in market window
|
101
|
+
# @param headers [Hash] Additional headers
|
102
|
+
#
|
103
|
+
# @raise [ESI::Errors::BadRequestError] Bad request
|
104
|
+
# @raise [ESI::Errors::UnauthorizedError] Unauthorized
|
105
|
+
# @raise [ESI::Errors::ForbiddenError] Forbidden
|
106
|
+
# @raise [ESI::Errors::ErrorLimitedError] Error limited
|
107
|
+
# @raise [ESI::Errors::InternalServerError] Internal server error
|
108
|
+
# @raise [ESI::Errors::ServiceUnavailableError] Service unavailable
|
109
|
+
# @raise [ESI::Errors::GatewayTimeoutError] Gateway timeout
|
110
|
+
#
|
111
|
+
# @see https://esi.evetech.net/ui/#/User Interface/post_ui_openwindow_marketdetails
|
112
|
+
def post_ui_openwindow_marketdetails(type_id:, headers: {})
|
113
|
+
query_string = URI.encode_www_form([["type_id", type_id]])
|
114
|
+
post("/ui/openwindow/marketdetails/?#{query_string}", headers: headers)
|
115
|
+
end
|
116
|
+
|
117
|
+
# Open the New Mail window, according to settings from the request if applicable.
|
118
|
+
#
|
119
|
+
# This endpoint requires authorization (see {ESI::Client#authorize}).
|
120
|
+
#
|
121
|
+
# @esi_scope esi-ui.open_window.v1
|
122
|
+
#
|
123
|
+
# @esi_version dev
|
124
|
+
# @esi_version legacy
|
125
|
+
# @esi_version v1
|
126
|
+
#
|
127
|
+
# @param new_mail [Hash] The details of mail to create
|
128
|
+
# @param headers [Hash] Additional headers
|
129
|
+
#
|
130
|
+
# @raise [ESI::Errors::BadRequestError] Bad request
|
131
|
+
# @raise [ESI::Errors::UnauthorizedError] Unauthorized
|
132
|
+
# @raise [ESI::Errors::ForbiddenError] Forbidden
|
133
|
+
# @raise [ESI::Errors::ErrorLimitedError] Error limited
|
134
|
+
# @raise [ESI::Errors::UnprocessableEntityError] Invalid request
|
135
|
+
# @raise [ESI::Errors::InternalServerError] Internal server error
|
136
|
+
# @raise [ESI::Errors::ServiceUnavailableError] Service unavailable
|
137
|
+
# @raise [ESI::Errors::GatewayTimeoutError] Gateway timeout
|
138
|
+
#
|
139
|
+
# @see https://esi.evetech.net/ui/#/User Interface/post_ui_openwindow_newmail
|
140
|
+
def post_ui_openwindow_newmail(new_mail:, headers: {})
|
141
|
+
post("/ui/openwindow/newmail/", headers: headers, payload: new_mail)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
@@ -0,0 +1,191 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ESI
|
4
|
+
class Client
|
5
|
+
# ESI wallet operations.
|
6
|
+
module Wallet
|
7
|
+
# Returns a character's wallet balance.
|
8
|
+
#
|
9
|
+
# This endpoint is cached for up to 120 seconds.
|
10
|
+
#
|
11
|
+
# This endpoint requires authorization (see {ESI::Client#authorize}).
|
12
|
+
#
|
13
|
+
# @esi_scope esi-wallet.read_character_wallet.v1
|
14
|
+
#
|
15
|
+
# @esi_version legacy
|
16
|
+
# @esi_version v1
|
17
|
+
#
|
18
|
+
# @param character_id [Integer,String] An EVE character ID
|
19
|
+
# @param params [Hash] Additional query string parameters
|
20
|
+
# @param headers [Hash] Additional headers
|
21
|
+
#
|
22
|
+
# @raise [ESI::Errors::BadRequestError] Bad request
|
23
|
+
# @raise [ESI::Errors::UnauthorizedError] Unauthorized
|
24
|
+
# @raise [ESI::Errors::ForbiddenError] Forbidden
|
25
|
+
# @raise [ESI::Errors::ErrorLimitedError] Error limited
|
26
|
+
# @raise [ESI::Errors::InternalServerError] Internal server error
|
27
|
+
# @raise [ESI::Errors::ServiceUnavailableError] Service unavailable
|
28
|
+
# @raise [ESI::Errors::GatewayTimeoutError] Gateway timeout
|
29
|
+
#
|
30
|
+
# @see https://esi.evetech.net/ui/#/Wallet/get_characters_character_id_wallet
|
31
|
+
def get_character_wallet(character_id:, params: {}, headers: {})
|
32
|
+
get("/characters/#{character_id}/wallet/", headers: headers, params: params)
|
33
|
+
end
|
34
|
+
alias get_characters_character_id_wallet get_character_wallet
|
35
|
+
|
36
|
+
# Retrieve the given character's wallet journal going 30 days back.
|
37
|
+
#
|
38
|
+
# This endpoint is cached for up to 3600 seconds.
|
39
|
+
#
|
40
|
+
# This endpoint requires authorization (see {ESI::Client#authorize}).
|
41
|
+
#
|
42
|
+
# @esi_scope esi-wallet.read_character_wallet.v1
|
43
|
+
#
|
44
|
+
# @esi_version dev
|
45
|
+
# @esi_version v6
|
46
|
+
#
|
47
|
+
# @param character_id [Integer,String] An EVE character ID
|
48
|
+
# @param params [Hash] Additional query string parameters
|
49
|
+
# @param headers [Hash] Additional headers
|
50
|
+
#
|
51
|
+
# @raise [ESI::Errors::BadRequestError] Bad request
|
52
|
+
# @raise [ESI::Errors::UnauthorizedError] Unauthorized
|
53
|
+
# @raise [ESI::Errors::ForbiddenError] Forbidden
|
54
|
+
# @raise [ESI::Errors::ErrorLimitedError] Error limited
|
55
|
+
# @raise [ESI::Errors::InternalServerError] Internal server error
|
56
|
+
# @raise [ESI::Errors::ServiceUnavailableError] Service unavailable
|
57
|
+
# @raise [ESI::Errors::GatewayTimeoutError] Gateway timeout
|
58
|
+
#
|
59
|
+
# @see https://esi.evetech.net/ui/#/Wallet/get_characters_character_id_wallet_journal
|
60
|
+
def get_character_wallet_journal(character_id:, params: {}, headers: {})
|
61
|
+
get("/characters/#{character_id}/wallet/journal/", headers: headers, params: params)
|
62
|
+
end
|
63
|
+
alias get_characters_character_id_wallet_journal get_character_wallet_journal
|
64
|
+
|
65
|
+
# Get wallet transactions of a character.
|
66
|
+
#
|
67
|
+
# This endpoint is cached for up to 3600 seconds.
|
68
|
+
#
|
69
|
+
# This endpoint requires authorization (see {ESI::Client#authorize}).
|
70
|
+
#
|
71
|
+
# @esi_scope esi-wallet.read_character_wallet.v1
|
72
|
+
#
|
73
|
+
# @esi_version dev
|
74
|
+
# @esi_version legacy
|
75
|
+
# @esi_version v1
|
76
|
+
#
|
77
|
+
# @param character_id [Integer,String] An EVE character ID
|
78
|
+
# @param from_id [Integer] Only show transactions happened before the one referenced by this id
|
79
|
+
# @param params [Hash] Additional query string parameters
|
80
|
+
# @param headers [Hash] Additional headers
|
81
|
+
#
|
82
|
+
# @raise [ESI::Errors::BadRequestError] Bad request
|
83
|
+
# @raise [ESI::Errors::UnauthorizedError] Unauthorized
|
84
|
+
# @raise [ESI::Errors::ForbiddenError] Forbidden
|
85
|
+
# @raise [ESI::Errors::ErrorLimitedError] Error limited
|
86
|
+
# @raise [ESI::Errors::InternalServerError] Internal server error
|
87
|
+
# @raise [ESI::Errors::ServiceUnavailableError] Service unavailable
|
88
|
+
# @raise [ESI::Errors::GatewayTimeoutError] Gateway timeout
|
89
|
+
#
|
90
|
+
# @see https://esi.evetech.net/ui/#/Wallet/get_characters_character_id_wallet_transactions
|
91
|
+
def get_character_wallet_transactions(character_id:, from_id:, params: {}, headers: {})
|
92
|
+
query_string = URI.encode_www_form([["from_id", from_id]])
|
93
|
+
get("/characters/#{character_id}/wallet/transactions/?#{query_string}", headers: headers, params: params)
|
94
|
+
end
|
95
|
+
alias get_characters_character_id_wallet_transactions get_character_wallet_transactions
|
96
|
+
|
97
|
+
# Get a corporation's wallets.
|
98
|
+
#
|
99
|
+
# This endpoint is cached for up to 300 seconds.
|
100
|
+
#
|
101
|
+
# This endpoint requires authorization (see {ESI::Client#authorize}).
|
102
|
+
#
|
103
|
+
# @esi_scope esi-wallet.read_corporation_wallets.v1
|
104
|
+
#
|
105
|
+
# @esi_version dev
|
106
|
+
# @esi_version legacy
|
107
|
+
# @esi_version v1
|
108
|
+
#
|
109
|
+
# @param corporation_id [Integer,String] An EVE corporation ID
|
110
|
+
# @param params [Hash] Additional query string parameters
|
111
|
+
# @param headers [Hash] Additional headers
|
112
|
+
#
|
113
|
+
# @raise [ESI::Errors::BadRequestError] Bad request
|
114
|
+
# @raise [ESI::Errors::UnauthorizedError] Unauthorized
|
115
|
+
# @raise [ESI::Errors::ForbiddenError] Forbidden
|
116
|
+
# @raise [ESI::Errors::ErrorLimitedError] Error limited
|
117
|
+
# @raise [ESI::Errors::InternalServerError] Internal server error
|
118
|
+
# @raise [ESI::Errors::ServiceUnavailableError] Service unavailable
|
119
|
+
# @raise [ESI::Errors::GatewayTimeoutError] Gateway timeout
|
120
|
+
#
|
121
|
+
# @see https://esi.evetech.net/ui/#/Wallet/get_corporations_corporation_id_wallets
|
122
|
+
def get_corporation_wallets(corporation_id:, params: {}, headers: {})
|
123
|
+
get("/corporations/#{corporation_id}/wallets/", headers: headers, params: params)
|
124
|
+
end
|
125
|
+
alias get_corporations_corporation_id_wallets get_corporation_wallets
|
126
|
+
|
127
|
+
# Retrieve the given corporation's wallet journal for the given division going 30 days back.
|
128
|
+
#
|
129
|
+
# This endpoint is cached for up to 3600 seconds.
|
130
|
+
#
|
131
|
+
# This endpoint requires authorization (see {ESI::Client#authorize}).
|
132
|
+
#
|
133
|
+
# @esi_scope esi-wallet.read_corporation_wallets.v1
|
134
|
+
#
|
135
|
+
# @esi_version dev
|
136
|
+
# @esi_version v4
|
137
|
+
#
|
138
|
+
# @param corporation_id [Integer,String] An EVE corporation ID
|
139
|
+
# @param division [Integer,String] Wallet key of the division to fetch journals from
|
140
|
+
# @param params [Hash] Additional query string parameters
|
141
|
+
# @param headers [Hash] Additional headers
|
142
|
+
#
|
143
|
+
# @raise [ESI::Errors::BadRequestError] Bad request
|
144
|
+
# @raise [ESI::Errors::UnauthorizedError] Unauthorized
|
145
|
+
# @raise [ESI::Errors::ForbiddenError] Forbidden
|
146
|
+
# @raise [ESI::Errors::ErrorLimitedError] Error limited
|
147
|
+
# @raise [ESI::Errors::InternalServerError] Internal server error
|
148
|
+
# @raise [ESI::Errors::ServiceUnavailableError] Service unavailable
|
149
|
+
# @raise [ESI::Errors::GatewayTimeoutError] Gateway timeout
|
150
|
+
#
|
151
|
+
# @see https://esi.evetech.net/ui/#/Wallet/get_corporations_corporation_id_wallets_division_journal
|
152
|
+
def get_corporation_wallets_division_journal(corporation_id:, division:, params: {}, headers: {})
|
153
|
+
get("/corporations/#{corporation_id}/wallets/#{division}/journal/", headers: headers, params: params)
|
154
|
+
end
|
155
|
+
alias get_corporations_corporation_id_wallets_division_journal get_corporation_wallets_division_journal
|
156
|
+
|
157
|
+
# Get wallet transactions of a corporation.
|
158
|
+
#
|
159
|
+
# This endpoint is cached for up to 3600 seconds.
|
160
|
+
#
|
161
|
+
# This endpoint requires authorization (see {ESI::Client#authorize}).
|
162
|
+
#
|
163
|
+
# @esi_scope esi-wallet.read_corporation_wallets.v1
|
164
|
+
#
|
165
|
+
# @esi_version dev
|
166
|
+
# @esi_version legacy
|
167
|
+
# @esi_version v1
|
168
|
+
#
|
169
|
+
# @param corporation_id [Integer,String] An EVE corporation ID
|
170
|
+
# @param division [Integer,String] Wallet key of the division to fetch journals from
|
171
|
+
# @param from_id [Integer] Only show journal entries happened before the transaction referenced by this id
|
172
|
+
# @param params [Hash] Additional query string parameters
|
173
|
+
# @param headers [Hash] Additional headers
|
174
|
+
#
|
175
|
+
# @raise [ESI::Errors::BadRequestError] Bad request
|
176
|
+
# @raise [ESI::Errors::UnauthorizedError] Unauthorized
|
177
|
+
# @raise [ESI::Errors::ForbiddenError] Forbidden
|
178
|
+
# @raise [ESI::Errors::ErrorLimitedError] Error limited
|
179
|
+
# @raise [ESI::Errors::InternalServerError] Internal server error
|
180
|
+
# @raise [ESI::Errors::ServiceUnavailableError] Service unavailable
|
181
|
+
# @raise [ESI::Errors::GatewayTimeoutError] Gateway timeout
|
182
|
+
#
|
183
|
+
# @see https://esi.evetech.net/ui/#/Wallet/get_corporations_corporation_id_wallets_division_transactions
|
184
|
+
def get_corporation_wallets_division_transactions(corporation_id:, division:, from_id:, params: {}, headers: {})
|
185
|
+
query_string = URI.encode_www_form([["from_id", from_id]])
|
186
|
+
get("/corporations/#{corporation_id}/wallets/#{division}/transactions/?#{query_string}", headers: headers, params: params)
|
187
|
+
end
|
188
|
+
alias get_corporations_corporation_id_wallets_division_transactions get_corporation_wallets_division_transactions
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ESI
|
4
|
+
class Client
|
5
|
+
# ESI wars operations.
|
6
|
+
module War
|
7
|
+
# Return details about a war.
|
8
|
+
#
|
9
|
+
# This endpoint is cached for up to 3600 seconds.
|
10
|
+
#
|
11
|
+
# @esi_version dev
|
12
|
+
# @esi_version legacy
|
13
|
+
# @esi_version v1
|
14
|
+
#
|
15
|
+
# @param war_id [Integer,String] ID for a war
|
16
|
+
# @param params [Hash] Additional query string parameters
|
17
|
+
# @param headers [Hash] Additional headers
|
18
|
+
#
|
19
|
+
# @raise [ESI::Errors::BadRequestError] Bad request
|
20
|
+
# @raise [ESI::Errors::ErrorLimitedError] Error limited
|
21
|
+
# @raise [ESI::Errors::UnprocessableEntityError] War not found
|
22
|
+
# @raise [ESI::Errors::InternalServerError] Internal server error
|
23
|
+
# @raise [ESI::Errors::ServiceUnavailableError] Service unavailable
|
24
|
+
# @raise [ESI::Errors::GatewayTimeoutError] Gateway timeout
|
25
|
+
#
|
26
|
+
# @see https://esi.evetech.net/ui/#/Wars/get_wars_war_id
|
27
|
+
def get_war(war_id:, params: {}, headers: {})
|
28
|
+
get("/wars/#{war_id}/", headers: headers, params: params)
|
29
|
+
end
|
30
|
+
alias get_wars_war_id get_war
|
31
|
+
|
32
|
+
# Return a list of kills related to a war.
|
33
|
+
#
|
34
|
+
# This endpoint is cached for up to 3600 seconds.
|
35
|
+
#
|
36
|
+
# @esi_version dev
|
37
|
+
# @esi_version legacy
|
38
|
+
# @esi_version v1
|
39
|
+
#
|
40
|
+
# @param war_id [Integer,String] A valid war ID
|
41
|
+
# @param params [Hash] Additional query string parameters
|
42
|
+
# @param headers [Hash] Additional headers
|
43
|
+
#
|
44
|
+
# @raise [ESI::Errors::BadRequestError] Bad request
|
45
|
+
# @raise [ESI::Errors::ErrorLimitedError] Error limited
|
46
|
+
# @raise [ESI::Errors::UnprocessableEntityError] War not found
|
47
|
+
# @raise [ESI::Errors::InternalServerError] Internal server error
|
48
|
+
# @raise [ESI::Errors::ServiceUnavailableError] Service unavailable
|
49
|
+
# @raise [ESI::Errors::GatewayTimeoutError] Gateway timeout
|
50
|
+
#
|
51
|
+
# @see https://esi.evetech.net/ui/#/Wars/get_wars_war_id_killmails
|
52
|
+
def get_war_killmails(war_id:, params: {}, headers: {})
|
53
|
+
get("/wars/#{war_id}/killmails/", headers: headers, params: params)
|
54
|
+
end
|
55
|
+
alias get_wars_war_id_killmails get_war_killmails
|
56
|
+
|
57
|
+
# Return a list of wars.
|
58
|
+
#
|
59
|
+
# This endpoint is cached for up to 3600 seconds.
|
60
|
+
#
|
61
|
+
# @esi_version dev
|
62
|
+
# @esi_version legacy
|
63
|
+
# @esi_version v1
|
64
|
+
#
|
65
|
+
# @param max_war_id [Integer] Only return wars with ID smaller than this
|
66
|
+
# @param params [Hash] Additional query string parameters
|
67
|
+
# @param headers [Hash] Additional headers
|
68
|
+
#
|
69
|
+
# @raise [ESI::Errors::BadRequestError] Bad request
|
70
|
+
# @raise [ESI::Errors::ErrorLimitedError] Error limited
|
71
|
+
# @raise [ESI::Errors::InternalServerError] Internal server error
|
72
|
+
# @raise [ESI::Errors::ServiceUnavailableError] Service unavailable
|
73
|
+
# @raise [ESI::Errors::GatewayTimeoutError] Gateway timeout
|
74
|
+
#
|
75
|
+
# @see https://esi.evetech.net/ui/#/Wars/get_wars
|
76
|
+
def get_wars(max_war_id:, params: {}, headers: {})
|
77
|
+
query_string = URI.encode_www_form([["max_war_id", max_war_id]])
|
78
|
+
get("/wars/?#{query_string}", headers: headers, params: params)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
data/lib/esi/client.rb
ADDED
@@ -0,0 +1,225 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "faraday"
|
4
|
+
require "faraday-http-cache"
|
5
|
+
require "faraday_middleware"
|
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"
|
41
|
+
|
42
|
+
module ESI
|
43
|
+
# Client for the EVE Swagger Interface (ESI) API.
|
44
|
+
class Client # rubocop:disable Metrics/ClassLength
|
45
|
+
include ESI::Client::Alliance
|
46
|
+
include ESI::Client::Contact
|
47
|
+
include ESI::Client::Character
|
48
|
+
include ESI::Client::Asset
|
49
|
+
include ESI::Client::Skill
|
50
|
+
include ESI::Client::Bookmark
|
51
|
+
include ESI::Client::Calendar
|
52
|
+
include ESI::Client::Clone
|
53
|
+
include ESI::Client::Contract
|
54
|
+
include ESI::Client::Fitting
|
55
|
+
include ESI::Client::Fleet
|
56
|
+
include ESI::Client::FactionWarfare
|
57
|
+
include ESI::Client::Industry
|
58
|
+
include ESI::Client::Killmail
|
59
|
+
include ESI::Client::Location
|
60
|
+
include ESI::Client::Loyalty
|
61
|
+
include ESI::Client::Mail
|
62
|
+
include ESI::Client::Opportunity
|
63
|
+
include ESI::Client::Market
|
64
|
+
include ESI::Client::PlanetaryInteraction
|
65
|
+
include ESI::Client::Search
|
66
|
+
include ESI::Client::Wallet
|
67
|
+
include ESI::Client::Corporation
|
68
|
+
include ESI::Client::Dogma
|
69
|
+
include ESI::Client::Incursion
|
70
|
+
include ESI::Client::Insurance
|
71
|
+
include ESI::Client::Route
|
72
|
+
include ESI::Client::Sovereignty
|
73
|
+
include ESI::Client::Status
|
74
|
+
include ESI::Client::UserInterface
|
75
|
+
include ESI::Client::Universe
|
76
|
+
include ESI::Client::War
|
77
|
+
|
78
|
+
DEFAULT_BASE_URL = "https://esi.evetech.net"
|
79
|
+
DEFAULT_VERSION = "latest"
|
80
|
+
|
81
|
+
ERROR_MAPPING = {
|
82
|
+
400 => ESI::Errors::BadRequestError,
|
83
|
+
401 => ESI::Errors::UnauthorizedError,
|
84
|
+
403 => ESI::Errors::ForbiddenError,
|
85
|
+
404 => ESI::Errors::NotFoundError,
|
86
|
+
420 => ESI::Errors::ErrorLimitedError,
|
87
|
+
422 => ESI::Errors::UnprocessableEntityError,
|
88
|
+
500 => ESI::Errors::InternalServerError,
|
89
|
+
503 => ESI::Errors::ServiceUnavailableError,
|
90
|
+
504 => ESI::Errors::GatewayTimeoutError,
|
91
|
+
520 => ESI::Errors::EveServerError
|
92
|
+
}.freeze
|
93
|
+
|
94
|
+
attr_reader :base_url, :cache, :user_agent, :version
|
95
|
+
|
96
|
+
# Returns a new {ESI::Client}.
|
97
|
+
#
|
98
|
+
# @param user_agent [String] Value of the `User-Agent` header for HTTP calls
|
99
|
+
# @param base_url [String] The base URL of the ESI API
|
100
|
+
# @param version [String] The version of the ESI API
|
101
|
+
# @param cache [Hash] The cache configuration to use
|
102
|
+
# @option cache [Object] :store The cache store (e.g. `Rails.cache`)
|
103
|
+
# @option cache [Object] :logger The logger (e.g. `Rails.logger`)
|
104
|
+
# @option cache [Object] :instrumenter The instrumenter (e.g. `ActiveSupport::Notifications`)
|
105
|
+
def initialize(user_agent:, base_url: DEFAULT_BASE_URL, version: DEFAULT_VERSION, cache: {})
|
106
|
+
@base_url = base_url
|
107
|
+
@cache = cache
|
108
|
+
@user_agent = user_agent
|
109
|
+
@version = version
|
110
|
+
end
|
111
|
+
|
112
|
+
# Set the `Authorization` header for subsequent requests.
|
113
|
+
#
|
114
|
+
# @param token [String] The [EVE SSO JWT token](https://docs.esi.evetech.net/docs/sso/) to use
|
115
|
+
def authorize(token)
|
116
|
+
url_encoded_connection.authorization :Bearer, token
|
117
|
+
json_encoded_connection.authorization :Bearer, token
|
118
|
+
end
|
119
|
+
|
120
|
+
private
|
121
|
+
|
122
|
+
ESI_RETRY_EXCEPTIONS = [Errno::ETIMEDOUT, Timeout::Error, Faraday::TimeoutError, Faraday::ConnectionFailed,
|
123
|
+
Faraday::ParsingError, SocketError].freeze
|
124
|
+
|
125
|
+
def delete(path, params: {}, headers: {})
|
126
|
+
response = make_delete_request(path, params: params, headers: headers)
|
127
|
+
response.body
|
128
|
+
end
|
129
|
+
|
130
|
+
def get(path, params: {}, headers: {})
|
131
|
+
response = make_get_request(path, params: params, headers: headers)
|
132
|
+
|
133
|
+
return paginate(response, params, headers) if paginated?(response)
|
134
|
+
|
135
|
+
response.body
|
136
|
+
end
|
137
|
+
|
138
|
+
def post(path, payload: {}, headers: {})
|
139
|
+
response = make_post_request(path, payload: payload, headers: headers)
|
140
|
+
response.body
|
141
|
+
end
|
142
|
+
|
143
|
+
def put(path, payload: {}, headers: {})
|
144
|
+
response = make_put_request(path, payload: payload, headers: headers)
|
145
|
+
response.body
|
146
|
+
end
|
147
|
+
|
148
|
+
def paginate(response, params, headers)
|
149
|
+
all_items = response.body
|
150
|
+
page_count = response.headers["X-Pages"].to_i - 1
|
151
|
+
page_count.times do |n|
|
152
|
+
page_number = n + 1
|
153
|
+
params = params.merge(page: page_number)
|
154
|
+
page = make_get_request(path, params: params, headers: headers)
|
155
|
+
all_items += page.body
|
156
|
+
end
|
157
|
+
|
158
|
+
all_items
|
159
|
+
end
|
160
|
+
|
161
|
+
def make_delete_request(path, params: {}, headers: {})
|
162
|
+
res = url_encoded_connection.delete("/#{version}#{path}", params, headers)
|
163
|
+
|
164
|
+
raise_error(res) unless res.success?
|
165
|
+
|
166
|
+
res
|
167
|
+
end
|
168
|
+
|
169
|
+
def make_get_request(path, params: {}, headers: {})
|
170
|
+
res = url_encoded_connection.get("/#{version}#{path}", params, headers)
|
171
|
+
|
172
|
+
raise_error(res) unless res.success?
|
173
|
+
|
174
|
+
res
|
175
|
+
end
|
176
|
+
|
177
|
+
def make_post_request(path, payload: {}, headers: {})
|
178
|
+
res = json_encoded_connection.post("/#{version}#{path}", payload, headers)
|
179
|
+
|
180
|
+
raise_error(res) unless res.success?
|
181
|
+
|
182
|
+
res
|
183
|
+
end
|
184
|
+
|
185
|
+
def make_put_request(path, payload: {}, headers: {})
|
186
|
+
res = json_encoded_connection.put("/#{version}#{path}", payload, headers)
|
187
|
+
|
188
|
+
raise_error(res) unless res.success?
|
189
|
+
|
190
|
+
res
|
191
|
+
end
|
192
|
+
|
193
|
+
def paginated?(response)
|
194
|
+
response.headers["X-Pages"] && response.headers["X-Pages"].to_i <= 1
|
195
|
+
end
|
196
|
+
|
197
|
+
def raise_error(res)
|
198
|
+
raise (ERROR_MAPPING[res.status] || Error).new("(#{res.status}) #{res["error"]}", response: res)
|
199
|
+
end
|
200
|
+
|
201
|
+
def url_encoded_connection
|
202
|
+
@url_encoded_connection ||= Faraday.new(base_url, headers: default_headers) do |f|
|
203
|
+
f.use :http_cache, cache unless cache.empty?
|
204
|
+
f.request :url_encoded
|
205
|
+
f.request :retry, { exceptions: ESI_RETRY_EXCEPTIONS }
|
206
|
+
f.response :follow_redirects
|
207
|
+
f.response :json
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
def json_encoded_connection
|
212
|
+
@json_encoded_connection ||= Faraday.new(base_url, headers: default_headers) do |f|
|
213
|
+
f.use :http_cache, cache unless cache.empty?
|
214
|
+
f.request :json
|
215
|
+
f.request :retry, { exceptions: ESI_RETRY_EXCEPTIONS }
|
216
|
+
f.response :follow_redirects
|
217
|
+
f.response :json
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
def default_headers
|
222
|
+
{ "User-Agent": user_agent }
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
data/lib/esi/errors.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ESI
|
4
|
+
# Namespace for ESI errors.
|
5
|
+
module Errors
|
6
|
+
# Base class for ESI errors.
|
7
|
+
class Error < RuntimeError
|
8
|
+
end
|
9
|
+
|
10
|
+
# Base class for ESI client errors.
|
11
|
+
class ClientError < Error
|
12
|
+
attr_reader :response
|
13
|
+
|
14
|
+
def initialize(msg, response:)
|
15
|
+
super(msg)
|
16
|
+
|
17
|
+
@response = response
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# ESI unauthorized error.
|
22
|
+
class UnauthorizedError < ClientError; end
|
23
|
+
|
24
|
+
# ESI bad request error.
|
25
|
+
class BadRequestError < ClientError; end
|
26
|
+
|
27
|
+
# ESI forbidden error.
|
28
|
+
class ForbiddenError < ClientError; end
|
29
|
+
|
30
|
+
# ESI not found error.
|
31
|
+
class NotFoundError < ClientError; end
|
32
|
+
|
33
|
+
# ESI unprocessable entity error.
|
34
|
+
class UnprocessableEntityError < ClientError; end
|
35
|
+
|
36
|
+
# ESI error limited error.
|
37
|
+
class ErrorLimitedError < ClientError; end
|
38
|
+
|
39
|
+
# ESI internal server error.
|
40
|
+
class InternalServerError < ClientError; end
|
41
|
+
|
42
|
+
# ESI service unavailable error.
|
43
|
+
class ServiceUnavailableError < ClientError; end
|
44
|
+
|
45
|
+
# ESI gateway timeout error.
|
46
|
+
class GatewayTimeoutError < ClientError; end
|
47
|
+
|
48
|
+
# ESI EVE server error.
|
49
|
+
class EveServerError < ClientError; end
|
50
|
+
end
|
51
|
+
end
|