usps-imis-api 0.11.12 → 0.11.13

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: 3b7dbdde63c0e5541e240df706bd51d2f4db983473a29e3b5db1d4779015893b
4
- data.tar.gz: aa80e0a5094e561d3e8a2b64c56c9e18ea4cf93c24a6e3c8729c108d3a639ccf
3
+ metadata.gz: f73a43e0e4fd712b2d3dd227800c98cee6811bd9303570e00f4f6d6a3ea361d9
4
+ data.tar.gz: dc6d277340cc19195170dff9f163a2b64d4a501f8e84cf3d69c2e7c7223641c8
5
5
  SHA512:
6
- metadata.gz: cda6f17fedd33eaed4f347bf0213b4f87ba1d784cd333208a244c84ac6223610363f402bc40348eb2bc4ea770de83d3f63edfa37bd3bcb5d3c4d7454cc064780
7
- data.tar.gz: 2124949a5db9853087e076681f76b3e7df609610573026679f2bc89f9403f88cf762ae9be68f2a7f3852d255a9bfcceb3eed02bf0a5b518d5f6b9daaeeec0a84
6
+ metadata.gz: 06dde7b0faec7e26f19b73c05326f180f8c65214d9698c9ff22380c7310788e33dc959ffd22cc26f3668e9aba43c72f7b43d279d5220bccc2012e7d55e241e21
7
+ data.tar.gz: 0e62f5def3791260add8f67f07e9590f24fdc8e93f4617da1695771224d85856d816547c6d9ad2a9f1c4c7c40019fab3fb002dd5e609fa7e670e76c27ade1d57
data/lib/usps/imis/api.rb CHANGED
@@ -46,6 +46,8 @@ module Usps
46
46
  #
47
47
  # @param id [Integer, String] iMIS ID to select for future requests
48
48
  #
49
+ # @return [Integer] iMIS ID
50
+ #
49
51
  def imis_id=(id)
50
52
  raise Errors::LockedIdError if lock_imis_id
51
53
 
@@ -56,7 +58,7 @@ module Usps
56
58
  #
57
59
  # @param certificate [String] Certificate number to lookup the corresponding iMIS ID for
58
60
  #
59
- # @return [String] Corresponding iMIS ID
61
+ # @return [Integer] Corresponding iMIS ID
60
62
  #
61
63
  def imis_id_for(certificate)
62
64
  raise Errors::LockedIdError if lock_imis_id
@@ -85,6 +87,8 @@ module Usps
85
87
  # update(mm: 15)
86
88
  # end
87
89
  #
90
+ # @return [Usps::Imis::Api]
91
+ #
88
92
  def with(id, &)
89
93
  old_id = imis_id
90
94
  self.imis_id = id
@@ -117,6 +121,8 @@ module Usps
117
121
  # @param business_object_name [String] Name of the business object
118
122
  # @param ordinal [Integer] Ordinal to build override ID param of the URL (e.g. used for Panels)
119
123
  #
124
+ # @return [Usps::Imis::BusinessObject]
125
+ #
120
126
  def on(business_object_name, ordinal: nil, &)
121
127
  object = BusinessObject.new(self, business_object_name, ordinal:)
122
128
  return object unless block_given?
@@ -132,24 +138,34 @@ module Usps
132
138
 
133
139
  # Convenience alias for reading mapped fields
134
140
  #
141
+ # @return Value of the specified field
142
+ #
135
143
  def fetch(field_key) = mapper.fetch(field_key)
136
144
  alias [] fetch
137
145
 
138
146
  # Convenience alias for reading multiple mapped fields
139
147
  #
148
+ # @return [Array] Values of the specified fields
149
+ #
140
150
  def fetch_all(*fields) = mapper.fetch_all(*fields)
141
151
 
142
152
  # Convenience alias for updating mapped fields
143
153
  #
154
+ # @return [Array] Array containing the updated object
155
+ #
144
156
  def put_field(field_key, value) = update(field_key => value)
145
157
  alias []= put_field
146
158
 
147
159
  # Convenience alias for updating mapped fields
148
160
  #
161
+ # @return [Usps::Imis::Data] Updated object
162
+ #
149
163
  def update(data) = mapper.update(data)
150
164
 
151
165
  # List of available Business Object names
152
166
  #
167
+ # @return [Hash<Symbol, Array<String>>] Grouped available Business Objects
168
+ #
153
169
  def business_objects
154
170
  abc, other = query('BOEntityDefinition').map(&:entity).partition { it.include?('ABC') }
155
171
 
@@ -71,7 +71,7 @@ module Usps
71
71
  in mapper:, data: then mapper.update(data)
72
72
 
73
73
  in on:, delete: true then on.delete
74
- in on:, post: true, data: then on.post(data)
74
+ in on:, create: true, data: then on.post(data)
75
75
  in on:, data:, field: then on.put_field(field, data)
76
76
  in on:, data: then on.put_fields(data)
77
77
  in on:, fields: then on.get_fields(*fields)
@@ -79,7 +79,7 @@ module Usps
79
79
  in on: then on.get
80
80
 
81
81
  in panel:, delete: true, ordinal: then panel.delete(ordinal)
82
- in panel:, post: true, data: then panel.post(data)
82
+ in panel:, create: true, data: then panel.post(data)
83
83
  in panel:, ordinal:, data:, field: then panel.put_field(ordinal, field, data)
84
84
  in panel:, ordinal:, data: then panel.put_fields(ordinal, data)
85
85
  in panel:, ordinal:, fields: then panel.get_fields(ordinal, *fields)
@@ -14,15 +14,15 @@ module Usps
14
14
  ordinal: ['Ordinal ID within a Panel', { type: :integer }],
15
15
  query: ['IQA Query or Business Object name to query', { type: :string, short: :Q }],
16
16
  mapper: ['Interact with mapped fields', { short: :M }],
17
- map: ["Shorthand for accessing a single mapped field\n Equivalent to #{'-Mf'.green}", { type: :string }],
18
- post: ["Send a #{'POST'.cyan} request", { short: :P }],
17
+ map: ["Shorthand for #{'-Mf'.green} to access a single mapped field", { type: :string }],
18
+ create: ["Send a #{'POST'.cyan} request", { short: :P }],
19
19
  delete: ["Send a #{'DELETE'.cyan} request", { short: :D }],
20
20
  field: ['Specific field to return or update', { type: :string }],
21
21
  fields: ['Specific field(s) to return', { type: :strings, short: :F }],
22
- data: ["JSON string input\n When present, sets the default HTTP verb to #{'PUT'.cyan}", { type: :string }],
22
+ data: ['JSON string input', { type: :string }],
23
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
- include_ids: ["Include #{'iMIS ID'.yellow} and #{'Ordinal'.yellow} properties in returned data, if present"],
25
+ include_ids: ["Include any #{'iMIS ID'.yellow} and #{'Ordinal'.yellow} properties in returned data"],
26
26
  quiet: ["Suppress logging to #{'STDERR'.red}"],
27
27
  log: ["Redirect logging to #{'STDOUT'.red}"],
28
28
  log_level: ['Set the logging level', { type: :string, default: 'info', short: :L }]
@@ -36,19 +36,26 @@ module Usps
36
36
  %i[quiet log_level],
37
37
  %i[quiet log],
38
38
 
39
- %i[post delete],
39
+ %i[create delete],
40
40
 
41
- %i[post mapper],
42
- %i[post query],
43
- %i[post map],
41
+ %i[create mapper],
42
+ %i[create query],
43
+ %i[create map],
44
+ %i[create field],
45
+ %i[create fields],
44
46
 
45
47
  %i[delete mapper],
46
48
  %i[delete query],
47
- %i[delete map]
49
+ %i[delete map],
50
+ %i[delete field],
51
+ %i[delete fields],
52
+ %i[delete data],
53
+ %i[delete raw]
48
54
  ].freeze
49
55
 
50
56
  DEPENDENT_OPTION_PAIRS = [
51
- %i[ordinal panel]
57
+ %i[ordinal panel],
58
+ %i[create data]
52
59
  ].freeze
53
60
 
54
61
  attr_reader :arguments, :options
@@ -67,20 +74,10 @@ module Usps
67
74
  #{'imis.rb'.bold} #{'[options]'.gray}
68
75
 
69
76
 
70
- #{'HTTP Verbs'.underline}
77
+ #{'Further Help'.underline}
71
78
 
72
- The default HTTP verb is #{'GET'.cyan}.
73
-
74
- If #{'--data'.green}/#{'-d'.green} is provided, the default HTTP verb is #{'PUT'.cyan}.
75
-
76
- #{'--data'.green}/#{'-d'.green} is used to provide field(s) data for #{'PUT'.cyan}
77
- requests and mapper updates, object data for #{'POST'.cyan},
78
- and to provide any query params.
79
-
80
-
81
- #{'Configuration'.underline}
82
-
83
- For an explanation of how to provide API configuration, please refer to the wiki:
79
+ For an explanation of how to provide API configuration, more details on the options,
80
+ and usage examples, please refer to the wiki:
84
81
 
85
82
  https://github.com/unitedstatespowersquadrons/imis-api-ruby/wiki/Command-Line
86
83
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Usps
4
4
  module Imis
5
- VERSION = '0.11.12'
5
+ VERSION = '0.11.13'
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.11.12
4
+ version: 0.11.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander