iugu 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/iugu/api_fetch.rb +9 -0
- data/lib/iugu/subscription.rb +18 -0
- data/lib/iugu/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTU5MDBjMmUxMDkxNTE2MjQ0ZjNlMzdhNTE2MThjZjE5NTkxZGMwOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YzQzODBhNTY4ZDUyNWYxYjU2YmZlZWNhNzZlZmIyZGNmZDhmNDAyOQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NWVhZjZkMzVlODBmMWZkNTQ5NDRlYjgwMzcyM2IwN2FmZDFmMzZjN2I3MDNk
|
10
|
+
Mjc0MzMxZjA3YmVhNzk3ZGUzYjI5MGViMzgwZGMwZDQxYjNjZmZiYjE5ZGQy
|
11
|
+
ZTNmNDFjZjJiMWNmM2MzMThlYzJlNjcyOGI4YmRmYjU2Mzc3ZWU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MmQ4ZjJhZDU0NGVjZmY5NjRmMGRmMTVhZjUzMjA1ZmQ2NmFlMGM0Mzc5NGVm
|
14
|
+
OWYzMzdlOWIwYjYyMmMxZDdmYWFlNTYxY2JiNjk4YzZiNTMzOWYyMmVkNjJk
|
15
|
+
ODM2YmNlN2VhMTFjZDYxNzQzYTNmZjFjYzljMjlkNGRmOTU4ZTI=
|
data/lib/iugu/api_fetch.rb
CHANGED
@@ -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))
|
data/lib/iugu/subscription.rb
CHANGED
@@ -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
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.
|
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-
|
11
|
+
date: 2014-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|