polish_validators_rails 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74e328f21ccf92fefc290aa51f847572581e3f68
4
- data.tar.gz: 2da252fe62c1773d4b3a182d77232398515dcf08
3
+ metadata.gz: 8ca47c57cdf8e5174866576e7e76ac91bc5e727c
4
+ data.tar.gz: d3ff84627f034ebe87cc07c2078abcc25c819b4a
5
5
  SHA512:
6
- metadata.gz: 1baab7bc7c96ff9222ad0dca5eae084a1ce282feab49e1c7ab659e5e631fc8c7db0ace85ff8387ae06d551954cee2957228f6db409c51f52d779f10bb5136c6b
7
- data.tar.gz: 59de90542ba57ea4df39d9df7a95f8b87fbec4ef7944606d719ecf7ec56b7affe9231b5974285bc19867b912bbec1cf380d8f128c34000c272f3c6008068a247
6
+ metadata.gz: 7c21b341bee28d902bd8f34b874dbb5dad58d7b1233b34809222db95405a4a767c442afff2e9802b6629baa19d49bd4f80ec40921df4ac32558b82e117681f28
7
+ data.tar.gz: a4c618e0330b42243634d33af39c12db85a3c90eea2bb9a08092e4f0f78b3934c87d8f28d84f81bd5846b824dbd7b8e8aab81c2c56dd87f4cbb06ab7712238ca
data/.travis.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - 2.2
4
+ - 2.3.1
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # PolishValidatorsRails [![Build Status](https://travis-ci.org/dbackowski/polish_validators_rails.svg?branch=master)](https://travis-ci.org/dbackowski/polish_validators_rails)
2
2
 
3
- Rails validators for polish numbers: PESEL, NIP, REGON
3
+ Rails validators for polish numbers: PESEL, NIP, REGON, IBAN (PL)
4
4
 
5
5
  ## Installation
6
6
 
@@ -24,17 +24,19 @@ Or install it yourself as:
24
24
  class User
25
25
  include ActiveModel::Validations
26
26
 
27
- attr_accessor :nip, :pesel, :regon
27
+ attr_accessor :nip, :pesel, :regon, :iban
28
28
 
29
29
  validates :nip, nip: true
30
30
  validates :pesel, pesel: true
31
31
  validates :regon, regon: true
32
+ validates :iban, iban: true
32
33
  end
33
34
 
34
35
  user = User.new
35
36
  user.nip = 1234563218
36
37
  user.pesel = 44051401359
37
38
  user.regon = 12345678512347
39
+ user.iban = 'PL61109010140000071219812874'
38
40
  user.valid?
39
41
  => true
