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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 39b3425be79c46892032b02b9878f7707c1e84d6a30b9d834c4524e0c8622e9d
|
|
4
|
+
data.tar.gz: 6fdcb9594d2d4855245b9ece4c613366d9b4f4c0379b31b38f050e17f860cca3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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)
|
|
55
|
-
|
|
56
|
-
|
|
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}"
|
data/lib/usps/imis/version.rb
CHANGED