usps-imis-api 0.13.7 → 0.13.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 +5 -3
- data/lib/usps/imis/command_line/formatters.rb +15 -2
- 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: fca31f9bb4d8d748374f47185b5110c95b6f80088dc682cb44613e3629199319
|
|
4
|
+
data.tar.gz: 742c11021ae6b6446bc29e3b5b29fc99bf151683e5607e2ca2fcb12d5b19f569
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7b5bc685dec91340b99d60d5cf199d41b7dbf5750a5469b25dc46f445c0bb180b1d77bc7cd5e244ee68f88e93f9332083eea11fa19516dbd8d84e572177a35b5
|
|
7
|
+
data.tar.gz: 3fc9d20a2d78f4cc0ced1c3552db53e08106bb8ab74cd1384897f7faee5b7091a7b411b0ba5b6c91c06a3dcc01d1b94f5f315d746d89b81f9757f98129fda2df
|
data/lib/usps/imis/api.rb
CHANGED
|
@@ -59,16 +59,18 @@ module Usps
|
|
|
59
59
|
# A new instance of +Api+
|
|
60
60
|
#
|
|
61
61
|
# @param imis_id [Integer, String] iMIS ID to select immediately on initialization
|
|
62
|
+
# @param record_id [Integer, String] iMIS ID to select immediately on initialization
|
|
63
|
+
# @param certificate [String] Certificate to convert to iMIS ID immediately on initialization
|
|
62
64
|
#
|
|
63
65
|
def initialize(imis_id: nil, record_id: nil, certificate: nil)
|
|
64
66
|
raise ArgumentError, 'Cannot provide both imis_id and certificate' if imis_id && certificate
|
|
65
67
|
|
|
68
|
+
@logger = Imis.logger('Api')
|
|
69
|
+
Imis.config.validate!
|
|
70
|
+
|
|
66
71
|
self.imis_id = imis_id if imis_id
|
|
67
72
|
self.record_id = record_id if record_id
|
|
68
73
|
imis_id_for(certificate) if certificate
|
|
69
|
-
|
|
70
|
-
@logger = Imis.logger('Api')
|
|
71
|
-
Imis.config.validate!
|
|
72
74
|
end
|
|
73
75
|
|
|
74
76
|
# Manually set the current ID, if you already have it for a given member
|
|
@@ -15,9 +15,11 @@ module Usps
|
|
|
15
15
|
|
|
16
16
|
private
|
|
17
17
|
|
|
18
|
+
# rubocop:disable Metrics/MethodLength
|
|
18
19
|
def simplify(data)
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
data = data.to_a if data.is_a?(Query)
|
|
21
|
+
|
|
22
|
+
return simplify_raw(data) if force_raw_output?
|
|
21
23
|
|
|
22
24
|
if data.is_a?(PartyData)
|
|
23
25
|
logger.debug 'Returning simplified PartyData#properties'
|
|
@@ -25,6 +27,9 @@ module Usps
|
|
|
25
27
|
elsif data.is_a?(Data)
|
|
26
28
|
logger.debug 'Returning simplified Data#properties'
|
|
27
29
|
data.properties(include_ids: options[:include_ids])
|
|
30
|
+
elsif data.is_a?(Array) && data.all?(PartyData)
|
|
31
|
+
logger.debug 'Returning simplified Array<PartyData#properties>'
|
|
32
|
+
data.map(&:properties)
|
|
28
33
|
elsif data.is_a?(Array) && data.all?(Data)
|
|
29
34
|
logger.debug 'Returning simplified Array<Data#properties>'
|
|
30
35
|
data.map { it.properties(include_ids: options[:include_ids]) }
|
|
@@ -32,6 +37,14 @@ module Usps
|
|
|
32
37
|
data
|
|
33
38
|
end
|
|
34
39
|
end
|
|
40
|
+
# rubocop:enable Metrics/MethodLength
|
|
41
|
+
|
|
42
|
+
def simplify_raw(data)
|
|
43
|
+
return data.raw if data.is_a?(BaseData)
|
|
44
|
+
return data.map(&:raw) if data.is_a?(Array) && data.all?(BaseData)
|
|
45
|
+
|
|
46
|
+
data
|
|
47
|
+
end
|
|
35
48
|
|
|
36
49
|
def force_raw_output? = options[:raw] || RAW_HASH_RESPONSE_OPTIONS.any? { options[it] }
|
|
37
50
|
|
data/lib/usps/imis/version.rb
CHANGED