usps-imis-api 0.11.15 → 0.11.16
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 +9 -3
- 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: b6437192db35a0e8a3e80d44d338366c9460060dc7b13d8f53a17c0d0c7ed8b8
|
|
4
|
+
data.tar.gz: 4c4ad6121f1f282e3788e311e78be6d753b56c04f8112a3ac6a23c808e198ca2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5aa9c0cac48c98eb3826c107e9db3a471689c6e30cc3d7fbce138db24f0c01128440b4e1fcc8b46bd3e96bd002ce0f4ce2136e9d678b60023af5b66330e55ceb
|
|
7
|
+
data.tar.gz: 8fa27434be1d69626b27653189636c4daeb1739407752d24a977314c70ac09029ab624f618c007a78669f8f8d8875b8a63646cb22e894ad87cd62a5c3fbeae20
|
data/lib/usps/imis/api.rb
CHANGED
|
@@ -76,11 +76,14 @@ module Usps
|
|
|
76
76
|
|
|
77
77
|
# Run requests as DSL, with specific iMIS ID only maintained for this scope
|
|
78
78
|
#
|
|
79
|
+
# Either +id+ or +certificate+ is required.
|
|
80
|
+
#
|
|
79
81
|
# While in this block, changes to the value of +imis_id+ are not allowed
|
|
80
82
|
#
|
|
81
83
|
# If no block is given, this sets the iMIS ID and returns self.
|
|
82
84
|
#
|
|
83
85
|
# @param id [Integer, String] iMIS ID to select for requests within the block
|
|
86
|
+
# @param certificate [String] Certificate number to convert to iMIS ID and select for requests within the block
|
|
84
87
|
#
|
|
85
88
|
# @example
|
|
86
89
|
# with(12345) do
|
|
@@ -89,9 +92,12 @@ module Usps
|
|
|
89
92
|
#
|
|
90
93
|
# @return [Usps::Imis::Api]
|
|
91
94
|
#
|
|
92
|
-
def with(id, &)
|
|
95
|
+
def with(id = nil, certificate: nil, &)
|
|
96
|
+
raise ArgumentError, 'Must provide id or certificate' unless id || certificate
|
|
97
|
+
|
|
93
98
|
old_id = imis_id
|
|
94
|
-
|
|
99
|
+
|
|
100
|
+
id.nil? ? imis_id_for(certificate) : self.imis_id = id
|
|
95
101
|
return self unless block_given?
|
|
96
102
|
|
|
97
103
|
@lock_imis_id = true
|
|
@@ -202,7 +208,7 @@ module Usps
|
|
|
202
208
|
json = JSON.parse(result.body)
|
|
203
209
|
|
|
204
210
|
@token = json['access_token']
|
|
205
|
-
@token_expiration = Time.now
|
|
211
|
+
@token_expiration = Time.now + json['expires_in'] - 60
|
|
206
212
|
end
|
|
207
213
|
|
|
208
214
|
# URI for the authentication endpoint
|
data/lib/usps/imis/version.rb
CHANGED