usps-imis-api 0.12.8 → 0.12.9
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 +3 -3
- data/lib/usps/imis/base_data.rb +1 -1
- data/lib/usps/imis/requests.rb +8 -4
- data/lib/usps/imis/version.rb +1 -1
- data/lib/usps/imis.rb +2 -0
- 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: a42c46a141077cd81f0bf4ecd680a25ad10df88bd28d183d24280f2d7f0b5348
|
|
4
|
+
data.tar.gz: f54f32c44e31d39dd5cef4703b72d3e9f95847b971194a91211bc314b767e932
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 99af41b8445740f5e7489533314aa932ea57e51fae07ab37739c9dbcbc91a419aabf73fac67034debff920163a50770ffe60dab1ed7a1ae584a104a03fb1c8bc
|
|
7
|
+
data.tar.gz: 12ca8d1d0e81ec8fa0c0644074e51789c079b242a56b2463f01705f56fde05891771b23c0f668a01af64a7b322ac5f2db74344fe63e492c9fa2bf5f7327ee8a5
|
data/lib/usps/imis/api.rb
CHANGED
|
@@ -208,14 +208,14 @@ module Usps
|
|
|
208
208
|
#
|
|
209
209
|
# @return Value of the specified field
|
|
210
210
|
#
|
|
211
|
-
|
|
211
|
+
delegate :fetch, to: :mapper
|
|
212
212
|
alias [] fetch
|
|
213
213
|
|
|
214
214
|
# Convenience alias for reading multiple mapped fields
|
|
215
215
|
#
|
|
216
216
|
# @return [Array] Values of the specified fields
|
|
217
217
|
#
|
|
218
|
-
|
|
218
|
+
delegate :fetch_all, to: :mapper
|
|
219
219
|
|
|
220
220
|
# Convenience alias for updating mapped fields
|
|
221
221
|
#
|
|
@@ -228,7 +228,7 @@ module Usps
|
|
|
228
228
|
#
|
|
229
229
|
# @return [Usps::Imis::Data] Updated object
|
|
230
230
|
#
|
|
231
|
-
|
|
231
|
+
delegate :update, to: :mapper
|
|
232
232
|
|
|
233
233
|
# List of available Business Object names
|
|
234
234
|
#
|
data/lib/usps/imis/base_data.rb
CHANGED
data/lib/usps/imis/requests.rb
CHANGED
|
@@ -9,9 +9,7 @@ module Usps
|
|
|
9
9
|
|
|
10
10
|
def logger = raise(Errors::ApiError, "#{self.class.name} must implement #logger")
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
def token_expiration = api.token_expiration
|
|
14
|
-
def authenticate = api.authenticate
|
|
12
|
+
delegate :token, :token_expiration, :authenticate, to: :api
|
|
15
13
|
|
|
16
14
|
def http_get = Net::HTTP::Get.new(uri)
|
|
17
15
|
def http_put = Net::HTTP::Put.new(uri)
|
|
@@ -38,14 +36,20 @@ module Usps
|
|
|
38
36
|
logger.debug "#{request.class.name.demodulize.upcase} #{uri}"
|
|
39
37
|
logger.json sanitized_request_body(request)
|
|
40
38
|
|
|
39
|
+
start_time = Time.now
|
|
41
40
|
client.request(request).tap do |result|
|
|
42
|
-
|
|
41
|
+
check_result_success!(result)
|
|
43
42
|
|
|
44
43
|
logger.info 'Request succeeded'
|
|
44
|
+
logger.tagged('Time').debug ActiveSupport::Duration.build(Time.now - start_time).inspect
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
+
def check_result_success!(result)
|
|
50
|
+
raise Errors::ResponseError.from(result) unless result.is_a?(Net::HTTPSuccess)
|
|
51
|
+
end
|
|
52
|
+
|
|
49
53
|
def sanitized_request_body(request)
|
|
50
54
|
return '*** empty request body ***' if request.body.nil?
|
|
51
55
|
|
data/lib/usps/imis/version.rb
CHANGED
data/lib/usps/imis.rb
CHANGED
|
@@ -10,7 +10,9 @@ require 'cgi'
|
|
|
10
10
|
require 'active_support/core_ext/string/inflections'
|
|
11
11
|
require 'active_support/core_ext/object/to_query'
|
|
12
12
|
require 'active_support/core_ext/enumerable'
|
|
13
|
+
require 'active_support/core_ext/module/delegation'
|
|
13
14
|
require 'active_support/string_inquirer'
|
|
15
|
+
require 'active_support/duration'
|
|
14
16
|
require 'logger'
|
|
15
17
|
require 'active_support/isolated_execution_state' # Fix constant loading issue with TaggedLogging
|
|
16
18
|
require 'active_support/tagged_logging'
|