usps-imis-api 0.9.0 → 0.9.1

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: e94dcde6abaf560148b72523c9defe96cd30f6980631f11b79cf8b35f52a1dcc
4
- data.tar.gz: a94d8ce631656ff48bf6c3b905e3e06bf130a5a658dfad737afec2be21ac1957
3
+ metadata.gz: 303b15f935a8eada8e8cbe1d22448e6c863c7d3dff017df0ccd4b77a48928727
4
+ data.tar.gz: f53472c5476db6312cfac1d0fdb0defbe5e972bf358451cab3b3ad0cf7ba527e
5
5
  SHA512:
6
- metadata.gz: 1c155ff3c3e0801c4cb1d738c736e7da9833b651ba56cafb5983439d8e7708f15a266f688d40672917270745b198cac6a38e86b735932c447a631b1c5922b17d
7
- data.tar.gz: e99827b9bb433d673c6d76558c209f23a12aba1dbe22a674d4972f8ff97b0122374cb4ef2955c0b903ebcf5f7d20721c15b800b79cba17c304113436ea8c66a9
6
+ metadata.gz: ba3063a80b49011442528694ffab0901e5562d340ee65ec8ddc1a0bf9d07ec8a59e6930e7002154b51c421ec83bdc3ee8cf089c3818f0ffd32affd277d7c573e
7
+ data.tar.gz: 116fa8f0b62b65ec78ca7dbc56b7cc9f9cd557e5522a321a5b0904dfb76d65e5f1d3564ad66c5671f54f5db217321d7029f6899d0f49e472d72cf41d00a90c0d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- usps-imis-api (0.9.0)
4
+ usps-imis-api (0.9.1)
5
5
  activesupport (~> 8.0)
6
6
 
7
7
  GEM
@@ -41,6 +41,10 @@ module Usps
41
41
  # Ruby 3.5 instance variable filter
42
42
  #
43
43
  def instance_variables_to_inspect = %i[@environment @imis_id_query_name @username @logger_level]
44
+
45
+ # Parameters to filter out of logging
46
+ #
47
+ def filtered_parameters = %i[password]
44
48
  end
45
49
  end
46
50
  end
@@ -28,7 +28,7 @@ module Usps
28
28
 
29
29
  def submit(uri, request)
30
30
  Imis.logger.info 'Submitting request to iMIS'
31
- Imis.logger.debug " -> #{uri}"
31
+ Imis.logger.debug " -> #{request.class.name.demodulize.upcase} #{uri}"
32
32
  sanitized_request_body(request).split("\n").each { Imis.logger.debug " -> #{it}" }
33
33
  client(uri).request(request).tap do |result|
34
34
  raise Errors::ResponseError.from(result) unless result.is_a?(Net::HTTPSuccess)
@@ -38,9 +38,17 @@ module Usps
38
38
  end
39
39
 
40
40
  def sanitized_request_body(request)
41
- return 'grant_type=password&username=[filtered]&password=[filtered]' if request.body&.include?('password=')
41
+ return '*** empty request body ***' if request.body.nil?
42
42
 
43
- request.body.nil? ? '*** empty request body ***' : JSON.pretty_generate(JSON.parse(request.body))
43
+ body = request.body.dup
44
+
45
+ Imis.config.filtered_parameters.each do |parameter|
46
+ body =
47
+ body.gsub(Imis.config.public_send(parameter), '[FILTERED]')
48
+ .gsub(CGI.escape(Imis.config.public_send(parameter)), '[FILTERED]')
49
+ end
50
+
51
+ body
44
52
  end
45
53
  end
46
54
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Usps
4
4
  module Imis
5
- VERSION = '0.9.0'
5
+ VERSION = '0.9.1'
6
6
  end
7
7
  end
data/lib/usps/imis.rb CHANGED
@@ -32,6 +32,7 @@ module Usps
32
32
  def configuration
33
33
  @configuration ||= Config.new
34
34
  end
35
+ alias config configuration
35
36
 
36
37
  # Used to define a block of configuration settings
37
38
  #
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.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander