credit_card_validation 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +4 -0
- data/README.mdown +14 -2
- data/lib/credit_card_validation/version.rb +1 -1
- metadata +4 -3
data/.travis.yml
ADDED
data/README.mdown
CHANGED
@@ -1,18 +1,24 @@
|
|
1
|
-
# Credit Card Validation
|
1
|
+
# Credit Card Validation ![image](https://api.travis-ci.org/rahult/credit_card_validation.png)
|
2
2
|
|
3
3
|
This gem adds the capability of validating credit cards to ActiveRecord and ActiveModel (Rails 3+) and Ruby 1.9.2+.
|
4
4
|
|
5
5
|
### Installation
|
6
|
+
|
6
7
|
```ruby
|
7
8
|
# add this to your Gemfile
|
8
9
|
gem "credit_card_validation"
|
10
|
+
```
|
11
|
+
|
12
|
+
### and run
|
9
13
|
|
10
|
-
|
14
|
+
```ruby
|
11
15
|
bundle
|
12
16
|
```
|
17
|
+
|
13
18
|
### Usage
|
14
19
|
|
15
20
|
#### With ActiveRecord
|
21
|
+
|
16
22
|
```ruby
|
17
23
|
class Order < ActiveRecord::Base
|
18
24
|
# standard validation
|
@@ -20,9 +26,14 @@ class Order < ActiveRecord::Base
|
|
20
26
|
|
21
27
|
# with legacy syntax
|
22
28
|
validates_credit_card :card_number
|
29
|
+
|
30
|
+
# with custom message
|
31
|
+
validates :card_number, credit_card: { message: "card is not valid?" }
|
23
32
|
end
|
24
33
|
```
|
34
|
+
|
25
35
|
#### With ActiveModel
|
36
|
+
|
26
37
|
```ruby
|
27
38
|
class Order
|
28
39
|
include ActiveModel::Validations
|
@@ -32,6 +43,7 @@ class Order
|
|
32
43
|
validates :card_number, credit_card: true
|
33
44
|
end
|
34
45
|
```
|
46
|
+
|
35
47
|
#### I18n
|
36
48
|
|
37
49
|
The default error message `is not a valid credit card`.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: credit_card_validation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -165,6 +165,7 @@ extra_rdoc_files: []
|
|
165
165
|
files:
|
166
166
|
- .gitignore
|
167
167
|
- .rvmrc
|
168
|
+
- .travis.yml
|
168
169
|
- Gemfile
|
169
170
|
- Guardfile
|
170
171
|
- README.mdown
|
@@ -190,7 +191,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
190
191
|
version: '0'
|
191
192
|
segments:
|
192
193
|
- 0
|
193
|
-
hash: -
|
194
|
+
hash: -11332019370328868
|
194
195
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
195
196
|
none: false
|
196
197
|
requirements:
|
@@ -199,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
200
|
version: '0'
|
200
201
|
segments:
|
201
202
|
- 0
|
202
|
-
hash: -
|
203
|
+
hash: -11332019370328868
|
203
204
|
requirements: []
|
204
205
|
rubyforge_project: credit_card_validation
|
205
206
|
rubygems_version: 1.8.25
|