esi 0.4.13.pre.alpa2 → 0.4.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bcaffc70bd2847f7ae948e5b7ff8115e317c5a9b0730cd08851241cfcaf209b2
4
- data.tar.gz: f4532b5f6e8e56d6989f69314ca0ec76b7b0ae662a85cfc70a7cae5072bfdf77
3
+ metadata.gz: 5318ada47a8456e3ec80feb871a3998c8e760dc3ec12c2b8d975252292a04f45
4
+ data.tar.gz: b0adbff86424651b6c12f19f3dc1e5d0564ea20e2b46e7c3a76170a0140c5cc6
5
5
  SHA512:
6
- metadata.gz: 6ac2860625402b608aeb7e0de0740a0e2a4337215d421d53ced0269fb88e723c7c152a24262b0595801aa4842df4c803b8c0cb7832f353478e3592b457b19f67
7
- data.tar.gz: 60cfe7052b01428894d71b94d68470225679dc067173b6a2e7bec3eab2135576a43b4c3917e1084265fb4d9864dbed225e2be9bb2f8e942b7120c0805d206945
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
@@ -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
- # @param oauth_client [OAuth2::Client] Custom instance of OAuth2::Client
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
- @oauth ||= OAuth.new(
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
@@ -20,36 +20,26 @@ module Esi
20
20
  end
21
21
 
22
22
  def client
23
- @client ||= create_client
24
- end
25
-
26
- # @return [OAuth2::Client] new oAuth2 client instance with specified options
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, client: 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
@@ -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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Esi
4
- VERSION = '0.4.13-alpa2'
4
+ VERSION = '0.4.14'
5
5
  end
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.13.pre.alpa2
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-03 00:00:00.000000000 Z
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: 1.3.1
193
+ version: '0'
194
194
  requirements: []
195
195
  rubyforge_project:
196
196
  rubygems_version: 2.7.6