cobregratis 0.4.3 → 0.4.4

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 18a6d705ba3981a63a9d5d766de1bf4d49895c1a
4
- data.tar.gz: 18d6370980fd13aceab2c8f4ebae96f927ff47bf
3
+ metadata.gz: 00a296987ef2be7443373021a3ceb7508330db1c
4
+ data.tar.gz: 252ed0cec4e31534574f78686009ac247dd9eb85
5
5
  SHA512:
6
- metadata.gz: b47c4880dfd2fa0b1e20e63e013cc20b159f32762bbc76433ac2f32aba3d06c653016f682e80c99fdf3374216d4a1143cdeec1414b8fd66f540e19476c37825d
7
- data.tar.gz: 635537a6f11fe7d0a770f592f0e4e2e1a11cf7f1dc92a0c3ab3c43d54f33e102db07b87d3d1b1f09e7b313b850be062d177fda4fe2d3a4bfa5743b4295d484bc
6
+ metadata.gz: 8ffa4a89ffacede6d9669269233ea53d3c45ff2e627b5313ce94514a9838ec1c774b4b179526544b6466da1a49f1632a83c28397f00f02ab9d8251133fc51de8
7
+ data.tar.gz: 2235c068b4b2b376893abe52f7325773a7258ef27bbc437087c367238b46f104a2cb39f0fbbeb00626fc9ccc6324a7e54f56dfc1df74b5f09fc075d7294ca233
data/.gitignore CHANGED
@@ -19,3 +19,5 @@ rdoc
19
19
  pkg
20
20
 
21
21
  .idea
22
+ .bundle
23
+
@@ -1 +1 @@
1
- 2.0.0-p451
1
+ 2.2.1
data/Gemfile CHANGED
@@ -1,5 +1,5 @@
1
1
  source 'https://rubygems.org'
2
- ruby '2.0.0'
2
+ ruby '2.2.1'
3
3
 
4
4
  # Specify your gem's dependencies in cobregratis.gemspec
5
5
  gemspec
@@ -0,0 +1,41 @@
1
+ $: << File.expand_path('../../lib', __FILE__)
2
+ require 'cobregratis'
3
+ require 'pp'
4
+
5
+ Cobregratis::Base.site = 'https://app.cobregratis.com.br'
6
+ Cobregratis::Base.user = 'minha_chave'
7
+ Cobregratis::Base.password = 'X'
8
+
9
+ # Criando um boleto
10
+ bank_billet = Cobregratis::BankBillet.create({
11
+ :name => 'Cliente',
12
+ :cnpj_cpf => '34458851179',
13
+ :amount => 13.50,
14
+ :expire_at => '2015-08-30',
15
+ :parcels => 100, # Número de parcelas
16
+ :generate_on_creation => true,
17
+ :send_email_on_creation => true,
18
+ :bank_billet_account_id => 6460,
19
+ # :save_customer => true, # salvar cliente
20
+ :service_id => '52430',
21
+ # :meta => "{\"environment\":\"production\",\"user_id\":580,\"bank_billet_id\":2310,\"user_name\":\"Rog\xC3\xA9rio Salinas Ferreira\"}"
22
+ # :customer_id => 27395,
23
+ :customer_ids => [27395,27396],
24
+ email: { # para onde o boleto será enviado
25
+ name: 'Cliente',
26
+ address: 'cliente@example.com.br'
27
+ }
28
+ })
29
+ pp bank_billet
30
+
31
+ # Lista de boletos
32
+ bank_billets = Cobregratis::BankBillet.find(:all)
33
+
34
+ bank_billets.each do |bank_billet|
35
+ puts "Nosso Número: #{bank_billet.our_number}\n";
36
+ puts "Vencimento: #{bank_billet.expire_at}\n";
37
+ puts "Valor: #{bank_billet.amount}\n";
38
+ puts "Sacado: #{bank_billet.name}\n";
39
+ puts "URL: #{bank_billet.external_link}\n";
40
+ puts "=================================\n";
41
+ end
@@ -0,0 +1,34 @@
1
+ $: << File.expand_path('../../lib', __FILE__)
2
+ require 'cobregratis'
3
+ require 'pp'
4
+
5
+ Cobregratis::Base.site = 'https://app.cobregratis.com.br'
6
+ Cobregratis::Base.user = 'minha_chave'
7
+ Cobregratis::Base.password = 'X'
8
+
9
+ # Enviando um CNAB
10
+ # Envie o conteúdo original do cnab pedo do seu banco.
11
+ # Se preferir enviar como binário ou multipar, use o parâmetro: file
12
+ cnab = Cobregratis::Cnab.create({
13
+ content: File.open("#{File.dirname(__FILE__)}/cnab.txt").read,
14
+ filename: 'cnat.txt'
15
+ })
16
+
17
+ pp cnab
18
+
19
+ # Lista de cnabs
20
+ cnabs = Cobregratis::Cnab.find(:all)
21
+
22
+ cnabs.each do |cnab|
23
+ puts "ID: #{cnab.id}\n";
24
+ puts "Processado em: #{cnab.processed_at}\n";
25
+ puts "Criado em: #{cnab.created_at}\n";
26
+ puts "Conta de cobrança: #{cnab.bank_billet_account_id}\n";
27
+ puts "Boleto ID's: #{cnab.bank_billet_ids}\n";
28
+ puts "=================================\n";
29
+ end
30
+
31
+ # Quitando boletos do cnab
32
+ # Passe o ID do cnab chamando o 'pay_all_off'
33
+ cnab = Cobregratis::Cnab.find(1).put(:pay_all_off)
34
+ pp cnab
@@ -0,0 +1 @@
1
+ conteúdo original do arquivo
@@ -0,0 +1,29 @@
1
+ $: << File.expand_path('../../lib', __FILE__)
2
+ require 'cobregratis'
3
+ require 'pp'
4
+
5
+ Cobregratis::Base.site = 'https://app.cobregratis.com.br'
6
+ Cobregratis::Base.user = 'minha_chave'
7
+ Cobregratis::Base.password = 'X'
8
+
9
+
10
+ # Criando uma Notificação
11
+ notification = Cobregratis::WebHook.create({
12
+ :event => 'paid',
13
+ :url => 'http://meusite.com.br/cobregratis',
14
+ :code => 'codesecret'
15
+ })
16
+
17
+ pp notification
18
+
19
+ # Lista de notificações
20
+ notifications = Cobregratis::WebHook.find(:all)
21
+
22
+ notifications.each do |notification|
23
+ puts "ID: #{notification.id}\n";
24
+ puts "URL: #{notification.url}\n";
25
+ puts "Código Secreto: #{notification.code}\n";
26
+ puts "Evento: #{notification.formatted_event}\n";
27
+ puts "Situação: #{notification.formatted_status}\n";
28
+ puts "=================================\n";
29
+ end
@@ -7,6 +7,7 @@ module Cobregratis
7
7
  require 'cobregratis/bank_billet'
