usps-imis-api 0.13.8 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 24c3410aecab71548633fa57e97bb579beb2f235e47f43af88ab8dbc1a096d71
4
- data.tar.gz: 031767d6ac95a106dcf4c683066caed19372ce083242a70cb084078d59314968
3
+ metadata.gz: fca31f9bb4d8d748374f47185b5110c95b6f80088dc682cb44613e3629199319
4
+ data.tar.gz: 742c11021ae6b6446bc29e3b5b29fc99bf151683e5607e2ca2fcb12d5b19f569
5
5
  SHA512:
6
- metadata.gz: 745dbf0553594ad046d6bd03e19b60fb9e62dd44790588bd192ec43cffde832393939d24e766ca42c53d40f858b1a04cde0a13810dbe40d681d76eee75efc88a
7
- data.tar.gz: bb5eeab1605d6e45d0447fa69e051a8fa155be51e493ef63706c9577c3f31ca21a79d931ca7b4a3b18c17faded213f44f0e5c252957b0be5a46107608ff8249b
6
+ metadata.gz: 7b5bc685dec91340b99d60d5cf199d41b7dbf5750a5469b25dc46f445c0bb180b1d77bc7cd5e244ee68f88e93f9332083eea11fa19516dbd8d84e572177a35b5
7
+ data.tar.gz: 3fc9d20a2d78f4cc0ced1c3552db53e08106bb8ab74cd1384897f7faee5b7091a7b411b0ba5b6c91c06a3dcc01d1b94f5f315d746d89b81f9757f98129fda2df
@@ -15,9 +15,11 @@ module Usps
15
15
 
16
16
  private
17
17
 
18
+ # rubocop:disable Metrics/MethodLength
18
19
  def simplify(data)
19
- return data.to_a if data.is_a?(Query)
20
- return data.is_a?(BaseData) ? data.raw : data if force_raw_output?
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
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Usps
4
4
  module Imis
5
- VERSION = '0.13.8'
5
+ VERSION = '0.13.9'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usps-imis-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.8
4
+ version: 0.13.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander