api-moip-assinaturas 0.2.15 → 0.2.16
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/locale/en.yml +4 -1
- data/lib/moip/models/billing_info.rb +25 -5
- data/lib/moip/models/customer.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ODgwY2ExOGVmYjM1NzY3YjIxMWVjODAwZWEzMjRiZjkwODgwZjAzZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MTU0NWMxZjIxY2U4OWZiZGM1MmYwYzY4ZjUwMDQ0N2JkNGY2MGU4Yw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzYzNzZiNDFiOTVmY2E0N2ZiZjk0YmY5OTA5M2ZmOTU4N2Y2ZDJjYzBmMzM5
|
10
|
+
NTE5ZTU1OWNkMDBiOWMzMDdhZDlkMTUxMDJmMzBiYzE4MzJmNTI3YzgxM2I0
|
11
|
+
MWM5ZTYxMjBiNmYyNGQzZDAzODBjNTMxOWI1YTA5NTc4ZGUwZDA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDA1YzRjMTdiNDM1ZDZlYzhmMzJhMGMwZDI4ZjYwNjBmZWY1OGYwMTlkNjFj
|
14
|
+
ZDg2NTg5NzU1ZWM0MDM2OWQ2OTM2MGExOWVkZjA0MDQ5MTNmMzFiOTg0ZDBh
|
15
|
+
MGU5ZjYyMzJhNThkNWEyYWFmODE3YjkxZTU0NjJmNTlmMDY2MjE=
|
@@ -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.16'
|
7
7
|
s.date = '2013-07-02'
|
8
8
|
s.summary = "Moip Assinaturas by Pixxel"
|
9
9
|
s.description = "Gem desenvolvida para atender aos requisitos do moip api de assinaturas"
|
data/lib/moip/locale/en.yml
CHANGED
@@ -3,4 +3,7 @@ en:
|
|
3
3
|
errors:
|
4
4
|
presence_of_address: "can't be blank"
|
5
5
|
presence_of_billing_info: "can't be blank"
|
6
|
-
invalid_format: "invalid format"
|
6
|
+
invalid_format: "invalid format"
|
7
|
+
invalid_card_number: "invalid card number"
|
8
|
+
invalid_expiration_year: "invalid expiration year"
|
9
|
+
invalid_expiration_month: "invalid expiration month"
|
@@ -4,12 +4,32 @@ class Moip::BillingInfo < Moip::Model
|
|
4
4
|
|
5
5
|
validates :holder_name, :number, :expiration_month, :expiration_year, :presence => true
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
validates_format_of :number, :with => /[0-9]{16}/
|
10
|
-
|
11
|
-
validate :valida_numero_cartao
|
7
|
+
validate :valida_numero_cartao, :validates_format_of_number,
|
8
|
+
:validates_format_of_expiration_month, :validates_format_of_expiration_year
|
12
9
|
|
10
|
+
def validates_format_of_number
|
11
|
+
if self.number.to_s.match /[0-9]{16}/
|
12
|
+
true
|
13
|
+
else
|
14
|
+
self.errors.add :number, I18n.t("moip.errors.invalid_card_number")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def validates_format_of_expiration_year
|
19
|
+
if self.expiration_year.to_s.match /[0-9]{2}/
|
20
|
+
true
|
21
|
+
else
|
22
|
+
self.errors.add :expiration_year, I18n.t("moip.errors.invalid_expiration_year")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def validates_format_of_expiration_month
|
27
|
+
if self.expiration_month.to_s.match /[0-9]{2}/
|
28
|
+
true
|
29
|
+
else
|
30
|
+
self.errors.add :expiration_month, I18n.t("moip.errors.invalid_expiration_month")
|
31
|
+
end
|
32
|
+
end
|
13
33
|
|
14
34
|
def valida_numero_cartao
|
15
35
|
patterns.each do |pattern|
|
data/lib/moip/models/customer.rb
CHANGED
@@ -34,7 +34,7 @@ class Moip::Customer < Moip::Model
|
|
34
34
|
if options.is_a? Hash
|
35
35
|
@address = Moip::Address.build options
|
36
36
|
elsif options.is_a? Moip::Address
|
37
|
-
@address =
|
37
|
+
@address = options
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -46,7 +46,7 @@ class Moip::Customer < Moip::Model
|
|
46
46
|
if options.is_a? Hash
|
47
47
|
@billing_info = Moip::BillingInfo.build options
|
48
48
|
elsif options.is_a? Moip::BillingInfo
|
49
|
-
@billing_info =
|
49
|
+
@billing_info = options
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|