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 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
- The following issuing institutes are accepted:
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
- American Express
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
- voyager_test_card_number = '869926275400212'
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
@@ -19,4 +19,6 @@ Gem::Specification.new do |gem|
19
19
 
20
20
  gem.add_dependency('activemodel', '~> 3.0')
21
21
  gem.add_dependency('activesupport', '~> 3.0')
22
+ gem.add_development_dependency "test-unit"
23
+ gem.add_development_dependency 'rake'
22
24
  end
@@ -1,3 +1,3 @@
1
1
  module CreditCardValidations
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
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.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: &70262684219780 !ruby/object:Gem::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: *70262684219780
24
+ version_requirements: *70284411124720
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activesupport
27
- requirement: &70262684219080 !ruby/object:Gem::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: *70262684219080
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: