api-moip-assinaturas 0.2.4 → 0.2.5
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.
- checksums.yaml +8 -8
- data/api_moip_assinaturas.gemspec +1 -1
- data/lib/moip/models/billing_info.rb +30 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjlhZWJjNGNjY2MyODVkMjkwNTMxNjIwYzYxNTg0NGI5Mjc5ZjVlMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MWI0NzhiNzUxNDNlMDQ5MzA3MmJjYTI4MGFiZTNjZWMyYWQ1MmRmZg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzU4MjBhY2E1MzI0NzE1MzEyODhlMDQwY2M5ZDY4YmVkZTkwOTM1NzBiNTkx
|
10
|
+
MmE3MmViMjQwODYxYjBhOGQ3NmMwYWY0N2M3ZmQzZjM1NTg0MjhkYTk1MjUz
|
11
|
+
YWM0ZWMyM2Q5M2FkNjUxNDc0MWJiMDI3OTViOGFhN2FlZjBhZWM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MGJhODgwNjc3ZjA2M2FkMmU1OTc0NzEyYjdkMDA2NDE4MDJlYTFkNzA3Yjk1
|
14
|
+
ZTZiYjE0YjRjOWJmNmEwMzlkYTA0NWMwMzc1YmM1OTdmODMyZjAzYjY3NjFl
|
15
|
+
ZjMxZTA1YWUxMjE3NmYxZDMxZjEzOTdjYmE2M2UyZjFmY2JkNjc=
|
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = 'api-moip-assinaturas'
|
6
|
-
s.version = '0.2.
|
6
|
+
s.version = '0.2.5'
|
7
7
|
s.date = '2013-06-26'
|
8
8
|
s.summary = "Moip Assinaturas by Pixxel"
|
9
9
|
s.description = "Gem desenvolvida para atender aos requisitos do moip api de assinaturas"
|
@@ -7,7 +7,37 @@ class Moip::BillingInfo < Moip::Model
|
|
7
7
|
validates_format_of :expiration_month, :with => /[0-9]{2}/
|
8
8
|
validates_format_of :expiration_year, :with => /[0-9]{2}/
|
9
9
|
validates_format_of :number, :with => /[0-9]{16}/
|
10
|
+
|
11
|
+
validate :valida_numero_cartao
|
12
|
+
|
13
|
+
|
14
|
+
def valida_numero_cartao
|
15
|
+
patterns.each do |pattern|
|
16
|
+
self.errors.add :number, "is invalid" and return if @number.to_s.match pattern
|
17
|
+
false
|
18
|
+
end
|
19
|
+
end
|
10
20
|
|
21
|
+
# pattens validates kind of cards where is invalid in some cases like:
|
22
|
+
# E.g.: 4444 5555 4444 6666, 1111 8888 4444 5555, 5555 6666 9999 7777
|
23
|
+
# has 10000 combinations
|
24
|
+
def patterns
|
25
|
+
@@patterns ||= []
|
26
|
+
|
27
|
+
if @@patterns.size == 0
|
28
|
+
for i in 0..9
|
29
|
+
for j in 0..9
|
30
|
+
for k in 0..9
|
31
|
+
for l in 0..9
|
32
|
+
@@patterns << Regexp.new("[#{i}]{4}[#{j}]{4}[#{k}]{4}[#{l}]{4}")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
@@patterns
|
40
|
+
end
|
11
41
|
|
12
42
|
def attributes
|
13
43
|
{
|