usps-imis-api 0.11.20 → 0.11.22
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 +4 -2
- data/lib/usps/imis/command_line/interface.rb +2 -2
- data/lib/usps/imis/config.rb +7 -1
- data/lib/usps/imis/logger_formatter.rb +3 -1
- 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: 7820f3d30ee1247240c4ab3c61ae473c8a57c4c5996e34d30eac22a161fcd5e4
|
|
4
|
+
data.tar.gz: 68370bcee77a5326d19a94f23bbeb21cad0216cd77cf52d8131c90b39fa67378
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6356c425f3a4a391d91956cd8325207d12ad12fb181942390d434a9a234d52c0e5b344bb14c86a6d636220fd41e05dc63170ce2c9ff11e041827cd8c2574d8be
|
|
7
|
+
data.tar.gz: ae71b14a1a2f02e4ee0b123b5907a8c6c37390ba868c9d21830c023fb667b36ee3e67da49673c70635f69f0364f48eb0b107af52b6ea2146d156d1423226cc1d
|
data/Readme.md
CHANGED
|
@@ -82,5 +82,7 @@ file to [rubygems.org](https://rubygems.org).
|
|
|
82
82
|
|
|
83
83
|
## PHP
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
[available for PHP](https://github.com/unitedstatespowersquadrons/imis-api).
|
|
85
|
+
A wrapper for the CLI from this API is
|
|
86
|
+
[available for PHP](https://github.com/unitedstatespowersquadrons/imis-api-php).
|
|
87
|
+
|
|
88
|
+
You can also view the [original PHP API](https://github.com/unitedstatespowersquadrons/imis-api).
|
|
@@ -183,8 +183,8 @@ module Usps
|
|
|
183
183
|
# :nocov:
|
|
184
184
|
if options[:quiet] || ENV.fetch('SUPPRESS_OUTPUT', false)
|
|
185
185
|
config.logger = ActiveSupport::TaggedLogging.new(Logger.new(nil))
|
|
186
|
-
elsif options[:log]
|
|
187
|
-
# Use default
|
|
186
|
+
elsif options[:log] || config.logger_file
|
|
187
|
+
# Use default, or configured file
|
|
188
188
|
else
|
|
189
189
|
config.logger = ActiveSupport::TaggedLogging.new(Logger.new($stderr))
|
|
190
190
|
end
|
data/lib/usps/imis/config.rb
CHANGED
|
@@ -14,7 +14,7 @@ module Usps
|
|
|
14
14
|
REQUIRED_CONFIGS = %w[imis_id_query_name username password].freeze
|
|
15
15
|
|
|
16
16
|
attr_accessor :imis_id_query_name, :username, :password
|
|
17
|
-
attr_reader :environment, :logger, :logger_level
|
|
17
|
+
attr_reader :environment, :logger, :logger_level, :logger_file
|
|
18
18
|
|
|
19
19
|
def initialize
|
|
20
20
|
@environment = default_environment
|
|
@@ -39,6 +39,12 @@ module Usps
|
|
|
39
39
|
@logger = ActiveSupport::TaggedLogging.new(@base_logger)
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
+
def logger_file=(path)
|
|
43
|
+
@logger_file = path
|
|
44
|
+
@base_logger = Logger.new(@logger_file.nil? ? $stdout : @logger_file, level: logger.level)
|
|
45
|
+
@logger = ActiveSupport::TaggedLogging.new(@base_logger)
|
|
46
|
+
end
|
|
47
|
+
|
|
42
48
|
def silence!
|
|
43
49
|
self.logger = Logger.new(nil)
|
|
44
50
|
end
|
|
@@ -5,6 +5,8 @@ module Usps
|
|
|
5
5
|
# Formats log statements
|
|
6
6
|
#
|
|
7
7
|
class LoggerFormatter < ::Logger::Formatter
|
|
8
|
+
include ::ActiveSupport::TaggedLogging::Formatter
|
|
9
|
+
|
|
8
10
|
def call(severity, time, _progname, message)
|
|
9
11
|
log_chunks = [
|
|
10
12
|
format('%-5s', severity.to_s),
|
|
@@ -14,7 +16,7 @@ module Usps
|
|
|
14
16
|
'|',
|
|
15
17
|
formatted_tags,
|
|
16
18
|
'|',
|
|
17
|
-
message.sub(/^#{Regexp.escape(tags_text)}/, '')
|
|
19
|
+
message.to_s.sub(/^#{Regexp.escape(tags_text)}/, '')
|
|
18
20
|
]
|
|
19
21
|
"#{log_chunks.join(' ')}\n"
|
|
20
22
|
end
|
data/lib/usps/imis/version.rb
CHANGED