postcode_validation 0.0.1 → 0.0.2

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
  SHA1:
3
- metadata.gz: ea004687bfaa8fea973fd7b953dcd19b26dd224c
4
- data.tar.gz: 454c66d84f41f92518b984dcbc058bce3e1e5b06
3
+ metadata.gz: 969757f1b9dadfcc8c8558149da021ca01ac30f1
4
+ data.tar.gz: 74e813efac7b28877b0b1ba5c63e4d78709eb77e
5
5
  SHA512:
6
- metadata.gz: fbab8666322cf4a8bfdea31004fda11f676f514cbe83de005a6119e52a569e53271ea9a30196fd7e33a99baf47c8668f9a70f153ad8bc521de74573e9f8e8f43
7
- data.tar.gz: d4a4627d2e1880fd0546d46ea31f0b2fca2075ec5acdaec14a26753a87171f540e1da043eaeeb8a6d6ee6cb302de8e8886ed37857884b7c934ad30d3e956e7e4
6
+ metadata.gz: 4bb9d8016d76ae1fe87201a5e7bd702aadf2b71feee1f88ea36c740e8b4043ac53d7e653961883c0eaf493848cf1f6a8369b1ef26e2ee0f0c2462bd71a3bb24f
7
+ data.tar.gz: 1e1cf7282b35ce418aa6c1b496c0471b5518ae164a6d6bc64ab59ab83dac41b3e3bb7390471a579402760541987b85fe775016c9b6f0a1b6c768b364ce536d0c
@@ -1,4 +1,10 @@
1
1
  module PostcodeValidation
2
+ class RailsLogger
3
+ def error(error)
4
+ Rails.logger.tagged('Remote-Validate-Address') { Rails.logger.error(error.message) }
5
+ end
6
+ end
7
+
2
8
  module SpreeOrderPostcodeValid
3
9
  extend ActiveSupport::Concern
4
10
 
@@ -26,7 +32,8 @@ module PostcodeValidation
26
32
 
27
33
  def use_case
28
34
  PostcodeValidation::UseCase::ValidateAddress.new(
29
- address_match_gateway: PostcodeValidation::Gateway::PCAPotentialAddressMatch.new
35
+ address_match_gateway: PostcodeValidation::Gateway::PCAPotentialAddressMatch.new,
36
+ logger: PostcodeValidation::RailsLogger.new
30
37
  )
31
38
  end
32
39
  end
@@ -1,8 +1,9 @@
1
1
  module PostcodeValidation
2
2
  module UseCase
3
3
  class ValidateAddress
4
- def initialize(address_match_gateway:)
4
+ def initialize(address_match_gateway:, logger: nil)
5
5
  @address_match_gateway = address_match_gateway
6
+ @logger = logger
6
7
  end
7
8
 
8
9
  def execute(postcode:, country:)
@@ -16,9 +17,11 @@ module PostcodeValidation
16
17
 
17
18
  private
18
19
 
19
- attr_reader :address_match_gateway, :postcode, :country
20
+ attr_reader :address_match_gateway, :logger, :postcode, :country
20
21
 
21
- def on_error(e) ; end
22
+ def on_error(e)
23
+ logger.error(e) unless logger.nil?
24
+ end
22
25
 
23
26
  def valid_postcode?
24
27
  address = first_potential_address
@@ -1,3 +1,3 @@
1
1
  module PostcodeValidation
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postcode_validation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Craig J. Bass