usps-imis-api 0.13.0 → 0.13.2

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: 39b3425be79c46892032b02b9878f7707c1e84d6a30b9d834c4524e0c8622e9d
4
+ data.tar.gz: 6fdcb9594d2d4855245b9ece4c613366d9b4f4c0379b31b38f050e17f860cca3
5
5
  SHA512:
6
- metadata.gz: 7d827dc920c5b0db49ec6e965d1a6991e6c2198671db810fc8bd76f8d50e74ae1f3f8bcfe4c98bc1af97a6f54444b41ed94893f240bad5ec0987772bae2fe95b
7
- data.tar.gz: c0887342a3a94477e4a2bf9e888443b4a1db68ce343b0555b5dcd9a8dd1706f70c15962a7088c19d2613f3e13f1ef6c669bdcd8f192e5c1708c41f34f77591f6
6
+ metadata.gz: cc5b05a0aed74f2bb273d9a3b2fa197f8d588b6f334e9cd3745b2b2af3bc37d830e9c38200fe05f1115bca3924e7e6325af9888249ee0523a693171e1b0fb1e2
7
+ data.tar.gz: 80a858aa8c983003765eb976197dd582ba50ac476c81808e4f46a2f602635764ea149d5936bcc7bbd89f5739da7d36684d3a5039edb25359cd7ee0d2c2e0621a
@@ -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:
@@ -161,6 +164,9 @@ Options:
161
164
  version:
162
165
  - Print version and exit
163
166
  - short: v
167
+ environment:
168
+ - Print configured environment and exit
169
+ - short: E
164
170
  help:
165
171
  - Show this message
166
172
  - short: h
@@ -21,6 +21,7 @@ module Usps
21
21
  in certificate: _ then api.imis_id
22
22
  in show_config: true then config_path
23
23
  in version: true then api.class.version
24
+ in environment: true then Imis.config.environment
24
25
  end
25
26
  rescue NoMatchingPatternError => e
26
27
  raise Errors::CommandLineError, "Unable to match pattern from options: #{e.message}"
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Usps
4
4
  module Imis
5
- VERSION = '0.13.0'
5
+ VERSION = '0.13.2'
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.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander