usps-imis-api 0.11.41 → 0.11.42
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/Readme.md +1 -1
- data/lib/usps/imis/api.rb +4 -0
- data/lib/usps/imis/blank_object.rb +2 -0
- data/lib/usps/imis/business_object.rb +6 -0
- data/lib/usps/imis/command_line/interface.rb +1 -1
- data/lib/usps/imis/config.rb +20 -0
- data/lib/usps/imis/mapper.rb +2 -2
- data/lib/usps/imis/properties.rb +3 -0
- 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: db2bc7a4cecec659c0b9d6c86ec8a5819f066537f35b0db089ca5f7df243c597
|
|
4
|
+
data.tar.gz: 7945390fbd0d073799a01e25cbfd9ffcd6a590da818055a39a7c6368a881e787
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 20eca697722eb6ef3d502afa3b87f46655feee6739eabec86580a032d28f590f29b619abdca8d25f56edcc77a7584305fe9911c73c596b5b70dd847d00fb1b96
|
|
7
|
+
data.tar.gz: 92676045e015b98881b8d40e5d99b9720ddae3618d3686837e6ac9ac0a5414308ba146f4a9339e64038f85c696abbc2d07f148c3a62bed14d93c9f9e7096f0b7
|
data/Readme.md
CHANGED
|
@@ -86,4 +86,4 @@ file to [rubygems.org](https://rubygems.org).
|
|
|
86
86
|
A wrapper for the CLI from this API is
|
|
87
87
|
[available for PHP](https://github.com/unitedstatespowersquadrons/imis-api-php).
|
|
88
88
|
|
|
89
|
-
You can also view the [original PHP API](https://github.com/unitedstatespowersquadrons/imis-api).
|
|
89
|
+
You can also view the (***deprecated***) [original PHP API](https://github.com/unitedstatespowersquadrons/imis-api).
|
data/lib/usps/imis/api.rb
CHANGED
|
@@ -139,6 +139,8 @@ module Usps
|
|
|
139
139
|
# @param id [Integer, String] iMIS ID to select for requests within the block
|
|
140
140
|
# @param certificate [String] Certificate number to convert to iMIS ID and select for requests within the block
|
|
141
141
|
# @param record_id [Integer] Record ID to select for requests within the block
|
|
142
|
+
# @yield Block context to run requests with a specific iMIS ID
|
|
143
|
+
# @yieldparam [Api]
|
|
142
144
|
#
|
|
143
145
|
# @example
|
|
144
146
|
# with(12345) do
|
|
@@ -184,6 +186,8 @@ module Usps
|
|
|
184
186
|
#
|
|
185
187
|
# @param business_object_name [String, Symbol] Name of the business object
|
|
186
188
|
# @param ordinal [Integer] Ordinal to build override ID param of the URL (e.g. used for Panels)
|
|
189
|
+
# @yield Block context to run requests on a specific +BusinessObject+
|
|
190
|
+
# @yieldparam [Api]
|
|
187
191
|
#
|
|
188
192
|
# @return [Usps::Imis::BusinessObject]
|
|
189
193
|
#
|
|
@@ -21,6 +21,8 @@ module Usps
|
|
|
21
21
|
# Build a blank object for the current iMIS ID
|
|
22
22
|
#
|
|
23
23
|
# @param hash [Hash] Hash version of props to set (block takes priority)
|
|
24
|
+
# @yield Block context to define additional properties with +add+
|
|
25
|
+
# @yieldparam [Properties]
|
|
24
26
|
#
|
|
25
27
|
def build(hash = {}, &) = header.merge(Properties.build(parent.api.record_id.to_s, @ordinal&.to_s, hash, &))
|
|
26
28
|
|
|
@@ -139,11 +139,17 @@ module Usps
|
|
|
139
139
|
|
|
140
140
|
# Build a blank object for the current iMIS ID
|
|
141
141
|
#
|
|
142
|
+
# @param hash [Hash] Hash version of props to set (block takes priority)
|
|
143
|
+
# @yield Block context to define additional properties with +add+
|
|
144
|
+
# @yieldparam [Properties]
|
|
145
|
+
#
|
|
142
146
|
def blank_object(hash = {}, &) = BlankObject.new(self).build(hash, &)
|
|
143
147
|
|
|
144
148
|
# Create a business object for the current member, starting with a blank object and building properties
|
|
145
149
|
#
|
|
146
150
|
# @param hash [Hash] Hash version of props to set (block takes priority)
|
|
151
|
+
# @yield Block context to define additional properties with +add+
|
|
152
|
+
# @yieldparam [Properties]
|
|
147
153
|
#
|
|
148
154
|
def post_from_blank(hash = {}, &) = post(blank_object(hash, &))
|
|
149
155
|
alias create_from_blank post_from_blank
|
|
@@ -17,7 +17,7 @@ module Usps
|
|
|
17
17
|
local: File.join(Dir.pwd, 'imis.yml'),
|
|
18
18
|
local_dot_config: File.join(Dir.pwd, '.config', 'imis.yml'),
|
|
19
19
|
local_config: File.join(Dir.pwd, 'config', 'imis.yml'),
|
|
20
|
-
user:
|
|
20
|
+
user: File.join(Dir.home, '.config', 'imis.yml'),
|
|
21
21
|
system: '/usr/local/imis/config.yml'
|
|
22
22
|
}.freeze
|
|
23
23
|
|
data/lib/usps/imis/config.rb
CHANGED
|
@@ -34,22 +34,36 @@ module Usps
|
|
|
34
34
|
@logger_level = logger.class::SEV_LABEL[logger.level].downcase.to_sym
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
+
# Define the API environment
|
|
38
|
+
#
|
|
39
|
+
# @param env [String] Environment to use
|
|
40
|
+
#
|
|
37
41
|
def environment=(env)
|
|
38
42
|
@environment = ActiveSupport::StringInquirer.new(env.to_s)
|
|
39
43
|
end
|
|
40
44
|
|
|
45
|
+
# Override the main logger
|
|
46
|
+
#
|
|
47
|
+
# @param logger [Logger] Configured logging object
|
|
48
|
+
#
|
|
41
49
|
def logger=(logger)
|
|
42
50
|
@base_logger = logger.tap { it.formatter = LoggerFormatter.new }
|
|
43
51
|
@base_logger.singleton_class.include(LoggerHelpers)
|
|
44
52
|
@logger = ActiveSupport::TaggedLogging.new(@base_logger)
|
|
45
53
|
end
|
|
46
54
|
|
|
55
|
+
# Define the main logger
|
|
56
|
+
#
|
|
57
|
+
# @param path [path, nil] Path to write log to, or +nil+ to log to +STDOUT+
|
|
58
|
+
#
|
|
47
59
|
def logger_file=(path)
|
|
48
60
|
@logger_file = path
|
|
49
61
|
@base_logger = Logger.new(@logger_file.nil? ? $stdout : @logger_file, level: logger.level)
|
|
50
62
|
@logger = ActiveSupport::TaggedLogging.new(@base_logger)
|
|
51
63
|
end
|
|
52
64
|
|
|
65
|
+
# Current global mirror debug logger
|
|
66
|
+
#
|
|
53
67
|
def global_logger
|
|
54
68
|
return @global_logger if @global_logger
|
|
55
69
|
|
|
@@ -57,12 +71,18 @@ module Usps
|
|
|
57
71
|
@global_logger
|
|
58
72
|
end
|
|
59
73
|
|
|
74
|
+
# Current path for the global mirror debug logger
|
|
75
|
+
#
|
|
60
76
|
def global_log_path
|
|
61
77
|
return @global_log_path if defined?(@global_log_path)
|
|
62
78
|
|
|
63
79
|
self.global_log_path = DEFAULT_GLOBAL_LOG_PATH
|
|
64
80
|
end
|
|
65
81
|
|
|
82
|
+
# Define the global mirror debug logger
|
|
83
|
+
#
|
|
84
|
+
# @param path [path, nil] Path to write log to, or +nil+ to disable
|
|
85
|
+
#
|
|
66
86
|
def global_log_path=(path)
|
|
67
87
|
@global_log_path = path
|
|
68
88
|
@global_logger = build_global_logger
|
data/lib/usps/imis/mapper.rb
CHANGED
|
@@ -39,14 +39,14 @@ module Usps
|
|
|
39
39
|
#
|
|
40
40
|
# Only available for fields defined in +FIELD_MAPPING+
|
|
41
41
|
#
|
|
42
|
-
# @param field_key [Symbol] Internal name of the field
|
|
42
|
+
# @param field_key [String, Symbol] Internal name of the field
|
|
43
43
|
#
|
|
44
44
|
# @return Value of the field
|
|
45
45
|
#
|
|
46
46
|
def get_field(field_key)
|
|
47
47
|
missing_mapping!(field_key) unless FIELD_MAPPING.key?(field_key.to_sym)
|
|
48
48
|
|
|
49
|
-
business_object_name, field = FIELD_MAPPING[field_key]
|
|
49
|
+
business_object_name, field = FIELD_MAPPING[field_key.to_sym]
|
|
50
50
|
api.on(business_object_name)[field]
|
|
51
51
|
end
|
|
52
52
|
alias fetch get_field
|
data/lib/usps/imis/properties.rb
CHANGED
|
@@ -10,6 +10,8 @@ module Usps
|
|
|
10
10
|
# @param id [String] iMIS ID to include in the properties before running the block
|
|
11
11
|
# @param ordinal [String] Ordinal to include in the properties before running the block
|
|
12
12
|
# @param hash [Hash] Hash version of props to set (block takes priority)
|
|
13
|
+
# @yield Block context to define additional properties with +add+
|
|
14
|
+
# @yieldparam [Properties]
|
|
13
15
|
#
|
|
14
16
|
def self.build(id = nil, ordinal = nil, hash = {}, &) = new.build(id, ordinal, hash, &)
|
|
15
17
|
|
|
@@ -33,6 +35,7 @@ module Usps
|
|
|
33
35
|
# @param ordinal [String] Ordinal to include in the properties before running the block
|
|
34
36
|
# @param hash [Hash] Hash version of props to set (block takes priority)
|
|
35
37
|
# @yield Block context to define additional properties with +add+
|
|
38
|
+
# @yieldparam [Properties]
|
|
36
39
|
#
|
|
37
40
|
def build(id = nil, ordinal = nil, hash = {})
|
|
38
41
|
@properties ||= []
|
data/lib/usps/imis/version.rb
CHANGED