usps-imis-api 0.11.7 → 0.11.8
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/command_line/interface.rb +4 -2
- data/lib/usps/imis/command_line/options_parser.rb +3 -19
- data/lib/usps/imis/query.rb +8 -3
- data/lib/usps/imis/version.rb +1 -1
- data/lib/usps/imis.rb +1 -0
- 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: 5cb250d5dd836f5ca8b2382bcc45e788d57307dc47800337d59ff2976b4c52dd
|
|
4
|
+
data.tar.gz: 65c492cb9bec04a98be6aa8c5821cda5f3bf28304b91fb9202c13c95ab21ae67
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 764a6555ba593dc6e7b6b159aa741d9866f9981278fc1d4b7820d3a83efaa0ff5ddfff8eb93c7f2d09868853251db89163471582ed4a8f0086809c824823703d
|
|
7
|
+
data.tar.gz: 949e90aa4c506455184fd162cc75fb6b8a45c8c98b4e3561e3656d2445ca32b5174c6bd14164d51108fb5c69d7275a30a8cb06eda04ee480290eacb77524a6bd
|
|
@@ -131,11 +131,13 @@ module Usps
|
|
|
131
131
|
end
|
|
132
132
|
# :nocov:
|
|
133
133
|
|
|
134
|
+
# Supports YAML or JSON config data
|
|
135
|
+
#
|
|
134
136
|
def configure!
|
|
135
|
-
|
|
137
|
+
config_data = YAML.safe_load_file(options[:config])
|
|
136
138
|
|
|
137
139
|
Usps::Imis.configure do |config|
|
|
138
|
-
|
|
140
|
+
config_data.each do |key, value|
|
|
139
141
|
config.public_send("#{key}=", value)
|
|
140
142
|
end
|
|
141
143
|
end
|
|
@@ -20,7 +20,7 @@ module Usps
|
|
|
20
20
|
field: ['Specific field to return or update', { type: :string }],
|
|
21
21
|
fields: ['Specific field(s) to return', { type: :strings, short: :F }],
|
|
22
22
|
data: ["JSON string input\n When present, sets the default HTTP verb to #{'PUT'.cyan}", { type: :string }],
|
|
23
|
-
config: ['Path to the JSON config file to use', { type: :string, short: :C }],
|
|
23
|
+
config: ['Path to the JSON/YAML config file to use', { type: :string, short: :C }],
|
|
24
24
|
raw: ['Return raw JSON output, rather than simplified data', { short: :R }],
|
|
25
25
|
include_ids: ["Include #{'iMIS ID'.yellow} and #{'Ordinal'.yellow} properties in returned data, if present"],
|
|
26
26
|
quiet: ["Suppress logging to #{'STDERR'.red}"],
|
|
@@ -73,25 +73,9 @@ module Usps
|
|
|
73
73
|
|
|
74
74
|
#{'Configuration'.underline}
|
|
75
75
|
|
|
76
|
-
API configuration
|
|
76
|
+
For an explanation of how to provide API configuration, please refer to the wiki:
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
With #{'--config'.green}/#{'-C'.green} given the path to a JSON file, e.g.:
|
|
80
|
-
|
|
81
|
-
{
|
|
82
|
-
"imis_id_query_name": "#{'$/IQA_QUERY_NAME'.yellow}",
|
|
83
|
-
"environment": "#{'development'.yellow}",
|
|
84
|
-
"username": "#{'USERNAME'.yellow}",
|
|
85
|
-
"password": "#{'PASSWORD'.yellow}"
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
By setting the following environment variables:
|
|
90
|
-
|
|
91
|
-
#{'IMIS_ID_QUERY_NAME'.yellow}
|
|
92
|
-
#{'IMIS_ENVIRONMENT'.yellow}
|
|
93
|
-
#{'IMIS_USERNAME'.yellow}
|
|
94
|
-
#{'IMIS_PASSWORD'.yellow}
|
|
78
|
+
https://github.com/unitedstatespowersquadrons/imis-api-ruby/wiki/Usage#command-line-interface
|
|
95
79
|
|
|
96
80
|
|
|
97
81
|
#{'Options'.underline}
|
data/lib/usps/imis/query.rb
CHANGED
|
@@ -52,7 +52,6 @@ module Usps
|
|
|
52
52
|
@api = api
|
|
53
53
|
@query_name = query_name
|
|
54
54
|
@query_params = query_params
|
|
55
|
-
@query_params.merge!(QueryName: query_name) if iqa?
|
|
56
55
|
@page_size = page_size
|
|
57
56
|
@offset = offset
|
|
58
57
|
@count = 0
|
|
@@ -137,10 +136,16 @@ module Usps
|
|
|
137
136
|
def iqa? = query_name.match?(/^\$/)
|
|
138
137
|
def query_type = iqa? ? :IQA : :'Business Object'
|
|
139
138
|
def path_params = query_params.merge({ Offset: offset, Limit: page_size }.compact)
|
|
140
|
-
def endpoint = iqa? ? IQA_PATH : "#{Imis::BusinessObject::API_PATH}/#{query_name}"
|
|
141
|
-
def path = "#{endpoint}?#{path_params.to_query}"
|
|
142
139
|
def uri = URI(File.join(Imis.configuration.hostname, path))
|
|
143
140
|
|
|
141
|
+
def path
|
|
142
|
+
if iqa?
|
|
143
|
+
"#{IQA_PATH}?#{path_params.merge(QueryName: query_name).to_query}"
|
|
144
|
+
else
|
|
145
|
+
"#{Imis::BusinessObject::API_PATH}/#{query_name}?#{path_params.to_query}"
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
|
|
144
149
|
def logger = Imis.logger("#{query_type} Query")
|
|
145
150
|
end
|
|
146
151
|
end
|
data/lib/usps/imis/version.rb
CHANGED
data/lib/usps/imis.rb
CHANGED