usps-imis-api 0.11.38 → 0.11.39
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 +1 -1
- data/lib/usps/imis/command_line/options_parser.rb +23 -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: 490015ad8f86bea9afbc0eb9065a6b5e92432bc7c3bca8ec7faa2a6e61c2bd24
|
|
4
|
+
data.tar.gz: 5376fcdd8ea7e4a3e31832ecc8b399b51949d39449f0be5a1d74ca24b8452b26
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7cfc0becb2b9969998b472970bd07ca0ebdd8427d64bf74e17adf8aa7be59e11c1db21d77d853b567a8397f61f7fa816a7977f0c0873b7269d9ac755e4cf179c
|
|
7
|
+
data.tar.gz: a26a68da79680d9b2f095d42caafee5b2a62bfd5ac9c01b278f367a7a996248dff7ff173f5498da46231e2e66cf7a8c8b26b45dc5471149e0e0e14a406bd1b54
|
data/lib/usps/imis/api.rb
CHANGED
|
@@ -113,13 +113,29 @@ module Usps
|
|
|
113
113
|
@options = parse_options.compact
|
|
114
114
|
@arguments = ARGV # Not currently used
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
# Set the default behavior to --help instead of --version
|
|
117
|
+
#
|
|
118
|
+
# Passing any subcommands as arguments will cause this conditional to fail
|
|
119
|
+
#
|
|
120
|
+
# If this is disabled:
|
|
121
|
+
#
|
|
122
|
+
# - The default behavior is to print just the version label to the terminal
|
|
123
|
+
# - CommandLine::Performers#perform! *must* expect a `version:` pattern,
|
|
124
|
+
# and will return a quoted string of the version label
|
|
125
|
+
#
|
|
126
|
+
Optimist.educate if ARGV.empty? && defaults?
|
|
117
127
|
|
|
118
128
|
# :nocov:
|
|
119
129
|
@options[:data] = read_stdin if stdin?
|
|
120
130
|
# :nocov:
|
|
121
131
|
|
|
122
132
|
@options[:data] = JSON.parse(@options[:data]) if @options[:data]
|
|
133
|
+
|
|
134
|
+
# Support shorthand for setting `certificate` param on queries
|
|
135
|
+
return unless @options[:query] && @options[:certificate]
|
|
136
|
+
|
|
137
|
+
@options[:data] ||= {}
|
|
138
|
+
@options[:data]['certificate'] = @options.delete(:certificate)
|
|
123
139
|
end
|
|
124
140
|
|
|
125
141
|
private
|
|
@@ -143,7 +159,12 @@ module Usps
|
|
|
143
159
|
def read_stdin = $stdin.read.chomp
|
|
144
160
|
# :nocov:
|
|
145
161
|
|
|
146
|
-
def defaults?
|
|
162
|
+
def defaults?
|
|
163
|
+
options_with_defaults = OPTIONS.select { |_, data| data[1]&.key?(:default) }
|
|
164
|
+
|
|
165
|
+
options_with_defaults.all? { |option, data| data[1].nil? || options[option] == data[1][:default] } &&
|
|
166
|
+
options.except(*options_with_defaults.keys).values.none?
|
|
167
|
+
end
|
|
147
168
|
end
|
|
148
169
|
end
|
|
149
170
|
end
|
data/lib/usps/imis/version.rb
CHANGED