credit_card_validation 0.0.1 → 1.0.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.
- data/README.mdown +22 -19
- data/lib/credit_card_validation/version.rb +1 -1
- metadata +3 -3
data/README.mdown
CHANGED
@@ -3,32 +3,35 @@
|
|
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
|
-
|
7
|
-
|
8
|
-
|
9
|
-
# and run
|
10
|
-
bundle
|
6
|
+
```ruby
|
7
|
+
# add this to your Gemfile
|
8
|
+
gem "credit_card_validation"
|
11
9
|
|
10
|
+
# and run
|
11
|
+
bundle
|
12
|
+
```
|
12
13
|
### Usage
|
13
14
|
|
14
15
|
#### With ActiveRecord
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
16
|
+
```ruby
|
17
|
+
class Order < ActiveRecord::Base
|
18
|
+
# standard validation
|
19
|
+
validates :card_number, credit_card: true
|
20
|
+
|
21
|
+
# with legacy syntax
|
22
|
+
validates_credit_card :card_number
|
23
|
+
end
|
24
|
+
```
|
23
25
|
#### With ActiveModel
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
attr_accessor :card_number
|
26
|
+
```ruby
|
27
|
+
class Order
|
28
|
+
include ActiveModel::Validations
|
28
29
|
|
29
|
-
|
30
|
-
end
|
30
|
+
attr_accessor :card_number
|
31
31
|
|
32
|
+
validates :card_number, credit_card: true
|
33
|
+
end
|
34
|
+
```
|
32
35
|
#### I18n
|
33
36
|
|
34
37
|
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: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -158,7 +158,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
158
158
|
version: '0'
|
159
159
|
segments:
|
160
160
|
- 0
|
161
|
-
hash:
|
161
|
+
hash: -3495329243541790356
|
162
162
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
163
|
none: false
|
164
164
|
requirements:
|
@@ -167,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
167
|
version: '0'
|
168
168
|
segments:
|
169
169
|
- 0
|
170
|
-
hash:
|
170
|
+
hash: -3495329243541790356
|
171
171
|
requirements: []
|
172
172
|
rubyforge_project: credit_card_validation
|
173
173
|
rubygems_version: 1.8.24
|