usps-imis-api 0.13.0 → 0.13.1

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: 01ea56e2c86361876d694df871ed74b17ead231c2a04956cbcf4121e9ea81a43
4
- data.tar.gz: f1bb3827652a82ef2bbd821267305e200da82adc5305a3e8743634574ac8cba7
3
+ metadata.gz: 4f2a87078ddd79a70812f9d8047a10b431300ce84bdc4d6304458001ec0f525c
4
+ data.tar.gz: 475666c51fc44ac9473dc7ceeab05758f1fbdf314554140851b8f04d5775ceeb
5
5
  SHA512:
6
- metadata.gz: 7d827dc920c5b0db49ec6e965d1a6991e6c2198671db810fc8bd76f8d50e74ae1f3f8bcfe4c98bc1af97a6f54444b41ed94893f240bad5ec0987772bae2fe95b
7
- data.tar.gz: c0887342a3a94477e4a2bf9e888443b4a1db68ce343b0555b5dcd9a8dd1706f70c15962a7088c19d2613f3e13f1ef6c669bdcd8f192e5c1708c41f34f77591f6
6
+ metadata.gz: 1d862618ef81096dac1c2b026228956d27c4b600b914a8f48dd403508e8b9a43c337ab9414c711390af71e1b1fb686cfda81cd1164c8ad5aaa244c4836139928
7
+ data.tar.gz: 86aff154476bccb2cc88cf8f8f149a12166ea3c03123139e42141a8de97b42a4d9ee7e7ee1f3f0bee555c588cd08c60d9bdb476a09636508489ac6bc849c347b
@@ -51,10 +51,18 @@ module Usps
51
51
  # :nocov:
52
52
 
53
53
  def format_output(value)
54
- if value.is_a?(Array) && @options[:jsonl] then jsonl(value)
55
- elsif value.is_a?(Array) && @options[:csv] then csv(value)
56
- else json(value)
54
+ if value.is_a?(Array)
55
+ case @options
56
+ in csv: true then return csv(value)
57
+ in jsonl: true then return jsonl(value)
58
+ else return json(value)
59
+ end
57
60
  end
61
+
62
+ return json(value) if @options[:json]
63
+ return value if value.is_a?(String) || value.is_a?(Symbol) || value.nil?
64
+
65
+ json(value)
58
66
  end
59
67
 
60
68
  def json(value) = JSON.dump(value)
@@ -114,12 +114,15 @@ Options:
114
114
  raw:
115
115
  - Return raw JSON output, rather than simplified data
116
116
  - short: R
117
- jsonl:
118
- - Format array output as JSONL
119
- - short: j
120
117
  csv:
121
118
  - Format output as CSV (if possible)
122
119
  - short: S
120
+ jsonl:
121
+ - Format array output as JSONL
122
+ - short: j
123
+ json:
124
+ - Format string output also as JSON (i.e. quoted)
125
+ - short: J
123
126
 
124
127
  Configuration:
125
128
  config:
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Usps
4
4
  module Imis
5
- VERSION = '0.13.0'
5
+ VERSION = '0.13.1'
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.0
4
+ version: 0.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander