usps-imis-api 0.11.4 → 0.11.6
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 +33 -25
- data/lib/usps/imis/command_line/options_parser.rb +3 -3
- 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: 67535b48ce969a401d19d573ba5b1557fac0dfa971dddacf9345a0c1c365486f
|
|
4
|
+
data.tar.gz: 6c39e4c4f3276f8bd26a317c2c96ebf0be2561998d5b3cfecc3ebdefd27d6328
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4c9fa38439583904701cfbd42aaad35e9b1affae85fb15eaf94237641380462df353aaa25b93ec901e633ef37b8ee88af5e55928cb560a2ec273484fcb79b731
|
|
7
|
+
data.tar.gz: f321eaf91b434b4bfa15279cab97fbf9d2c7f0d9d54094f6987de69742ea1927d0f5f93bd6206a458316cb99dc02222c7e030780b4a09dfede70d174b34b865d
|
|
@@ -64,26 +64,26 @@ module Usps
|
|
|
64
64
|
|
|
65
65
|
# rubocop:disable Metrics
|
|
66
66
|
def perform!
|
|
67
|
-
case options
|
|
67
|
+
case convert(options)
|
|
68
|
+
in mapper: true, field:, data: then api.mapper[field.to_sym] = data
|
|
69
|
+
in mapper: true, field: then api.mapper[field.to_sym]
|
|
68
70
|
in mapper: true, data: then api.mapper.update(data)
|
|
69
|
-
|
|
70
|
-
in
|
|
71
|
-
|
|
72
|
-
in on:,
|
|
73
|
-
in on:, data
|
|
74
|
-
in on:,
|
|
75
|
-
in on:,
|
|
76
|
-
in on
|
|
77
|
-
|
|
78
|
-
in
|
|
79
|
-
|
|
80
|
-
in panel:, ordinal:,
|
|
81
|
-
in panel:,
|
|
82
|
-
in panel:, ordinal:,
|
|
83
|
-
in panel:, ordinal:,
|
|
84
|
-
in panel:, ordinal
|
|
85
|
-
in panel:, ordinal:, field: then api.panels.public_send(panel).get_field(ordinal, field)
|
|
86
|
-
in panel:, ordinal: then api.panels.public_send(panel).get(ordinal)
|
|
71
|
+
|
|
72
|
+
in on:, delete: true then on.delete
|
|
73
|
+
in on:, post: true, data: then on.post(data)
|
|
74
|
+
in on:, data:, field: then on.put_field(field, data)
|
|
75
|
+
in on:, data: then on.put_fields(data)
|
|
76
|
+
in on:, fields: then on.get_fields(*fields)
|
|
77
|
+
in on:, field: then on.get_field(field)
|
|
78
|
+
in on: then on.get
|
|
79
|
+
|
|
80
|
+
in panel:, delete: true, ordinal: then panel.delete(ordinal)
|
|
81
|
+
in panel:, post: true, data: then panel.post(data)
|
|
82
|
+
in panel:, ordinal:, data:, field: then panel.put_field(ordinal, field, data)
|
|
83
|
+
in panel:, ordinal:, data: then panel.put_fields(ordinal, data)
|
|
84
|
+
in panel:, ordinal:, fields: then panel.get_fields(ordinal, *fields)
|
|
85
|
+
in panel:, ordinal:, field: then panel.get_field(ordinal, field)
|
|
86
|
+
in panel:, ordinal: then panel.get(ordinal)
|
|
87
87
|
|
|
88
88
|
in query:, data: then api.query(query, data)
|
|
89
89
|
in query: then api.query(query)
|
|
@@ -93,6 +93,18 @@ module Usps
|
|
|
93
93
|
end
|
|
94
94
|
# rubocop:enable Metrics
|
|
95
95
|
|
|
96
|
+
def convert(options)
|
|
97
|
+
options.dup.tap do |converted|
|
|
98
|
+
case converted
|
|
99
|
+
in map: then converted.merge!(mapper: true, field: map)
|
|
100
|
+
in on: then converted[:on] = api.on(on)
|
|
101
|
+
in panel: then converted[:panel] = api.panels.public_send(panel)
|
|
102
|
+
else
|
|
103
|
+
# Nothing to convert
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
96
108
|
def simplify(data)
|
|
97
109
|
return data.to_a if data.is_a?(Query)
|
|
98
110
|
return data if options[:raw]
|
|
@@ -136,13 +148,9 @@ module Usps
|
|
|
136
148
|
end
|
|
137
149
|
|
|
138
150
|
def validate_options!
|
|
139
|
-
|
|
140
|
-
raise Errors::CommandLineError, 'No options provided'
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
return if options[:query].nil? || options[:query].start_with?('$/')
|
|
151
|
+
return unless options[:log_level] == 'info' && options.except(:log_level, :quiet).values.none?
|
|
144
152
|
|
|
145
|
-
raise Errors::CommandLineError, '
|
|
153
|
+
raise Errors::CommandLineError, 'No options provided'
|
|
146
154
|
end
|
|
147
155
|
end
|
|
148
156
|
end
|
|
@@ -12,13 +12,13 @@ module Usps
|
|
|
12
12
|
on: ['Business Object name', { type: :string }],
|
|
13
13
|
panel: ['Panel name', { type: :string }],
|
|
14
14
|
ordinal: ['Ordinal ID within a Panel', { type: :integer }],
|
|
15
|
-
query: ['IQA Query name', { type: :string, short: :Q }],
|
|
15
|
+
query: ['IQA Query or Business Object name to query', { type: :string, short: :Q }],
|
|
16
16
|
post: ["Send a #{'POST'.cyan} request", { short: :P }],
|
|
17
17
|
delete: ["Send a #{'DELETE'.cyan} request", { short: :D }],
|
|
18
18
|
field: ['Specific field to return or update', { type: :string }],
|
|
19
19
|
fields: ['Specific field(s) to return', { type: :strings, short: :F }],
|
|
20
|
-
map: ['
|
|
21
|
-
mapper: ['
|
|
20
|
+
map: ['Shorthand for accessing a single mapped field', { type: :string }],
|
|
21
|
+
mapper: ['Interact with mapped fields', { short: :M }],
|
|
22
22
|
data: ['JSON string input', { type: :string }],
|
|
23
23
|
config: ['Path to the JSON config file to use', { type: :string, short: :C }],
|
|
24
24
|
raw: ['Return raw JSON output, rather than simplified data', { short: :R }],
|
data/lib/usps/imis/version.rb
CHANGED