esi 0.4.6 → 0.4.7.pre.alpha.pre.60
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/esi.gemspec +6 -1
- data/lib/esi/api_error.rb +3 -3
- data/lib/esi/calls.rb +19 -611
- data/lib/esi/calls/alliances.rb +30 -0
- data/lib/esi/calls/base.rb +63 -0
- data/lib/esi/calls/characters.rb +144 -0
- data/lib/esi/calls/corporations.rb +102 -0
- data/lib/esi/calls/dogma.rb +29 -0
- data/lib/esi/calls/fittings.rb +20 -0
- data/lib/esi/calls/fleets.rb +23 -0
- data/lib/esi/calls/industry.rb +23 -0
- data/lib/esi/calls/info.rb +27 -0
- data/lib/esi/calls/killmails.rb +22 -0
- data/lib/esi/calls/markets.rb +57 -0
- data/lib/esi/calls/route.rb +11 -0
- data/lib/esi/calls/search.rb +14 -0
- data/lib/esi/calls/ui.rb +15 -0
- data/lib/esi/calls/universe.rb +96 -0
- data/lib/esi/client.rb +17 -14
- data/lib/esi/version.rb +1 -1
- metadata +19 -5
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Esi
|
4
|
+
class Calls
|
5
|
+
# TODO: Rename to `CharacterKillmails`?
|
6
|
+
class Killmails < Base
|
7
|
+
self.scope = 'esi-killmails.read_killmails.v1'
|
8
|
+
|
9
|
+
def initialize(character_id:, max_count: 50, max_kill_id: nil)
|
10
|
+
@path = "/characters/#{character_id}/killmails/recent"
|
11
|
+
@params = { max_count: max_count }
|
12
|
+
@params[:max_kill_id] = max_kill_id if max_kill_id
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class Killmail < Base
|
17
|
+
def initialize(id:, hash:)
|
18
|
+
@path = "/killmails/#{id}/#{hash}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Esi
|
4
|
+
class Calls
|
5
|
+
class StructureOrders < Base
|
6
|
+
def initialize(structure_id:)
|
7
|
+
@path = "/markets/structures/#{structure_id}"
|
8
|
+
@paginated = true
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class MarketHistory < Base
|
13
|
+
def initialize(region_id:, type_id:)
|
14
|
+
@path = "/markets/#{region_id}/history"
|
15
|
+
@params = { type_id: type_id }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class MarketTypes < Base
|
20
|
+
self.scope = nil
|
21
|
+
self.cache_duration = 600
|
22
|
+
|
23
|
+
def initialize(region_id:)
|
24
|
+
@path = "/markets/#{region_id}/types"
|
25
|
+
@paginated = true
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class MarketGroups < Base
|
30
|
+
def initialize
|
31
|
+
@path = '/markets/groups'
|
32
|
+
@paginated = true
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class MarketGroup < Base
|
37
|
+
def initialize(id)
|
38
|
+
@path = "/markets/groups/#{id}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
class MarketPrices < Base
|
43
|
+
def initialize
|
44
|
+
@path = '/markets/prices'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
class MarketOrders < Base
|
49
|
+
def initialize(region_id:, type_id: nil)
|
50
|
+
@path = "/markets/#{region_id}/orders"
|
51
|
+
@params = { order_type: :all }
|
52
|
+
@params[:type_id] = type_id if type_id.present?
|
53
|
+
@paginated = type_id.blank?
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Esi
|
4
|
+
class Calls
|
5
|
+
class Search < Base
|
6
|
+
self.scope = nil
|
7
|
+
|
8
|
+
def initialize(character_id: nil, categories:, search:, strict: false)
|
9
|
+
@path = (character_id ? "/characters/#{character_id}" : '') + '/search'
|
10
|
+
@params = { categories: categories, search: search, strict: strict }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/esi/calls/ui.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Esi
|
4
|
+
class Calls
|
5
|
+
class OpenMarketDetails < Base
|
6
|
+
self.scope = 'esi-ui.open_window.v1'
|
7
|
+
|
8
|
+
def initialize(type_id)
|
9
|
+
@path = '/ui/openwindow/marketdetails'
|
10
|
+
@method = :post
|
11
|
+
@params = { type_id: type_id }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Esi
|
4
|
+
class Calls
|
5
|
+
class Regions < Base
|
6
|
+
def initialize
|
7
|
+
@path = '/universe/regions/'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class Region < Base
|
12
|
+
def initialize(region_id)
|
13
|
+
@path = "/universe/regions/#{region_id}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class Constellations < Base
|
18
|
+
def initialize
|
19
|
+
@path = '/universe/constellations/'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class Constellation < Base
|
24
|
+
def initialize(constellation_id)
|
25
|
+
@path = "/universe/constellations/#{constellation_id}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class SolarSystem < Base
|
30
|
+
def initialize(system_id)
|
31
|
+
@path = "/universe/systems/#{system_id}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class SolarSystems < Base
|
36
|
+
def initialize
|
37
|
+
@path = '/universe/systems/'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
class Star < Base
|
42
|
+
def initialize(star_id)
|
43
|
+
@path = "/universe/stars/#{star_id}"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
class Planet < Base
|
48
|
+
def initialize(planet_id)
|
49
|
+
@path = "/universe/planets/#{planet_id}"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
class Moon < Base
|
54
|
+
def initialize(moon_id)
|
55
|
+
@path = "/universe/moons/#{moon_id}"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
class Stargate < Base
|
60
|
+
def initialize(stargate_id)
|
61
|
+
@path = "/universe/stargates/#{stargate_id}"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
class Station < Base
|
66
|
+
def initialize(station_id)
|
67
|
+
@path = "/universe/stations/#{station_id}"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
class Structures < Base
|
72
|
+
def initialize
|
73
|
+
@path = '/universe/structures/'
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
class Structure < Base
|
78
|
+
def initialize(structure_id)
|
79
|
+
@path = "universe/structures/#{structure_id}"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
class Types < Base
|
84
|
+
def initialize
|
85
|
+
@path = '/universe/types'
|
86
|
+
@paginated = true
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
class Type < Base
|
91
|
+
def initialize(type_id)
|
92
|
+
@path = "/universe/types/#{type_id}"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
data/lib/esi/client.rb
CHANGED
@@ -22,9 +22,9 @@ module Esi
|
|
22
22
|
attr_reader :logger, :oauth
|
23
23
|
|
24
24
|
# Create a new instance of Client
|
25
|
-
# @param [String] token the esi access_token
|
26
|
-
# @param [String] refresh_token the esi refresh_token
|
27
|
-
# @param [Time] expires_at the time stamp the esi token expires_at
|
25
|
+
# @param token [String] token the esi access_token
|
26
|
+
# @param refresh_token [String] refresh_token the esi refresh_token
|
27
|
+
# @param expires_at [Time] expires_at the time stamp the esi token expires_at
|
28
28
|
def initialize(token: nil, refresh_token: nil, expires_at: nil)
|
29
29
|
@logger = Esi.logger
|
30
30
|
@access_token = token
|
@@ -33,21 +33,23 @@ module Esi
|
|
33
33
|
@oauth = init_oauth
|
34
34
|
end
|
35
35
|
|
36
|
-
# Set the current thread's Esi::Client
|
37
|
-
#
|
38
|
-
# @
|
36
|
+
# Set the current thread's `Esi::Client`
|
37
|
+
#
|
38
|
+
# @param client [Esi::Client] the client to set
|
39
|
+
#
|
40
|
+
# @return [Esi::Client] the current thread's `Esi::Client`
|
39
41
|
def self.current=(client)
|
40
42
|
Thread.current[:esi_client] = client
|
41
43
|
end
|
42
44
|
|
43
|
-
# Get the current thread's Esi::Client
|
44
|
-
# @return [Esi::Client] the current thread's Esi::Client
|
45
|
+
# Get the current thread's `Esi::Client`
|
46
|
+
# @return [Esi::Client] the current thread's `Esi::Client`
|
45
47
|
def self.current
|
46
48
|
Thread.current[:esi_client] ||= new
|
47
49
|
end
|
48
50
|
|
49
51
|
# Switch to default Esi::Client (Esi::Client.new)
|
50
|
-
# @return [Esi::Client] the current thread's Esi::Client
|
52
|
+
# @return [Esi::Client] the current thread's `Esi::Client`
|
51
53
|
def self.switch_to_default
|
52
54
|
self.current = new
|
53
55
|
end
|
@@ -80,9 +82,10 @@ module Esi
|
|
80
82
|
|
81
83
|
# Intercept Esi::Client method_missing and attempt to call an Esi::Request
|
82
84
|
# with an Esi::Calls
|
83
|
-
#
|
84
|
-
# @param [
|
85
|
-
# @param [
|
85
|
+
#
|
86
|
+
# @param name [Symbol|String] name the name of the method called
|
87
|
+
# @param args [Array] *args the arguments to call the method with
|
88
|
+
# @param block [#block] &block the block to pass to the underlying method
|
86
89
|
# @raise [NameError] If the Esi::Calls does not exist
|
87
90
|
# @return [Esi::Response] the response given for the call
|
88
91
|
def method_missing(name, *args, &block)
|
@@ -180,8 +183,8 @@ module Esi
|
|
180
183
|
end
|
181
184
|
end
|
182
185
|
|
183
|
-
#
|
184
|
-
#
|
186
|
+
# @todo esi should not retry
|
187
|
+
# @todo make rubocop compliant
|
185
188
|
# rubocop:disable Lint/ShadowedException
|
186
189
|
# rubocop:disable Metrics/AbcSize
|
187
190
|
# rubocop:disable Metrics/BlockLength
|
data/lib/esi/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: esi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.7.pre.alpha.pre.60
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Hiemstra
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-02-
|
12
|
+
date: 2018-02-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -152,7 +152,21 @@ files:
|
|
152
152
|
- lib/esi/access_token.rb
|
153
153
|
- lib/esi/api_error.rb
|
154
154
|
- lib/esi/calls.rb
|
155
|
+
- lib/esi/calls/alliances.rb
|
156
|
+
- lib/esi/calls/base.rb
|
157
|
+
- lib/esi/calls/characters.rb
|
158
|
+
- lib/esi/calls/corporations.rb
|
159
|
+
- lib/esi/calls/dogma.rb
|
160
|
+
- lib/esi/calls/fittings.rb
|
161
|
+
- lib/esi/calls/fleets.rb
|
162
|
+
- lib/esi/calls/industry.rb
|
155
163
|
- lib/esi/calls/info.rb
|
164
|
+
- lib/esi/calls/killmails.rb
|
165
|
+
- lib/esi/calls/markets.rb
|
166
|
+
- lib/esi/calls/route.rb
|
167
|
+
- lib/esi/calls/search.rb
|
168
|
+
- lib/esi/calls/ui.rb
|
169
|
+
- lib/esi/calls/universe.rb
|
156
170
|
- lib/esi/client.rb
|
157
171
|
- lib/esi/o_auth.rb
|
158
172
|
- lib/esi/response.rb
|
@@ -174,12 +188,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
174
188
|
version: '0'
|
175
189
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
190
|
requirements:
|
177
|
-
- - "
|
191
|
+
- - ">"
|
178
192
|
- !ruby/object:Gem::Version
|
179
|
-
version:
|
193
|
+
version: 1.3.1
|
180
194
|
requirements: []
|
181
195
|
rubyforge_project:
|
182
|
-
rubygems_version: 2.6
|
196
|
+
rubygems_version: 2.7.6
|
183
197
|
signing_key:
|
184
198
|
specification_version: 4
|
185
199
|
summary: EVE ESI API wrapper
|