api-moip-assinaturas 0.2.24 → 0.2.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/api_moip_assinaturas.gemspec +1 -1
- data/lib/moip/model.rb +2 -2
- data/lib/moip/models/billing_info.rb +4 -0
- data/lib/moip/models/customer.rb +14 -1
- data/lib/moip/models/payment.rb +7 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTE5Y2IzMDBjZGJhMDg1MWY2ZGNjYTNkODlmMDhlZjUzODkwMTc5OQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTNiYTEzYmQ3N2M0ZGRjZGNlNmE3MWIwY2I2ZmQyZTRjNmQ0NTQ4YQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MzgxZjIwYWQyZTU0MzY0ZTkwNGNjYzk5ZjA1NjFiNDVmMjJmZjc3NDEwNGUw
|
10
|
+
Y2E4Njk4ZTQ4NzMzMzg5NDMwYWRiYmYwNWJkMmJhZGMwZmE3ZTdkYTA0ODdi
|
11
|
+
YWEyZmM1MzNhZGUwNmQyNmZhYzYyNzc1YWU0MDNkMzk3N2JjODg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OGMwZjhmMzE4NGNjZTNhYmU5YmQwZGE0ZWM1NjAwZjBiZDc1NjJkNDAyYjc4
|
14
|
+
ZGEyOTMwYzEyMzQyMDM5NTdiN2EzNjI5Y2Y2MzVkMWU2Zjc2ZmQ3YWEwNWU5
|
15
|
+
MmUyN2IxOWI3YjQ4OGIzNTQ1NWE5Y2Y1MjhiZWY2MmU4NmRhNzY=
|
@@ -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.25'
|
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/model.rb
CHANGED
@@ -15,8 +15,8 @@ module Moip
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
19
|
-
if response.key? "errors"
|
18
|
+
def validate_response response
|
19
|
+
if response.key? "errors" and response["errors"].size > 0
|
20
20
|
error = response["errors"][0]
|
21
21
|
self.errors.add :moip_error, "[#{error["code"]}] #{error["description"]}"
|
22
22
|
false
|
data/lib/moip/models/customer.rb
CHANGED
@@ -6,7 +6,8 @@ class Moip::Customer < Moip::Model
|
|
6
6
|
# see http://moiplabs.github.io/assinaturas-docs/api.html#criar_cliente
|
7
7
|
attr_accessor :code, :email, :fullname, :cpf, :phone_area_code,
|
8
8
|
:phone_number, :birthdate_day, :birthdate_month,
|
9
|
-
:birthdate_year, :address, :billing_info, :customers
|
9
|
+
:birthdate_year, :address, :billing_info, :customers,
|
10
|
+
:creation_date, :creation_time
|
10
11
|
|
11
12
|
validates :code, :email, :fullname, :cpf, :phone_area_code,
|
12
13
|
:phone_number, :birthdate_day, :birthdate_month,
|
@@ -108,6 +109,18 @@ class Moip::Customer < Moip::Model
|
|
108
109
|
false
|
109
110
|
end
|
110
111
|
end
|
112
|
+
|
113
|
+
|
114
|
+
# metodo que envia as informações para a API do moip e atualiza os dados do cartão
|
115
|
+
# see http://moiplabs.github.io/assinaturas-docs/api.html#atualizar_cartao
|
116
|
+
def update_billing_info billing_info
|
117
|
+
if billing_info.valid?
|
118
|
+
response = self.class.post(base_url(:customers, :code => self.code, :status => "billing_infos"), default_header(self.build_update.to_json)).parsed_response
|
119
|
+
else
|
120
|
+
false
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
111
124
|
|
112
125
|
def find code
|
113
126
|
response = self.class.get(base_url(:customers, :code => code), default_header).parsed_response
|
data/lib/moip/models/payment.rb
CHANGED
@@ -43,5 +43,12 @@ class Moip::Payment < Moip::Model
|
|
43
43
|
self.set_parameters response unless response.nil?
|
44
44
|
end
|
45
45
|
|
46
|
+
def retry
|
47
|
+
response = self.class.get(base_url(:payments, :code => self.id, :status => "retry"), default_header).parsed_response
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.retry id
|
51
|
+
response = self.class.get(base_url(:payments, :code => id, :status => "retry"), default_header).parsed_response
|
52
|
+
end
|
46
53
|
|
47
54
|
end
|