usps-imis-api 0.9.10.pre.1 → 0.9.11
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/usps/imis/api.rb +1 -2
- data/lib/usps/imis/requests.rb +1 -1
- data/lib/usps/imis/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cb22ca224852ea6118af6df2c429bfa597903c4fe4583243ea3a28b6886a21db
|
|
4
|
+
data.tar.gz: 606da2d8b21e9008b402bf66cacee53de74ebec860141b5a960690fa8364ab3a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a347f809fa6eba2e229fcbb1cdc0107ca2797d56950190ad299495c8525f9d858e78e8953aa53dd871906e5b8a95899e64837f31a298cca00e215835d1198aed
|
|
7
|
+
data.tar.gz: 5768933b5586148a67abd45236e7cbcf7084cb25e8ed7c4c8e509fb9fe9f23f1225c6b5d0f7fecf3be350f48459edbee6f6ec80626f70c041c7de6ee3998a429
|
data/lib/usps/imis/api.rb
CHANGED
|
@@ -39,7 +39,6 @@ module Usps
|
|
|
39
39
|
# @param imis_id [Integer, String] iMIS ID to select immediately on initialization
|
|
40
40
|
#
|
|
41
41
|
def initialize(imis_id: nil)
|
|
42
|
-
authenticate
|
|
43
42
|
self.imis_id = imis_id if imis_id
|
|
44
43
|
end
|
|
45
44
|
|
|
@@ -169,7 +168,7 @@ module Usps
|
|
|
169
168
|
json = JSON.parse(result.body)
|
|
170
169
|
|
|
171
170
|
@token = json['access_token']
|
|
172
|
-
@token_expiration = Time.
|
|
171
|
+
@token_expiration = Time.now - json['expires_in'] - 60
|
|
173
172
|
end
|
|
174
173
|
|
|
175
174
|
# URI for the authentication endpoint
|
data/lib/usps/imis/requests.rb
CHANGED
|
@@ -30,7 +30,7 @@ module Usps
|
|
|
30
30
|
# If the current token is missing/expired, request a new one
|
|
31
31
|
#
|
|
32
32
|
def authorize(request)
|
|
33
|
-
if token_expiration < Time.now
|
|
33
|
+
if token_expiration.nil? || token_expiration < Time.now
|
|
34
34
|
logger.debug 'Token expired: re-authenticating with iMIS'
|
|
35
35
|
authenticate
|
|
36
36
|
end
|
data/lib/usps/imis/version.rb
CHANGED