esi 0.4.13.pre.alpa2 → 0.4.14
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/lib/esi/calls/corporations.rb +9 -0
- data/lib/esi/client.rb +2 -7
- data/lib/esi/o_auth.rb +6 -16
- data/lib/esi/response.rb +0 -8
- data/lib/esi/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5318ada47a8456e3ec80feb871a3998c8e760dc3ec12c2b8d975252292a04f45
|
|
4
|
+
data.tar.gz: b0adbff86424651b6c12f19f3dc1e5d0564ea20e2b46e7c3a76170a0140c5cc6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 20c417ed1f54121112a39cb8a7c1e4bc8087f88e167a75a8f06314a7ed67a418040e01f6c1583dc26f6da5cc7abb664839ab3fc74a386f0b85c68fbb47b562b5
|
|
7
|
+
data.tar.gz: e15bcb5f258699f1d3721d5f5936b0ae30c4540275369f4dd95fba537f7eddc4cd605d1881b0b35afe1b5dadc1cd294320d7f9ae446e8720e03110cdf271294c
|
|
@@ -98,5 +98,14 @@ module Esi
|
|
|
98
98
|
self.scope = 'esi-wallet.read_corporation_wallets.v1'
|
|
99
99
|
self.cache_duration = 300
|
|
100
100
|
end
|
|
101
|
+
|
|
102
|
+
class CorporationWalletJournal < Base
|
|
103
|
+
self.scope = 'esi-wallet.read_corporation_wallets.v1'
|
|
104
|
+
self.cache_duration = 3600
|
|
105
|
+
|
|
106
|
+
def initialize(corporation_id, division)
|
|
107
|
+
@path = "/corporations/#{corporation_id}/wallet/#{division}/journal"
|
|
108
|
+
end
|
|
109
|
+
end
|
|
101
110
|
end
|
|
102
111
|
end
|
data/lib/esi/client.rb
CHANGED
|
@@ -25,13 +25,11 @@ module Esi
|
|
|
25
25
|
# @param token [String] token the esi access_token
|
|
26
26
|
# @param refresh_token [String] refresh_token the esi refresh_token
|
|
27
27
|
# @param expires_at [Time] expires_at the time stamp the esi token expires_at
|
|
28
|
-
|
|
29
|
-
def initialize(token: nil, refresh_token: nil, expires_at: nil, oauth_client: nil)
|
|
28
|
+
def initialize(token: nil, refresh_token: nil, expires_at: nil)
|
|
30
29
|
@logger = Esi.logger
|
|
31
30
|
@access_token = token
|
|
32
31
|
@refresh_token = refresh_token
|
|
33
32
|
@expires_at = expires_at
|
|
34
|
-
@oauth_client = oauth_client
|
|
35
33
|
@oauth = init_oauth
|
|
36
34
|
end
|
|
37
35
|
|
|
@@ -154,13 +152,11 @@ module Esi
|
|
|
154
152
|
name.dup.to_s.split('_').map(&:capitalize).join
|
|
155
153
|
end
|
|
156
154
|
|
|
157
|
-
# rubocop:disable Metrics/MethodLength
|
|
158
155
|
def init_oauth
|
|
159
|
-
|
|
156
|
+
OAuth.new(
|
|
160
157
|
access_token: @access_token,
|
|
161
158
|
refresh_token: @refresh_token,
|
|
162
159
|
expires_at: @expires_at,
|
|
163
|
-
client: @oauth_client,
|
|
164
160
|
callback: lambda { |token, expires_at|
|
|
165
161
|
@access_token = token
|
|
166
162
|
@expires_at = expires_at
|
|
@@ -168,7 +164,6 @@ module Esi
|
|
|
168
164
|
}
|
|
169
165
|
)
|
|
170
166
|
end
|
|
171
|
-
# rubocop:enable Metrics/MethodLength
|
|
172
167
|
|
|
173
168
|
def request_paginated(call, &block)
|
|
174
169
|
call.page = 1
|
data/lib/esi/o_auth.rb
CHANGED
|
@@ -20,36 +20,26 @@ module Esi
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def client
|
|
23
|
-
@client ||=
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def create_client(client_id: nil, client_secret: nil)
|
|
28
|
-
client_id ||= Esi.config.client_id
|
|
29
|
-
client_secret ||= Esi.config.client_secret
|
|
30
|
-
|
|
31
|
-
OAuth2::Client.new(client_id, client_secret, site: Esi.config.oauth_host)
|
|
23
|
+
@client ||= OAuth2::Client.new(
|
|
24
|
+
Esi.config.client_id, Esi.config.client_secret,
|
|
25
|
+
site: Esi.config.oauth_host
|
|
26
|
+
)
|
|
32
27
|
end
|
|
33
28
|
end
|
|
34
29
|
|
|
35
|
-
def initialize(access_token:, refresh_token:, expires_at:, callback: nil
|
|
30
|
+
def initialize(access_token:, refresh_token:, expires_at:, callback: nil)
|
|
36
31
|
raise Esi::Error, 'Callback should be a callable Proc' if callback && !callback.respond_to?(:call)
|
|
37
32
|
|
|
38
33
|
@access_token = access_token
|
|
39
34
|
@refresh_token = refresh_token
|
|
40
35
|
@expires_at = expires_at
|
|
41
36
|
@callback = callback if callback
|
|
42
|
-
@client = client if client
|
|
43
37
|
end
|
|
44
38
|
|
|
45
39
|
private
|
|
46
40
|
|
|
47
|
-
def client
|
|
48
|
-
@client || OAuth.client
|
|
49
|
-
end
|
|
50
|
-
|
|
51
41
|
def token
|
|
52
|
-
@token = Esi::AccessToken.new(client, @access_token,
|
|
42
|
+
@token = Esi::AccessToken.new(OAuth.client, @access_token,
|
|
53
43
|
refresh_token: @refresh_token, expires_at: @expires_at)
|
|
54
44
|
refresh_access_token if @token.expired?
|
|
55
45
|
@token
|
data/lib/esi/response.rb
CHANGED
|
@@ -31,14 +31,6 @@ module Esi
|
|
|
31
31
|
@cached_until ||= headers[:expires] ? Time.parse(headers[:expires]) : nil
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
def response_json
|
|
35
|
-
@response_json ||= begin
|
|
36
|
-
MultiJson.load(body, symbolize_keys: true)
|
|
37
|
-
rescue StandardError
|
|
38
|
-
{}
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
34
|
def save
|
|
43
35
|
return unless should_log_response?
|
|
44
36
|
File.write(log_directroy.join("#{Time.now.to_i}.json"), to_json)
|
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.14
|
|
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-03-
|
|
12
|
+
date: 2018-03-25 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activesupport
|
|
@@ -188,9 +188,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
188
188
|
version: '0'
|
|
189
189
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
190
|
requirements:
|
|
191
|
-
- - "
|
|
191
|
+
- - ">="
|
|
192
192
|
- !ruby/object:Gem::Version
|
|
193
|
-
version:
|
|
193
|
+
version: '0'
|
|
194
194
|
requirements: []
|
|
195
195
|
rubyforge_project:
|
|
196
196
|
rubygems_version: 2.7.6
|