40
42
  ```
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "polish_validators_rails"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -2,6 +2,13 @@ require 'polish_validators_rails/version'
2
2
  require 'polish_validators'
3
3
  require 'active_record'
4
4
 
5
+ class IbanValidator < ActiveModel::EachValidator
6
+ def validate_each(record, attribute, value)
7
+ validator = ::PolishValidators::IbanValidator.new(value)
8
+ record.errors.add(attribute, @options[:message] || 'Invalid IBAN format') unless validator.valid?
9
+ end
10
+ end
11
+
5
12
  class NipValidator < ActiveModel::EachValidator
6
13
  def validate_each(record, attribute, value)
7
14
  validator = ::PolishValidators::NipValidator.new(value)
@@ -1,3 +1,3 @@
1
1
  module PolishValidatorsRails
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = PolishValidatorsRails::VERSION
9
9
  spec.authors = ["Damian Baćkowski"]
10
10
  spec.email = ["dbackowski@artcom.pl"]
11
- spec.summary = %q{Rails validators for polish numbers: PESEL, NIP, REGON}
12
- spec.description = %q{Rails validators for polish numbers: PESEL, NIP, REGON}
11
+ spec.summary = %q{Rails validators for polish numbers: PESEL, NIP, REGON, IBAN}
12
+ spec.description = %q{Rails validators for polish numbers: PESEL, NIP, REGON, IBAN}
13
13
  spec.homepage = "https://github.com/dbackowski/polish_validators_rails"
14
14
  spec.license = "MIT"
15
15
 
@@ -18,9 +18,9 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_runtime_dependency 'polish_validators', '= 1.0.0', '= 1.0.0'
22
- spec.add_runtime_dependency 'activerecord', '>= 4.0.1', '< 5.0'
23
- spec.add_development_dependency "rspec", "~> 3.1"
21
+ spec.add_runtime_dependency 'polish_validators', '>= 1.0.1'
22
+ spec.add_runtime_dependency 'activerecord', '>= 4.0'
24
23
  spec.add_development_dependency "bundler", "~> 1.7"
25
- spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "rake", "~> 11.3.0"
25
+ spec.add_development_dependency "rspec", "~> 3.5.0"
26
26
  end
@@ -5,15 +5,20 @@ describe 'PolishValidatorRails' do
5
5
  class Dummy
6
6
  include ActiveModel::Validations
7
7
 
8
- attr_accessor :nip, :pesel, :regon
8
+ attr_accessor :nip, :pesel, :regon, :iban
9
9
 
10
10
  validates :nip, nip: true
11
11
  validates :pesel, pesel: true
12
12
  validates :regon, regon: true
13
+ validates :iban, iban: true
13
14
  end
14
15
  end
15
16
 
16
17
  describe 'any class that include ActiveModel::Validations' do
18
+ it "has :iban validator" do
19
+ expect(Dummy.validators.map(&:class).include?(IbanValidator)).to be_truthy
20
+ end
21
+
17
22
  it "has :nip validator" do
18
23
  expect(Dummy.validators.map(&:class).include?(NipValidator)).to be_truthy
19
24
  end
metadata CHANGED
@@ -1,105 +1,103 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polish_validators_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damian Baćkowski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-15 00:00:00.000000000 Z
11
+ date: 2016-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: polish_validators
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.0
19
+ version: 1.0.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 1.0.0
26
+ version: 1.0.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activerecord
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 4.0.1
34
- - - <
35
- - !ruby/object:Gem::Version
36
- version: '5.0'
33
+ version: '4.0'
37
34
  type: :runtime
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
- - - '>='
42
- - !ruby/object:Gem::Version
43
- version: 4.0.1
44
- - - <
38
+ - - ">="
45
39
  - !ruby/object:Gem::Version
46
- version: '5.0'
40
+ version: '4.0'
47
41
  - !ruby/object:Gem::Dependency
48
- name: rspec
42
+ name: bundler
49
43
  requirement: !ruby/object:Gem::Requirement
50
44
  requirements:
51
- - - ~>
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
- version: '3.1'
47
+ version: '1.7'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
51
  requirements:
58
- - - ~>
52
+ - - "~>"
59
53
  - !ruby/object:Gem::Version
60
- version: '3.1'
54
+ version: '1.7'
61
55
  - !ruby/object:Gem::Dependency
62
- name: bundler
56
+ name: rake
63
57
  requirement: !ruby/object:Gem::Requirement
64
58
  requirements:
65
- - - ~>
59
+ - - "~>"
66
60
  - !ruby/object:Gem::Version
67
- version: '1.7'
61
+ version: 11.3.0
68
62
  type: :development
69
63
  prerelease: false
70
64
  version_requirements: !ruby/object:Gem::Requirement
71
65
  requirements:
72
- - - ~>
66
+ - - "~>"
73
67
  - !ruby/object:Gem::Version
74
- version: '1.7'
68
+ version: 11.3.0
75
69
  - !ruby/object:Gem::Dependency
76
- name: rake
70
+ name: rspec
77
71
  requirement: !ruby/object:Gem::Requirement
78
72
  requirements:
79
- - - ~>
73
+ - - "~>"
80
74
  - !ruby/object:Gem::Version
81
- version: '10.0'
75
+ version: 3.5.0
82
76
  type: :development
83
77
  prerelease: false
84
78
  version_requirements: !ruby/object:Gem::Requirement
85
79
  requirements:
86
- - - ~>
80
+ - - "~>"
87
81
  - !ruby/object:Gem::Version
88
- version: '10.0'
89
- description: 'Rails validators for polish numbers: PESEL, NIP, REGON'
82
+ version: 3.5.0
83
+ description: 'Rails validators for polish numbers: PESEL, NIP, REGON, IBAN'
90
84
  email:
91
85
  - dbackowski@artcom.pl
92
- executables: []
86
+ executables:
87
+ - console
88
+ - setup
93
89
  extensions: []
94
90
  extra_rdoc_files: []
95
91
  files:
96
- - .gitignore
97
- - .rspec
98
- - .travis.yml
92
+ - ".gitignore"
93
+ - ".rspec"
94
+ - ".travis.yml"
99
95
  - Gemfile
100
96
  - LICENSE.txt
101
97
  - README.md
102
98
  - Rakefile
99
+ - bin/console
100
+ - bin/setup
103
101
  - lib/polish_validators_rails.rb
104
102
  - lib/polish_validators_rails/version.rb
105
103
  - polish_validators_rails.gemspec
@@ -115,20 +113,20 @@ require_paths:
115
113
  - lib
116
114
  required_ruby_version: !ruby/object:Gem::Requirement
117
115
  requirements:
118
- - - '>='
116
+ - - ">="
119
117
  - !ruby/object:Gem::Version
120
118
  version: '0'
121
119
  required_rubygems_version: !ruby/object:Gem::Requirement
122
120
  requirements:
123
- - - '>='
121
+ - - ">="
124
122
  - !ruby/object:Gem::Version
125
123
  version: '0'
126
124
  requirements: []
127
125
  rubyforge_project:
128
- rubygems_version: 2.0.14
126
+ rubygems_version: 2.5.1
129
127
  signing_key:
130
128
  specification_version: 4
131
- summary: 'Rails validators for polish numbers: PESEL, NIP, REGON'
129
+ summary: 'Rails validators for polish numbers: PESEL, NIP, REGON, IBAN'
132
130
  test_files:
133
131
  - spec/polish_validators_rails_spec.rb
134
132
  - spec/spec_helper.rb