banktools-gb 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -12
- data/banktools-gb.gemspec +0 -1
- data/lib/banktools-gb.rb +0 -3
- data/lib/banktools-gb/errors.rb +0 -1
- data/lib/banktools-gb/version.rb +1 -1
- metadata +1 -16
- data/lib/banktools-gb/account_number_and_sort_code.rb +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 102538128b1b587219b24bc7c1513972722502aa
|
4
|
+
data.tar.gz: b034463d437666eaee598d8b4464fddee40eee81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e8778fd23af453510ef52e325ddb70cd39c7956b78469c7b4e8aaa1a02185830ea254e54103099c44c545fe60164dcc1abe58fd54c0c94b6d1165a78b0e5dde
|
7
|
+
data.tar.gz: bd9a364de035f617bf7f152460b04f00de89ef56d42c2a37a1ed6a9d4b48e0353413a3c9b012f88163652d4b6c8fe8615a54d7342bb98a6543333e876e5cc98c
|
data/README.md
CHANGED
@@ -30,18 +30,6 @@ If we got anything wrong, please file an issue or contribute a fix yourself.
|
|
30
30
|
bad_account.valid? # => false
|
31
31
|
bad_account.errors # => [ :too_short ]
|
32
32
|
|
33
|
-
|
34
|
-
# Account and sort code (checksum check and others)
|
35
|
-
# This relies on [our fork of the uk_account_validator gem](https://github.com/barsoom/uk_account_validator). If that gem is out of date, the checksum check may be also.
|
36
|
-
|
37
|
-
account_and_sort_code = BankTools::GB::AccountNumberAndSortCode.new(account_number_original_value: 14248387, sort_code_original_value: 405161).valid?
|
38
|
-
account_and_sort_code.valid? # => true
|
39
|
-
account_and_sort_code.errors # => []
|
40
|
-
|
41
|
-
account_and_sort_code = BankTools::GB::AccountNumberAndSortCode.new(account_number_original_value: 14248387, sort_code_original_value: "xx")
|
42
|
-
account_and_sort_code.valid? # => false
|
43
|
-
account_and_sort_code.errors # => [:sort_code_too_short, :sort_code_invalid_characters, :bad_checksum]
|
44
|
-
|
45
33
|
## Installation
|
46
34
|
|
47
35
|
Add this line to your application's Gemfile:
|
data/banktools-gb.gemspec
CHANGED
@@ -18,7 +18,6 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "uk_account_validator_auctionet", "~> 0"
|
22
21
|
spec.add_dependency "attr_extras", "~> 5"
|
23
22
|
|
24
23
|
spec.add_development_dependency "bundler", "~> 1"
|
data/lib/banktools-gb.rb
CHANGED
data/lib/banktools-gb/errors.rb
CHANGED
data/lib/banktools-gb/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: banktools-gb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomas Skogberg
|
@@ -10,20 +10,6 @@ bindir: exe
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2018-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: uk_account_validator_auctionet
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: attr_extras
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -99,7 +85,6 @@ files:
|
|
99
85
|
- bin/setup
|
100
86
|
- lib/banktools-gb.rb
|
101
87
|
- lib/banktools-gb/account.rb
|
102
|
-
- lib/banktools-gb/account_number_and_sort_code.rb
|
103
88
|
- lib/banktools-gb/errors.rb
|
104
89
|
- lib/banktools-gb/sort_code.rb
|
105
90
|
- lib/banktools-gb/version.rb
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require "attr_extras/explicit"
|
2
|
-
require "banktools-gb/errors"
|
3
|
-
|
4
|
-
module BankTools
|
5
|
-
module GB
|
6
|
-
class AccountNumberAndSortCode
|
7
|
-
extend AttrExtras.mixin
|
8
|
-
|
9
|
-
pattr_initialize [ :account_number_original_value, :sort_code_original_value ]
|
10
|
-
|
11
|
-
def valid?
|
12
|
-
errors.none?
|
13
|
-
end
|
14
|
-
|
15
|
-
def errors
|
16
|
-
errors = []
|
17
|
-
|
18
|
-
errors << account_number.errors
|
19
|
-
errors << sort_code.errors
|
20
|
-
errors << Errors::BAD_CHECKSUM unless valid_account_number_and_sort_code?
|
21
|
-
|
22
|
-
errors.flatten
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
def account_number
|
28
|
-
Account.new(account_number_original_value)
|
29
|
-
end
|
30
|
-
|
31
|
-
def sort_code
|
32
|
-
SortCode.new(sort_code_original_value)
|
33
|
-
end
|
34
|
-
|
35
|
-
def valid_account_number_and_sort_code?
|
36
|
-
UkAccountValidator::Validator.new(account_number.compacted_value, sort_code.compacted_value).valid?
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|