IBAN 0.1.1 → 0.2.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 +9 -0
- data/iban.gemspec +1 -0
- data/lib/iban.rb +4 -2
- data/lib/{active_model/iban_validator.rb → iban/validator.rb} +2 -0
- data/lib/iban/version.rb +1 -1
- data/spec/activemodel_spec.rb +29 -0
- data/spec/spec_helper.rb +2 -0
- metadata +19 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 454a12c86cb6702c7d05c757e48d93f90d15a1a4
|
4
|
+
data.tar.gz: e10448ec9189e384306e427e04b9c89d95ffb203
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 074f4b0a9540ed5ba0a6d3ed57feb878c2a6deab08f0ce0604353171cb391db5bd6133b0e2e133ca16cb04c85c6d90ab3b931672cd09175cf4d322618e298e91
|
7
|
+
data.tar.gz: f97cc073c5d44aac9167a74505ca1bec0857897b2cf264116ab1951deb11949699421065228d276aa83f9b5bb2a3d255a2c811cf3de0b3332c95b92ce1f14c0e
|
data/README.md
CHANGED
@@ -41,6 +41,15 @@ Or install it yourself as:
|
|
41
41
|
|
42
42
|
IBAN.valid? "DE89 3704 0044 0532 0130 00" # true
|
43
43
|
|
44
|
+
or as ActiveModel Validator (make sure you have 'active_model' before 'vat_id' in your Gemfile)
|
45
|
+
|
46
|
+
class Company
|
47
|
+
include ActiveModel::Model
|
48
|
+
attr_accessor :iban, :name
|
49
|
+
validates :iban, iban: true
|
50
|
+
end
|
51
|
+
|
52
|
+
|
44
53
|
|
45
54
|
## Contributing
|
46
55
|
|
data/iban.gemspec
CHANGED
data/lib/iban.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
require
|
1
|
+
require "yaml"
|
2
|
+
require "iban/version"
|
3
|
+
require "iban/validator" if defined? ActiveModel
|
2
4
|
|
3
5
|
class IBAN
|
4
6
|
def self.specifications
|
5
|
-
@@specs ||= YAML.load_file(File.expand_path(
|
7
|
+
@@specs ||= YAML.load_file(File.expand_path("iban/specs.yml", File.dirname(__FILE__)))
|
6
8
|
end
|
7
9
|
|
8
10
|
def self.valid?(code)
|
data/lib/iban/version.rb
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class Company
|
4
|
+
include ActiveModel::Model
|
5
|
+
|
6
|
+
attr_accessor :iban, :name
|
7
|
+
validates :iban, iban: true
|
8
|
+
|
9
|
+
def persisted?
|
10
|
+
false
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe IbanValidator do
|
15
|
+
before {
|
16
|
+
@model = Company.new
|
17
|
+
}
|
18
|
+
|
19
|
+
it "should be valid" do
|
20
|
+
@model.iban = 'FR1420041010050500013M02606'
|
21
|
+
@model.valid?.must_equal true
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should not be valid" do
|
25
|
+
@model.iban = 'FR1420041010050500013'
|
26
|
+
@model.valid?.must_equal false
|
27
|
+
@model.errors[:iban].must_include "is invalid"
|
28
|
+
end
|
29
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: IBAN
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '4.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: activemodel
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
description: 'IBAN: International Bank Account Number'
|
56
70
|
email:
|
57
71
|
- kevin.melchert@gmail.com
|
@@ -66,10 +80,11 @@ files:
|
|
66
80
|
- README.md
|
67
81
|
- Rakefile
|
68
82
|
- iban.gemspec
|
69
|
-
- lib/active_model/iban_validator.rb
|
70
83
|
- lib/iban.rb
|
71
84
|
- lib/iban/specs.yml
|
85
|
+
- lib/iban/validator.rb
|
72
86
|
- lib/iban/version.rb
|
87
|
+
- spec/activemodel_spec.rb
|
73
88
|
- spec/iban_spec.rb
|
74
89
|
- spec/spec_helper.rb
|
75
90
|
homepage: https://github.com/max-power/iban
|
@@ -97,6 +112,7 @@ signing_key:
|
|
97
112
|
specification_version: 4
|
98
113
|
summary: IBAN information, validation and formatting.
|
99
114
|
test_files:
|
115
|
+
- spec/activemodel_spec.rb
|
100
116
|
- spec/iban_spec.rb
|
101
117
|
- spec/spec_helper.rb
|
102
118
|
has_rdoc:
|