correios-sro_validator 0.1.2 → 0.2.0

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: e0ddd88501d8c8e916adbe9260c5906f0f01d390
4
- data.tar.gz: 3163852c395fcbe0d3dfdddf7490a0cbdcbdc46c
3
+ metadata.gz: d2df83f0f7bc912af5cfa3f0445a4fd441e17b59
4
+ data.tar.gz: 93e244c3bc2404120bea9107e569006fd7bb5043
5
5
  SHA512:
6
- metadata.gz: 416f595b9d177103d22ee9bb56f405e10b6c87b7e1ab669ce3d0d8a07bc8a2c4c47f1dad223f4d0571fb26c1375b0cd536bb9109b988ee23b5f5aeeeb98baf1b
7
- data.tar.gz: 6359ed8e71a9eacb360b6fdde4ab89a855ae1b02f27a551c90eb11ff08bc353b55ed2bc30d86c370b7549795fd68e58b28de9ca0759d1d29a8ae61ed584f03fe
6
+ metadata.gz: 87f844682e84947942faeaa3717a4e23f17216af200427f6fd23140e9318e4b26094ab99d1a1d5b6bd6e214d9bf88b7c556d263581b953e2d23a8631bef01fc3
7
+ data.tar.gz: 65897fd279a34a487ff95ebb200356c1ee559689ae29a1c88d583fef5220ac9d2b0f69ceabeaada3144e3c981ea3293143e49ea77aa97fb44b53f1d203f0c0de
@@ -12,24 +12,24 @@ module Correios
12
12
  #
13
13
  class SROValidator
14
14
 
15
- WEIGHTING_FACTORS = [8, 6, 4, 2, 3, 5, 9, 7]
15
+ WEIGHTING_FACTORS = [8, 6, 4, 2, 3, 5, 9, 7].freeze
16
16
 
17
17
  CONTROL_DIGIT = {
18
18
  0 => 5,
19
19
  1 => 0
20
- }
21
-
22
- attr_reader :sro, :numbers, :verification_digit
20
+ }.freeze
23
21
 
22
+ attr_reader :sro, :sanitized_sro, :numbers, :verification_digit
24
23
 
25
24
  # Initializer the SROValidator
26
25
  #
27
- # @param [String] sro describe sro
26
+ # @param [String] sro Tracking Code like: LX473124829BR
28
27
  # @param [String] suffix_match = 'BR' the regex match suffix (BR as default)
29
28
  # @return [self] SROValidator
30
29
  def initialize(sro, suffix_match = 'BR')
31
- @sro = sro.to_s.strip.upcase
32
- @sro =~ /^[A-Z|a-z]{2}([0-9]{8})([0-9])#{suffix_match}$/
30
+ @sro = sro
31
+ @sanitized_sro = sro.to_s.strip.upcase
32
+ @sanitized_sro =~ /^[A-Z|a-z]{2}([0-9]{8})([0-9])#{suffix_match}$/
33
33
  @numbers = ($1 || "")
34
34
  @verification_digit = $2.to_i
35
35
  end
@@ -1,5 +1,5 @@
1
1
  module Correios
2
2
  class SROValidator
3
- VERSION = "0.1.2"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: correios-sro_validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lennon Manchester
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-05 00:00:00.000000000 Z
11
+ date: 2016-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler