credit_card_validations 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +41 -31
- data/credit_card_validations.gemspec +2 -0
- data/lib/credit_card_validations/version.rb +1 -1
- metadata +27 -5
data/README.md
CHANGED
@@ -3,28 +3,57 @@
|
|
3
3
|
Gem adds validator to check whether or not a given number actually falls within the ranges of possible numbers prior to performing such verification, and, as such, CreditCardValidations simply verifies that the credit card number provided is well-formed.
|
4
4
|
This is a port of Zend Framework `Zend\Validator\CreditCard` .
|
5
5
|
|
6
|
-
|
6
|
+
## Build status
|
7
|
+
[![Build Status](https://travis-ci.org/Fivell/credit_card_validations.png)](https://travis-ci.org/Fivell/credit_card_validations)
|
8
|
+
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
gem 'credit_card_validations'
|
15
|
+
|
16
|
+
And then execute:
|
7
17
|
|
18
|
+
$ bundle
|
8
19
|
|
9
|
-
|
10
|
-
China UnionPay
|
11
|
-
Diners Club
|
12
|
-
Dinner Club US
|
13
|
-
Discover
|
14
|
-
JCB
|
15
|
-
Maestro
|
16
|
-
MasterCard
|
17
|
-
Solo
|
18
|
-
Visa
|
20
|
+
Or install it yourself as:
|
19
21
|
|
22
|
+
$ gem install credit_card_validations
|
20
23
|
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
|
27
|
+
The following issuing institutes are accepted:
|
28
|
+
|
29
|
+
name | key
|
30
|
+
-----------------------
|
31
|
+
American Express | :amex
|
32
|
+
China UnionPay | :unionpay
|
33
|
+
Diners Club | :diners
|
34
|
+
Dinner Club US | :diners_us
|
35
|
+
Discover | :discover
|
36
|
+
JCB | :jcb
|
37
|
+
Maestro | :maestro
|
38
|
+
MasterCard | :mastercard
|
39
|
+
Solo | :solo
|
40
|
+
Visa | :visa
|
41
|
+
|
42
|
+
|
43
|
+
Examples
|
44
|
+
|
45
|
+
number = "41111111111111111"
|
46
|
+
CreditCardValidations::Detector.new(number).brand #:visa
|
47
|
+
CreditCardValidations::Detector.new(number).visa? #true
|
48
|
+
CreditCardValidations::Detector.new(number).valid?(:mastercard,:maestro) #false
|
49
|
+
CreditCardValidations::Detector.new(number).valid?(:visa, :mastercard) #true
|
21
50
|
|
22
51
|
Also You can add your own rules to detect other credit card brands/types
|
23
52
|
passing name,length(integer/array of integers) and prefix(string/array of strings)
|
24
53
|
Example
|
25
54
|
|
26
55
|
CreditCardValidations::Detector.add_rule(:voyager, 15, '86')
|
27
|
-
|
56
|
+
voyager_test_card_number = '869926275400212'
|
28
57
|
CreditCardValidations::Detector.new(voyager_test_card_number).brand #:voyager
|
29
58
|
CreditCardValidations::Detector.new(voyager_test_card_number).voyager? #true
|
30
59
|
|
@@ -47,25 +76,6 @@ for all known brands
|
|
47
76
|
|
48
77
|
|
49
78
|
|
50
|
-
|
51
|
-
## Installation
|
52
|
-
|
53
|
-
Add this line to your application's Gemfile:
|
54
|
-
|
55
|
-
gem 'credit_card_validations'
|
56
|
-
|
57
|
-
And then execute:
|
58
|
-
|
59
|
-
$ bundle
|
60
|
-
|
61
|
-
Or install it yourself as:
|
62
|
-
|
63
|
-
$ gem install credit_card_validations
|
64
|
-
|
65
|
-
## Usage
|
66
|
-
|
67
|
-
|
68
|
-
|
69
79
|
## Contributing
|
70
80
|
|
71
81
|
1. Fork it
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: credit_card_validations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2013-03-19 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|
16
|
-
requirement: &
|
16
|
+
requirement: &70284411124720 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '3.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70284411124720
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: activesupport
|
27
|
-
requirement: &
|
27
|
+
requirement: &70284411123600 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,29 @@ dependencies:
|
|
32
32
|
version: '3.0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70284411123600
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: test-unit
|
38
|
+
requirement: &70284411122800 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70284411122800
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: &70284411138640 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70284411138640
|
36
58
|
description: A ruby gem for validating credit card numbers (a port of ZF2 Zend\Validator\CreditCard)
|
37
59
|
—
|
38
60
|
email:
|