cobregratis 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/example.rb +50 -16
- data/lib/cobregratis/bank_billet_subscription.rb +4 -0
- data/lib/cobregratis/version.rb +1 -1
- data/lib/cobregratis/web_hook.rb +4 -0
- data/lib/cobregratis.rb +2 -0
- data/spec/cobregratis/bank_billet_subscription_spec.rb +12 -0
- data/spec/cobregratis/web_hook_spec.rb +12 -0
- metadata +8 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb3ed161552586fb8efb3c1d595bb82e624816a3
|
4
|
+
data.tar.gz: 0dce4defe50fcadd9e5301375974ec2d051c25de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9655bece7b621ca1f14381c7c62bee5882d09a9c9cb948f3b40ae09a7cf3019862097aa79a59847061e1fa88141c882951f5a42926064d541c07fbccae0baab
|
7
|
+
data.tar.gz: 7dd41b911073599a1fab4897b0f89078ea99cfcf232d73e78d4e4c8675103941876ff485444238bced1fc2718399d6ec7fea9be770f91b371bd0a5357c305f02
|
data/examples/example.rb
CHANGED
@@ -2,23 +2,57 @@ $: << File.expand_path('../../lib', __FILE__)
|
|
2
2
|
require 'cobregratis'
|
3
3
|
require 'pp'
|
4
4
|
|
5
|
-
Cobregratis::Base.site = '
|
6
|
-
Cobregratis::Base.user = '
|
5
|
+
# Cobregratis::Base.site = 'http://staging.cobregratis.com.br'
|
6
|
+
Cobregratis::Base.user = 'uiF3x9JuMFMBMasanVPo'
|
7
7
|
Cobregratis::Base.password = 'X'
|
8
|
+
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
# Criando um boleto
|
11
|
+
# bank_billet = Cobregratis::BankBillet.create({
|
12
|
+
# :name => 'Cliente',
|
13
|
+
# :cnpj_cpf => '34458851179',
|
14
|
+
# :amount => 13.50,
|
15
|
+
# :expire_at => '2015-07-30',
|
16
|
+
# :parcels => 1, # Número de parcelas
|
17
|
+
# :generate_on_creation => true,
|
18
|
+
# :save_customer => true, # salvar cliente
|
19
|
+
# :service_id => '46270',
|
20
|
+
# email: { # para onde o boleto será enviado
|
21
|
+
# name: 'Cliente',
|
22
|
+
# address: 'cliente@example.com.br'
|
23
|
+
# }
|
24
|
+
# })
|
25
|
+
# pp bank_billet
|
14
26
|
|
15
|
-
|
27
|
+
# Lista de boletos
|
28
|
+
# bank_billets = Cobregratis::BankBillet.find(:all)
|
29
|
+
#
|
30
|
+
# bank_billets.each do |bank_billet|
|
31
|
+
# puts "Nosso Número: #{bank_billet.our_number}\n";
|
32
|
+
# puts "Vencimento: #{bank_billet.expire_at}\n";
|
33
|
+
# puts "Valor: #{bank_billet.amount}\n";
|
34
|
+
# puts "Sacado: #{bank_billet.name}\n";
|
35
|
+
# puts "URL: #{bank_billet.external_link}\n";
|
36
|
+
# puts "=================================\n";
|
37
|
+
# end
|
16
38
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
39
|
+
# Criando um WebHook
|
40
|
+
# web_hook = Cobregratis::WebHook.create({
|
41
|
+
# :event => 'paid',
|
42
|
+
# :url => 'http://meusite.com.br/cobregratis',
|
43
|
+
# :code => 'codesecret'
|
44
|
+
# })
|
45
|
+
#
|
46
|
+
# pp web_hook
|
47
|
+
|
48
|
+
# Lista de WebHooks
|
49
|
+
# web_hooks = Cobregratis::WebHook.find(:all)
|
50
|
+
#
|
51
|
+
# web_hooks.each do |web_hook|
|
52
|
+
# puts "ID: #{web_hook.id}\n";
|
53
|
+
# puts "URL: #{web_hook.url}\n";
|
54
|
+
# puts "Código Secreto: #{web_hook.code}\n";
|
55
|
+
# puts "Evento: #{web_hook.formatted_event}\n";
|
56
|
+
# puts "Status: #{web_hook.formatted_status}\n";
|
57
|
+
# puts "=================================\n";
|
58
|
+
# end
|
data/lib/cobregratis/version.rb
CHANGED
data/lib/cobregratis.rb
CHANGED
@@ -5,8 +5,10 @@ module Cobregratis
|
|
5
5
|
require 'cobregratis/base'
|
6
6
|
require 'cobregratis/bank_billet_account'
|
7
7
|
require 'cobregratis/bank_billet'
|
8
|
+
require 'cobregratis/bank_billet_subscription'
|
8
9
|
require 'cobregratis/customer'
|
9
10
|
require 'cobregratis/service'
|
11
|
+
require 'cobregratis/web_hook'
|
10
12
|
end
|
11
13
|
|
12
14
|
def gem_path
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe Cobregratis::BankBilletSubscription do
|
4
|
+
before(:each) do
|
5
|
+
@subscription = Cobregratis::BankBilletSubscription.new
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should be instance of Cobregratis::Base" do
|
9
|
+
@subscription.kind_of?(Cobregratis::Base).should be_true
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe Cobregratis::Service do
|
4
|
+
before(:each) do
|
5
|
+
@webhook = Cobregratis::WebHook.new
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should be instance of Cobregratis::Base" do
|
9
|
+
@webhook.kind_of?(Cobregratis::Base).should be_true
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cobregratis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rafael Lima
|
@@ -118,15 +118,19 @@ files:
|
|
118
118
|
- lib/cobregratis.rb
|
119
119
|
- lib/cobregratis/bank_billet.rb
|
120
120
|
- lib/cobregratis/bank_billet_account.rb
|
121
|
+
- lib/cobregratis/bank_billet_subscription.rb
|
121
122
|
- lib/cobregratis/base.rb
|
122
123
|
- lib/cobregratis/customer.rb
|
123
124
|
- lib/cobregratis/service.rb
|
124
125
|
- lib/cobregratis/version.rb
|
126
|
+
- lib/cobregratis/web_hook.rb
|
125
127
|
- spec/cobregratis/bank_billet_account_spec.rb
|
126
128
|
- spec/cobregratis/bank_billet_spec.rb
|
129
|
+
- spec/cobregratis/bank_billet_subscription_spec.rb
|
127
130
|
- spec/cobregratis/base_spec.rb
|
128
131
|
- spec/cobregratis/customer_spec.rb
|
129
132
|
- spec/cobregratis/service_spec.rb
|
133
|
+
- spec/cobregratis/web_hook_spec.rb
|
130
134
|
- spec/spec.opts
|
131
135
|
- spec/spec_helper.rb
|
132
136
|
homepage: http://github.com/BielSystems/cobregratis-ruby
|
@@ -156,8 +160,11 @@ summary: Ruby Wrapper around Cobre Grátis API
|
|
156
160
|
test_files:
|
157
161
|
- spec/cobregratis/bank_billet_account_spec.rb
|
158
162
|
- spec/cobregratis/bank_billet_spec.rb
|
163
|
+
- spec/cobregratis/bank_billet_subscription_spec.rb
|
159
164
|
- spec/cobregratis/base_spec.rb
|
160
165
|
- spec/cobregratis/customer_spec.rb
|
161
166
|
- spec/cobregratis/service_spec.rb
|
167
|
+
- spec/cobregratis/web_hook_spec.rb
|
162
168
|
- spec/spec.opts
|
163
169
|
- spec/spec_helper.rb
|
170
|
+
has_rdoc:
|