moip-assinaturas 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -55,7 +55,7 @@ plan = {
|
|
55
55
|
billing_cycles: 12
|
56
56
|
}
|
57
57
|
|
58
|
-
request = Moip::Assinaturas::Plan.create(
|
58
|
+
request = Moip::Assinaturas::Plan.create(plan)
|
59
59
|
|
60
60
|
if request[:success]
|
61
61
|
# O plano foi criado com sucesso
|
@@ -109,7 +109,7 @@ Moip::Assinaturas::Customer.details(customer_code)
|
|
109
109
|
|
110
110
|
## Assinaturas
|
111
111
|
|
112
|
-
Criar uma nova
|
112
|
+
Criar uma nova assinatura:
|
113
113
|
|
114
114
|
```ruby
|
115
115
|
Moip::Assinaturas::Subscription.create(subscription_attributes, new_customer = false)
|
@@ -139,15 +139,15 @@ Ativar uma assinatura:
|
|
139
139
|
Moip::Assinaturas::Subscription.activate(subscription_code)
|
140
140
|
```
|
141
141
|
|
142
|
-
##
|
142
|
+
## Faturas
|
143
143
|
|
144
|
-
Listar
|
144
|
+
Listar faturas de uma assinatura:
|
145
145
|
|
146
146
|
```ruby
|
147
147
|
Moip::Assinaturas::Invoice.list(subscription_code)
|
148
148
|
```
|
149
149
|
|
150
|
-
Obter detalhes da
|
150
|
+
Obter detalhes da fatura:
|
151
151
|
|
152
152
|
```ruby
|
153
153
|
Moip::Assinaturas::Invoice.details(invoice_id)
|
@@ -161,7 +161,7 @@ Listar pagamentos de uma cobrança:
|
|
161
161
|
Moip::Assinaturas::Payment.list(invoice_id)
|
162
162
|
```
|
163
163
|
|
164
|
-
Obter detalhes de um pagamento
|
164
|
+
Obter detalhes de um pagamento:
|
165
165
|
|
166
166
|
```ruby
|
167
167
|
Moip::Assinaturas::Invoice.details(payment_id)
|
@@ -5,10 +5,10 @@ module Moip::Assinaturas
|
|
5
5
|
|
6
6
|
def create(customer, new_valt = true)
|
7
7
|
response = Moip::Assinaturas::Client.create_customer(customer, new_valt)
|
8
|
+
hash = JSON.load(response.body).with_indifferent_access
|
8
9
|
|
9
10
|
case response.code
|
10
11
|
when 201
|
11
|
-
hash = JSON.load(response.body).with_indifferent_access
|
12
12
|
return {
|
13
13
|
success: true,
|
14
14
|
message: hash['message']
|
@@ -26,10 +26,10 @@ module Moip::Assinaturas
|
|
26
26
|
|
27
27
|
def list
|
28
28
|
response = Moip::Assinaturas::Client.list_customers
|
29
|
+
hash = JSON.load(response.body).with_indifferent_access
|
29
30
|
|
30
31
|
case response.code
|
31
32
|
when 200
|
32
|
-
hash = JSON.load(response.body).with_indifferent_access
|
33
33
|
return {
|
34
34
|
success: true,
|
35
35
|
customers: hash['customers']
|
@@ -41,10 +41,10 @@ module Moip::Assinaturas
|
|
41
41
|
|
42
42
|
def details(code)
|
43
43
|
response = Moip::Assinaturas::Client.details_customer(code)
|
44
|
+
hash = JSON.load(response.body).with_indifferent_access
|
44
45
|
|
45
46
|
case response.code
|
46
47
|
when 200
|
47
|
-
hash = JSON.load(response.body).with_indifferent_access
|
48
48
|
return {
|
49
49
|
success: true,
|
50
50
|
customer: hash
|
@@ -5,10 +5,10 @@ module Moip::Assinaturas
|
|
5
5
|
|
6
6
|
def list(subscription_code)
|
7
7
|
response = Moip::Assinaturas::Client.list_invoices(subscription_code)
|
8
|
+
hash = JSON.load(response.body).with_indifferent_access
|
8
9
|
|
9
10
|
case response.code
|
10
11
|
when 200
|
11
|
-
hash = JSON.load(response.body).with_indifferent_access
|
12
12
|
return {
|
13
13
|
success: true,
|
14
14
|
invoices: hash[:invoices]
|
@@ -20,10 +20,10 @@ module Moip::Assinaturas
|
|
20
20
|
|
21
21
|
def details(id)
|
22
22
|
response = Moip::Assinaturas::Client.details_invoice(id)
|
23
|
+
hash = JSON.load(response.body).with_indifferent_access
|
23
24
|
|
24
25
|
case response.code
|
25
26
|
when 200
|
26
|
-
hash = JSON.load(response.body).with_indifferent_access
|
27
27
|
return {
|
28
28
|
success: true,
|
29
29
|
invoice: hash
|
@@ -5,10 +5,10 @@ module Moip::Assinaturas
|
|
5
5
|
|
6
6
|
def list(invoice_id)
|
7
7
|
response = Moip::Assinaturas::Client.list_payments(invoice_id)
|
8
|
+
hash = JSON.load(response.body).with_indifferent_access
|
8
9
|
|
9
10
|
case response.code
|
10
11
|
when 200
|
11
|
-
hash = JSON.load(response.body).with_indifferent_access
|
12
12
|
return {
|
13
13
|
success: true,
|
14
14
|
payments: hash[:payments]
|
@@ -20,10 +20,10 @@ module Moip::Assinaturas
|
|
20
20
|
|
21
21
|
def details(id)
|
22
22
|
response = Moip::Assinaturas::Client.details_payment(id)
|
23
|
+
hash = JSON.load(response.body).with_indifferent_access
|
23
24
|
|
24
25
|
case response.code
|
25
26
|
when 200
|
26
|
-
hash = JSON.load(response.body).with_indifferent_access
|
27
27
|
return {
|
28
28
|
success: true,
|
29
29
|
payment: hash
|
@@ -5,10 +5,10 @@ module Moip::Assinaturas
|
|
5
5
|
|
6
6
|
def create(plan)
|
7
7
|
response = Moip::Assinaturas::Client.create_plan(plan)
|
8
|
+
hash = JSON.load(response.body).with_indifferent_access
|
8
9
|
|
9
10
|
case response.code
|
10
11
|
when 201
|
11
|
-
hash = JSON.load(response.body).with_indifferent_access
|
12
12
|
return {
|
13
13
|
success: true,
|
14
14
|
plan: hash
|
@@ -26,10 +26,10 @@ module Moip::Assinaturas
|
|
26
26
|
|
27
27
|
def list
|
28
28
|
response = Moip::Assinaturas::Client.list_plans
|
29
|
+
hash = JSON.load(response.body).with_indifferent_access
|
29
30
|
|
30
31
|
case response.code
|
31
32
|
when 200
|
32
|
-
hash = JSON.load(response.body).with_indifferent_access
|
33
33
|
return {
|
34
34
|
success: true,
|
35
35
|
plans: hash[:plans]
|
@@ -41,10 +41,10 @@ module Moip::Assinaturas
|
|
41
41
|
|
42
42
|
def details(code)
|
43
43
|
response = Moip::Assinaturas::Client.details_plan(code)
|
44
|
+
hash = JSON.load(response.body).with_indifferent_access
|
44
45
|
|
45
46
|
case response.code
|
46
47
|
when 200
|
47
|
-
hash = JSON.load(response.body).with_indifferent_access
|
48
48
|
return {
|
49
49
|
success: true,
|
50
50
|
plan: hash
|
@@ -5,10 +5,10 @@ module Moip::Assinaturas
|
|
5
5
|
|
6
6
|
def create(subscription, new_customer = false)
|
7
7
|
response = Moip::Assinaturas::Client.create_subscription(subscription, new_customer)
|
8
|
+
hash = JSON.load(response.body).with_indifferent_access
|
8
9
|
|
9
10
|
case response.code
|
10
11
|
when 201
|
11
|
-
hash = JSON.load(response.body).with_indifferent_access
|
12
12
|
return {
|
13
13
|
success: true,
|
14
14
|
subscription: hash
|
@@ -27,10 +27,10 @@ module Moip::Assinaturas
|
|
27
27
|
|
28
28
|
def list
|
29
29
|
response = Moip::Assinaturas::Client.list_subscriptions
|
30
|
+
hash = JSON.load(response.body).with_indifferent_access
|
30
31
|
|
31
32
|
case response.code
|
32
33
|
when 200
|
33
|
-
hash = JSON.load(response.body).with_indifferent_access
|
34
34
|
return {
|
35
35
|
success: true,
|
36
36
|
subscriptions: hash[:subscriptions]
|
@@ -43,10 +43,10 @@ module Moip::Assinaturas
|
|
43
43
|
|
44
44
|
def details(code)
|
45
45
|
response = Moip::Assinaturas::Client.details_subscription(code)
|
46
|
+
hash = JSON.load(response.body).with_indifferent_access
|
46
47
|
|
47
48
|
case response.code
|
48
49
|
when 200
|
49
|
-
hash = JSON.load(response.body).with_indifferent_access
|
50
50
|
return {
|
51
51
|
success: true,
|
52
52
|
subscription: hash
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moip-assinaturas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|