8
8
  require 'cobregratis/bank_billet_subscription'
9
9
  require 'cobregratis/customer'
10
+ require 'cobregratis/cnab'
10
11
  require 'cobregratis/service'
11
12
  require 'cobregratis/web_hook'
12
13
  end
@@ -0,0 +1,4 @@
1
+ module Cobregratis
2
+ class Cnab < Base
3
+ end
4
+ end
@@ -1,3 +1,3 @@
1
1
  module Cobregratis
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.4"
3
3
  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.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafael Lima
@@ -14,70 +14,70 @@ dependencies:
14
14
  name: activeresource
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '4.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '4.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 10.3.2
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 10.3.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: 3.0.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 3.0.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: simplecov
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: 0.9.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.9.0
83
83
  description: 'Ruby Wrapper around Cobre Grátis API. More info at: http://cobregratispec.com.br/doc/api'
@@ -86,11 +86,10 @@ executables: []
86
86
  extensions: []
87
87
  extra_rdoc_files: []
88
88
  files:
89
- - .bundle/config
90
- - .document
91
- - .gitignore
92
- - .ruby-gemset
93
- - .ruby-version
89
+ - ".document"
90
+ - ".gitignore"
91
+ - ".ruby-gemset"
92
+ - ".ruby-version"
94
93
  - Gemfile
95
94
  - Gemfile.lock
96
95
  - LICENSE
@@ -98,14 +97,18 @@ files:
98
97
  - Rakefile
99
98
  - autotest/discover.rb
100
99
  - cobregratis.gemspec
100
+ - examples/bank_billet.rb
101
+ - examples/cnab.rb
102
+ - examples/cnab.txt
101
103
  - examples/config_initializers_cobregratis.rb
102
- - examples/example.rb
104
+ - examples/web_hook.rb
103
105
  - init.rb
104
106
  - lib/cobregratis.rb
105
107
  - lib/cobregratis/bank_billet.rb
106
108
  - lib/cobregratis/bank_billet_account.rb
107
109
  - lib/cobregratis/bank_billet_subscription.rb
108
110
  - lib/cobregratis/base.rb
111
+ - lib/cobregratis/cnab.rb
109
112
  - lib/cobregratis/customer.rb
110
113
  - lib/cobregratis/service.rb
111
114
  - lib/cobregratis/version.rb
@@ -129,17 +132,17 @@ require_paths:
129
132
  - lib
130
133
  required_ruby_version: !ruby/object:Gem::Requirement
131
134
  requirements:
132
- - - '>='
135
+ - - ">="
133
136
  - !ruby/object:Gem::Version
134
137
  version: '0'
135
138
  required_rubygems_version: !ruby/object:Gem::Requirement
136
139
  requirements:
137
- - - '>='
140
+ - - ">="
138
141
  - !ruby/object:Gem::Version
139
142
  version: '0'
140
143
  requirements: []
141
144
  rubyforge_project:
142
- rubygems_version: 2.2.2
145
+ rubygems_version: 2.4.5
143
146
  signing_key:
144
147
  specification_version: 4
145
148
  summary: Ruby Wrapper around Cobre Grátis API
@@ -153,4 +156,3 @@ test_files:
153
156
  - spec/cobregratis/web_hook_spec.rb
154
157
  - spec/spec.opts
155
158
  - spec/spec_helper.rb
156
- has_rdoc:
@@ -1,2 +0,0 @@
1
- --- {}
2
-
@@ -1,58 +0,0 @@
1
- $: << File.expand_path('../../lib', __FILE__)
2
- require 'cobregratis'
3
- require 'pp'
4
-
5
- # Cobregratis::Base.site = 'http://staging.cobregratis.com.br'
6
- Cobregratis::Base.user = 'uiF3x9JuMFMBMasanVPo'
7
- Cobregratis::Base.password = 'X'
8
-
9
-
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
26
-
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
38
-
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