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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MjAzNDhjM2NjZTVlZjg5MzZkMGEzMmQzZDZjYzFlZDQ2Y2Y3MTE0Mw==
4
+ MTE5Y2IzMDBjZGJhMDg1MWY2ZGNjYTNkODlmMDhlZjUzODkwMTc5OQ==
5
5
  data.tar.gz: !binary |-
6
- YzlkZjc3ODY4ZTU1NzkxMTA0ZDZhNzU4ODNhMzI2NTFmZWNlZWY4Nw==
6
+ OTNiYTEzYmQ3N2M0ZGRjZGNlNmE3MWIwY2I2ZmQyZTRjNmQ0NTQ4YQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MDM1OGM3MjVlZjFlZWJhODEzZmFjNDA5OTc5MGRiYzYzOGY0Y2E3ZDBjZmVj
10
- Mzk2ZGQ4OGZmNWJkMzc4NjZjMjlkYWFjMWVkZWM3MjE5ODNiMjA0NTcyYjk2
11
- ZGY1ZTVmMjg4NDllY2YyNzI5NjI0MDdhODU4Y2NlYWU1M2ZlODc=
9
+ MzgxZjIwYWQyZTU0MzY0ZTkwNGNjYzk5ZjA1NjFiNDVmMjJmZjc3NDEwNGUw
10
+ Y2E4Njk4ZTQ4NzMzMzg5NDMwYWRiYmYwNWJkMmJhZGMwZmE3ZTdkYTA0ODdi
11
+ YWEyZmM1MzNhZGUwNmQyNmZhYzYyNzc1YWU0MDNkMzk3N2JjODg=
12
12
  data.tar.gz: !binary |-
13
- Y2RjM2RkN2NmNTVhMmE0NTQxNmFhN2E3MzkzOTJkYTkwMWY4ZGNiNzQ4NjY1
14
- ZjczNmY0ZDMxNzM4NjViZDI5OGI2OWFiYTM5NjYzMDU2OGMzMTdiNGEyYjg2
15
- MzFiODJhODljMTA5NDcwZDYzZjJiNGYxZjRiOGQwZWYzM2VhMzQ=
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.24'
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"
@@ -15,8 +15,8 @@ module Moip
15
15
  end
16
16
  end
17
17
 
18
- def build_error response
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
@@ -68,6 +68,10 @@ class Moip::BillingInfo < Moip::Model
68
68
  }
69
69
  end
70
70
 
71
+ def build_update
72
+ { :credit_card => self.serializable_hash }
73
+ end
74
+
71
75
  def to_json
72
76
  hash = { :credit_card => self.serializable_hash }
73
77
  hash.to_json
@@ -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
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api-moip-assinaturas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.24
4
+ version: 0.2.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Douglas Rossignolli