iugu 1.0.1 → 1.0.2

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- M2U2ZGUzMzgwOTA5ZTdmZjIwMGU3YTljYjIzMjMzMzJkYTFmYmViYQ==
4
+ YTU5MDBjMmUxMDkxNTE2MjQ0ZjNlMzdhNTE2MThjZjE5NTkxZGMwOA==
5
5
  data.tar.gz: !binary |-
6
- M2U2Zjc0MjFkNWExZDU2NjlkMjA1Y2UzMjhmOTRjMWNlOGM0ZTQ4Mw==
6
+ YzQzODBhNTY4ZDUyNWYxYjU2YmZlZWNhNzZlZmIyZGNmZDhmNDAyOQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTU1ZGNiNDk0NTg0OTI0NDk2ZjU2MzgxYjY2YmYyMzYxMDNiNDgzNTMzOGRj
10
- ODMwNTVlNTUyOTQ3ZDBkYzBlNWVjNWZkNzg4MWEyNzU1NjVlM2QxYWI3ZTFi
11
- NWNmNjJkNWJmMzdiODRmODI4YjczOWNhMzYzOTRlMTE1OTNjY2E=
9
+ NWVhZjZkMzVlODBmMWZkNTQ5NDRlYjgwMzcyM2IwN2FmZDFmMzZjN2I3MDNk
10
+ Mjc0MzMxZjA3YmVhNzk3ZGUzYjI5MGViMzgwZGMwZDQxYjNjZmZiYjE5ZGQy
11
+ ZTNmNDFjZjJiMWNmM2MzMThlYzJlNjcyOGI4YmRmYjU2Mzc3ZWU=
12
12
  data.tar.gz: !binary |-
13
- MjdhMGM4ZWU4NWI2NTFhMzI3ZWJkZjExMDRlZjJkNWQ1OGFjZTM0MzAwNjcy
14
- YTY3ZDZlNDFiMWM0Y2JkNDY3ZTNlZGE5MzgwNmRhNDNhM2VlOTJhZGYzZjhm
15
- OWQwNzkwODQxOTJhNDg1NzczNTA3OTQ1MjkyODNiZmZlNGViMjA=
13
+ MmQ4ZjJhZDU0NGVjZmY5NjRmMGRmMTVhZjUzMjA1ZmQ2NmFlMGM0Mzc5NGVm
14
+ OWYzMzdlOWIwYjYyMmMxZDdmYWFlNTYxY2JiNjk4YzZiNTMzOWYyMmVkNjJk
15
+ ODM2YmNlN2VhMTFjZDYxNzQzYTNmZjFjYzljMjlkNGRmOTU4ZTI=
@@ -1,5 +1,14 @@
1
1
  module Iugu
2
2
  module APIFetch
3
+ def refresh
4
+ copy Iugu::Factory.create_from_response(self.class.object_type, APIRequest.request("GET", self.class.url(self.id)))
5
+ self.errors = nil
6
+ true
7
+ rescue Iugu::RequestWithErrors => ex
8
+ self.errors = ex.errors
9
+ false
10
+ end
11
+
3
12
  module ClassMethods
4
13
  def fetch(options = nil)
5
14
  Iugu::Factory.create_from_response self.object_type, APIRequest.request("GET", self.url(options))
@@ -5,6 +5,24 @@ module Iugu
5
5
  include Iugu::APISave
6
6
  include Iugu::APIDelete
7
7
 
8
+ def add_credits(quantity)
9
+ copy Iugu::Factory.create_from_response(self.class.object_type, APIRequest.request("PUT", "#{self.class.url(self.id)}/add_credits", { quantity: quantity }))
10
+ self.errors = nil
11
+ true
12
+ rescue Iugu::RequestWithErrors => ex
13
+ self.errors = ex.errors
14
+ false
15
+ end
16
+
17
+ def remove_credits(quantity)
18
+ copy Iugu::Factory.create_from_response(self.class.object_type, APIRequest.request("PUT", "#{self.class.url(self.id)}/remove_credits", { quantity: quantity }))
19
+ self.errors = nil
20
+ true
21
+ rescue Iugu::RequestWithErrors => ex
22
+ self.errors = ex.errors
23
+ false
24
+ end
25
+
8
26
  def suspend
9
27
  copy Iugu::Factory.create_from_response(self.class.object_type, APIRequest.request("POST", "#{self.class.url(self.id)}/suspend"))
10
28
  self.errors = nil
data/lib/iugu/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Iugu
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iugu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcelo Paez Sequeira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-20 00:00:00.000000000 Z
11
+ date: 2014-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client