boleto_bancario 0.0.1.beta → 1.0.0
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 +7 -0
- data/Changelog.markdown +58 -2
- data/README.markdown +679 -156
- data/lib/boleto_bancario/calculos/documento.rb +191 -0
- data/lib/boleto_bancario/calculos/fator_vencimento.rb +78 -31
- data/lib/boleto_bancario/calculos/modulo11_fator_de9a2.rb +65 -0
- data/lib/boleto_bancario/calculos/modulo11_fator_de9a2_resto_x.rb +5 -51
- data/lib/boleto_bancario/calculos/modulo_numero_de_controle.rb +117 -0
- data/lib/boleto_bancario/core/banco_brasil.rb +30 -5
- data/lib/boleto_bancario/core/banrisul.rb +182 -0
- data/lib/boleto_bancario/core/boleto.rb +97 -35
- data/lib/boleto_bancario/core/bradesco.rb +28 -16
- data/lib/boleto_bancario/core/c6_bank.rb +155 -0
- data/lib/boleto_bancario/core/caixa.rb +233 -0
- data/lib/boleto_bancario/core/inter.rb +155 -0
- data/lib/boleto_bancario/core/itau.rb +20 -10
- data/lib/boleto_bancario/core/nubank.rb +156 -0
- data/lib/boleto_bancario/core/santander.rb +19 -22
- data/lib/boleto_bancario/core/sicoob.rb +172 -0
- data/lib/boleto_bancario/core/sicredi.rb +290 -0
- data/lib/boleto_bancario/locales/pt-BR.yml +55 -0
- data/lib/boleto_bancario/renderers/base.rb +154 -0
- data/lib/boleto_bancario/renderers/html_renderer.rb +92 -0
- data/lib/boleto_bancario/renderers/pdf_renderer.rb +130 -0
- data/lib/boleto_bancario/renderers/png_renderer.rb +66 -0
- data/lib/boleto_bancario/templates/_barcode.html.erb +3 -0
- data/lib/boleto_bancario/templates/_cedente.html.erb +14 -0
- data/lib/boleto_bancario/templates/_header.html.erb +4 -0
- data/lib/boleto_bancario/templates/_instructions.html.erb +10 -0
- data/lib/boleto_bancario/templates/_payment.html.erb +36 -0
- data/lib/boleto_bancario/templates/_sacado.html.erb +10 -0
- data/lib/boleto_bancario/templates/boleto.html.erb +22 -0
- data/lib/boleto_bancario/templates/boleto_styles.css +18 -0
- data/lib/boleto_bancario/version.rb +3 -2
- data/lib/boleto_bancario.rb +48 -19
- data/lib/generators/boleto_bancario/views_generator.rb +47 -0
- metadata +140 -106
- data/.gitignore +0 -18
- data/.rspec +0 -1
- data/.rvmrc +0 -1
- data/Gemfile +0 -3
- data/Planning.markdown +0 -131
- data/Rakefile +0 -9
- data/TODO.markdown +0 -5
- data/boleto_bancario.gemspec +0 -25
- data/documentacoes_dos_boletos/Bradesco/Manual_BRADESCO.PDF +0 -0
- data/spec/boleto_bancario/calculos/digitos_spec.rb +0 -19
- data/spec/boleto_bancario/calculos/fator_vencimento_spec.rb +0 -59
- data/spec/boleto_bancario/calculos/fatores_de_multiplicacao_spec.rb +0 -69
- data/spec/boleto_bancario/calculos/linha_digitavel_spec.rb +0 -57
- data/spec/boleto_bancario/calculos/modulo10_spec.rb +0 -49
- data/spec/boleto_bancario/calculos/modulo11_fator_de2a7_spec.rb +0 -43
- data/spec/boleto_bancario/calculos/modulo11_fator_de2a9_resto_zero_spec.rb +0 -39
- data/spec/boleto_bancario/calculos/modulo11_fator_de2a9_spec.rb +0 -61
- data/spec/boleto_bancario/calculos/modulo11_fator_de9a2_resto_x_spec.rb +0 -37
- data/spec/boleto_bancario/calculos/modulo11_spec.rb +0 -19
- data/spec/boleto_bancario/core/banco_brasil_spec.rb +0 -383
- data/spec/boleto_bancario/core/boleto_spec.rb +0 -102
- data/spec/boleto_bancario/core/bradesco_spec.rb +0 -170
- data/spec/boleto_bancario/core/itau_spec.rb +0 -336
- data/spec/boleto_bancario/core/santander_spec.rb +0 -135
- data/spec/shared_examples/boleto_bancario_shared_example.rb +0 -164
- data/spec/spec_helper.rb +0 -14
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'rails/generators'
|
|
4
|
+
|
|
5
|
+
module BoletoBancario
|
|
6
|
+
module Generators
|
|
7
|
+
# Rails generator para copiar os templates de boleto para a aplicacao Rails.
|
|
8
|
+
#
|
|
9
|
+
# @example Uso
|
|
10
|
+
# rails generate boleto_bancario:views
|
|
11
|
+
#
|
|
12
|
+
# Isso copia os templates padrao para app/views/boletos/, permitindo
|
|
13
|
+
# customizacao completa dos templates de boleto.
|
|
14
|
+
#
|
|
15
|
+
class ViewsGenerator < Rails::Generators::Base
|
|
16
|
+
desc 'Copia os templates de boleto para app/views/boletos/'
|
|
17
|
+
|
|
18
|
+
source_root File.expand_path('../../boleto_bancario/templates', __dir__)
|
|
19
|
+
|
|
20
|
+
def copy_templates
|
|
21
|
+
directory '.', 'app/views/boletos'
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def show_readme
|
|
25
|
+
say ''
|
|
26
|
+
say 'Templates copiados para app/views/boletos/', :green
|
|
27
|
+
say ''
|
|
28
|
+
say 'Arquivos criados:'
|
|
29
|
+
say ' app/views/boletos/boleto.html.erb - Template principal'
|
|
30
|
+
say ' app/views/boletos/boleto_styles.css - Estilos CSS'
|
|
31
|
+
say ' app/views/boletos/_header.html.erb - Partial do cabecalho'
|
|
32
|
+
say ' app/views/boletos/_cedente.html.erb - Partial do cedente'
|
|
33
|
+
say ' app/views/boletos/_sacado.html.erb - Partial do sacado'
|
|
34
|
+
say ' app/views/boletos/_payment.html.erb - Partial de pagamento'
|
|
35
|
+
say ' app/views/boletos/_instructions.html.erb - Partial de instrucoes'
|
|
36
|
+
say ' app/views/boletos/_barcode.html.erb - Partial do codigo de barras'
|
|
37
|
+
say ''
|
|
38
|
+
say 'Para usar os templates customizados, configure o renderer:'
|
|
39
|
+
say ''
|
|
40
|
+
say ' class MyHtmlRenderer < BoletoBancario::Renderers::HtmlRenderer'
|
|
41
|
+
say " self.template_path = Rails.root.join('app/views/boletos')"
|
|
42
|
+
say ' end'
|
|
43
|
+
say ''
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
metadata
CHANGED
|
@@ -1,128 +1,183 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: boleto_bancario
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0
|
|
5
|
-
prerelease: 6
|
|
4
|
+
version: 1.0.0
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
8
7
|
- Tomas D'Stefano
|
|
9
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 2026-02-03 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: activesupport
|
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
|
17
|
-
none: false
|
|
18
16
|
requirements:
|
|
19
|
-
- - ~>
|
|
17
|
+
- - "~>"
|
|
20
18
|
- !ruby/object:Gem::Version
|
|
21
|
-
version: '
|
|
19
|
+
version: '7.1'
|
|
22
20
|
type: :runtime
|
|
23
21
|
prerelease: false
|
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
-
none: false
|
|
26
23
|
requirements:
|
|
27
|
-
- - ~>
|
|
24
|
+
- - "~>"
|
|
28
25
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: '
|
|
26
|
+
version: '7.1'
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
|
31
28
|
name: activemodel
|
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
|
33
|
-
none: false
|
|
34
30
|
requirements:
|
|
35
|
-
- - ~>
|
|
31
|
+
- - "~>"
|
|
36
32
|
- !ruby/object:Gem::Version
|
|
37
|
-
version: '
|
|
33
|
+
version: '7.1'
|
|
38
34
|
type: :runtime
|
|
39
35
|
prerelease: false
|
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
-
none: false
|
|
42
37
|
requirements:
|
|
43
|
-
- - ~>
|
|
38
|
+
- - "~>"
|
|
44
39
|
- !ruby/object:Gem::Version
|
|
45
|
-
version: '
|
|
40
|
+
version: '7.1'
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
|
47
|
-
name:
|
|
42
|
+
name: barby
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0.6'
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0.6'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: prawn
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '2.4'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '2.4'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: prawn-table
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0.2'
|
|
76
|
+
type: :runtime
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0.2'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: chunky_png
|
|
48
85
|
requirement: !ruby/object:Gem::Requirement
|
|
49
|
-
none: false
|
|
50
86
|
requirements:
|
|
51
|
-
- - ~>
|
|
87
|
+
- - "~>"
|
|
52
88
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '
|
|
89
|
+
version: '1.4'
|
|
90
|
+
type: :runtime
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '1.4'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: rake
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - "~>"
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '13.0'
|
|
54
104
|
type: :development
|
|
55
105
|
prerelease: false
|
|
56
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
-
none: false
|
|
58
107
|
requirements:
|
|
59
|
-
- - ~>
|
|
108
|
+
- - "~>"
|
|
60
109
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '
|
|
110
|
+
version: '13.0'
|
|
62
111
|
- !ruby/object:Gem::Dependency
|
|
63
|
-
name:
|
|
112
|
+
name: rspec
|
|
64
113
|
requirement: !ruby/object:Gem::Requirement
|
|
65
|
-
none: false
|
|
66
114
|
requirements:
|
|
67
|
-
- - ~>
|
|
115
|
+
- - "~>"
|
|
68
116
|
- !ruby/object:Gem::Version
|
|
69
|
-
version: '
|
|
117
|
+
version: '3.13'
|
|
70
118
|
type: :development
|
|
71
119
|
prerelease: false
|
|
72
120
|
version_requirements: !ruby/object:Gem::Requirement
|
|
73
|
-
none: false
|
|
74
121
|
requirements:
|
|
75
|
-
- - ~>
|
|
122
|
+
- - "~>"
|
|
76
123
|
- !ruby/object:Gem::Version
|
|
77
|
-
version: '
|
|
124
|
+
version: '3.13'
|
|
78
125
|
- !ruby/object:Gem::Dependency
|
|
79
|
-
name:
|
|
126
|
+
name: yard
|
|
80
127
|
requirement: !ruby/object:Gem::Requirement
|
|
81
|
-
none: false
|
|
82
128
|
requirements:
|
|
83
|
-
- - ~>
|
|
129
|
+
- - "~>"
|
|
84
130
|
- !ruby/object:Gem::Version
|
|
85
131
|
version: '0.9'
|
|
86
132
|
type: :development
|
|
87
133
|
prerelease: false
|
|
88
134
|
version_requirements: !ruby/object:Gem::Requirement
|
|
89
|
-
none: false
|
|
90
135
|
requirements:
|
|
91
|
-
- - ~>
|
|
136
|
+
- - "~>"
|
|
92
137
|
- !ruby/object:Gem::Version
|
|
93
138
|
version: '0.9'
|
|
94
139
|
- !ruby/object:Gem::Dependency
|
|
95
|
-
name:
|
|
140
|
+
name: valid_attribute
|
|
96
141
|
requirement: !ruby/object:Gem::Requirement
|
|
97
|
-
none: false
|
|
98
142
|
requirements:
|
|
99
|
-
- - ~>
|
|
143
|
+
- - "~>"
|
|
100
144
|
- !ruby/object:Gem::Version
|
|
101
|
-
version: '0
|
|
145
|
+
version: '2.0'
|
|
102
146
|
type: :development
|
|
103
147
|
prerelease: false
|
|
104
148
|
version_requirements: !ruby/object:Gem::Requirement
|
|
105
|
-
none: false
|
|
106
149
|
requirements:
|
|
107
|
-
- - ~>
|
|
150
|
+
- - "~>"
|
|
108
151
|
- !ruby/object:Gem::Version
|
|
109
|
-
version: '0
|
|
152
|
+
version: '2.0'
|
|
153
|
+
- !ruby/object:Gem::Dependency
|
|
154
|
+
name: pry
|
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
|
156
|
+
requirements:
|
|
157
|
+
- - "~>"
|
|
158
|
+
- !ruby/object:Gem::Version
|
|
159
|
+
version: '0.14'
|
|
160
|
+
type: :development
|
|
161
|
+
prerelease: false
|
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
163
|
+
requirements:
|
|
164
|
+
- - "~>"
|
|
165
|
+
- !ruby/object:Gem::Version
|
|
166
|
+
version: '0.14'
|
|
110
167
|
- !ruby/object:Gem::Dependency
|
|
111
|
-
name: simplecov
|
|
168
|
+
name: simplecov
|
|
112
169
|
requirement: !ruby/object:Gem::Requirement
|
|
113
|
-
none: false
|
|
114
170
|
requirements:
|
|
115
|
-
- - ~>
|
|
171
|
+
- - "~>"
|
|
116
172
|
- !ruby/object:Gem::Version
|
|
117
|
-
version: '0.
|
|
173
|
+
version: '0.22'
|
|
118
174
|
type: :development
|
|
119
175
|
prerelease: false
|
|
120
176
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
-
none: false
|
|
122
177
|
requirements:
|
|
123
|
-
- - ~>
|
|
178
|
+
- - "~>"
|
|
124
179
|
- !ruby/object:Gem::Version
|
|
125
|
-
version: '0.
|
|
180
|
+
version: '0.22'
|
|
126
181
|
description: Emissão de Boletos Bancários em Ruby
|
|
127
182
|
email:
|
|
128
183
|
- tomas_stefano@successoft.com
|
|
@@ -130,20 +185,12 @@ executables: []
|
|
|
130
185
|
extensions: []
|
|
131
186
|
extra_rdoc_files: []
|
|
132
187
|
files:
|
|
133
|
-
- .gitignore
|
|
134
|
-
- .rspec
|
|
135
|
-
- .rvmrc
|
|
136
188
|
- Changelog.markdown
|
|
137
|
-
- Gemfile
|
|
138
189
|
- LICENSE
|
|
139
|
-
- Planning.markdown
|
|
140
190
|
- README.markdown
|
|
141
|
-
- Rakefile
|
|
142
|
-
- TODO.markdown
|
|
143
|
-
- boleto_bancario.gemspec
|
|
144
|
-
- documentacoes_dos_boletos/Bradesco/Manual_BRADESCO.PDF
|
|
145
191
|
- lib/boleto_bancario.rb
|
|
146
192
|
- lib/boleto_bancario/calculos/digitos.rb
|
|
193
|
+
- lib/boleto_bancario/calculos/documento.rb
|
|
147
194
|
- lib/boleto_bancario/calculos/fator_vencimento.rb
|
|
148
195
|
- lib/boleto_bancario/calculos/fatores_de_multiplicacao.rb
|
|
149
196
|
- lib/boleto_bancario/calculos/linha_digitavel.rb
|
|
@@ -152,70 +199,57 @@ files:
|
|
|
152
199
|
- lib/boleto_bancario/calculos/modulo11_fator_de2a7.rb
|
|
153
200
|
- lib/boleto_bancario/calculos/modulo11_fator_de2a9.rb
|
|
154
201
|
- lib/boleto_bancario/calculos/modulo11_fator_de2a9_resto_zero.rb
|
|
202
|
+
- lib/boleto_bancario/calculos/modulo11_fator_de9a2.rb
|
|
155
203
|
- lib/boleto_bancario/calculos/modulo11_fator_de9a2_resto_x.rb
|
|
204
|
+
- lib/boleto_bancario/calculos/modulo_numero_de_controle.rb
|
|
156
205
|
- lib/boleto_bancario/core/banco_brasil.rb
|
|
206
|
+
- lib/boleto_bancario/core/banrisul.rb
|
|
157
207
|
- lib/boleto_bancario/core/boleto.rb
|
|
158
208
|
- lib/boleto_bancario/core/bradesco.rb
|
|
209
|
+
- lib/boleto_bancario/core/c6_bank.rb
|
|
210
|
+
- lib/boleto_bancario/core/caixa.rb
|
|
211
|
+
- lib/boleto_bancario/core/inter.rb
|
|
159
212
|
- lib/boleto_bancario/core/itau.rb
|
|
213
|
+
- lib/boleto_bancario/core/nubank.rb
|
|
160
214
|
- lib/boleto_bancario/core/santander.rb
|
|
215
|
+
- lib/boleto_bancario/core/sicoob.rb
|
|
216
|
+
- lib/boleto_bancario/core/sicredi.rb
|
|
217
|
+
- lib/boleto_bancario/locales/pt-BR.yml
|
|
218
|
+
- lib/boleto_bancario/renderers/base.rb
|
|
219
|
+
- lib/boleto_bancario/renderers/html_renderer.rb
|
|
220
|
+
- lib/boleto_bancario/renderers/pdf_renderer.rb
|
|
221
|
+
- lib/boleto_bancario/renderers/png_renderer.rb
|
|
222
|
+
- lib/boleto_bancario/templates/_barcode.html.erb
|
|
223
|
+
- lib/boleto_bancario/templates/_cedente.html.erb
|
|
224
|
+
- lib/boleto_bancario/templates/_header.html.erb
|
|
225
|
+
- lib/boleto_bancario/templates/_instructions.html.erb
|
|
226
|
+
- lib/boleto_bancario/templates/_payment.html.erb
|
|
227
|
+
- lib/boleto_bancario/templates/_sacado.html.erb
|
|
228
|
+
- lib/boleto_bancario/templates/boleto.html.erb
|
|
229
|
+
- lib/boleto_bancario/templates/boleto_styles.css
|
|
161
230
|
- lib/boleto_bancario/version.rb
|
|
162
|
-
-
|
|
163
|
-
- spec/boleto_bancario/calculos/fator_vencimento_spec.rb
|
|
164
|
-
- spec/boleto_bancario/calculos/fatores_de_multiplicacao_spec.rb
|
|
165
|
-
- spec/boleto_bancario/calculos/linha_digitavel_spec.rb
|
|
166
|
-
- spec/boleto_bancario/calculos/modulo10_spec.rb
|
|
167
|
-
- spec/boleto_bancario/calculos/modulo11_fator_de2a7_spec.rb
|
|
168
|
-
- spec/boleto_bancario/calculos/modulo11_fator_de2a9_resto_zero_spec.rb
|
|
169
|
-
- spec/boleto_bancario/calculos/modulo11_fator_de2a9_spec.rb
|
|
170
|
-
- spec/boleto_bancario/calculos/modulo11_fator_de9a2_resto_x_spec.rb
|
|
171
|
-
- spec/boleto_bancario/calculos/modulo11_spec.rb
|
|
172
|
-
- spec/boleto_bancario/core/banco_brasil_spec.rb
|
|
173
|
-
- spec/boleto_bancario/core/boleto_spec.rb
|
|
174
|
-
- spec/boleto_bancario/core/bradesco_spec.rb
|
|
175
|
-
- spec/boleto_bancario/core/itau_spec.rb
|
|
176
|
-
- spec/boleto_bancario/core/santander_spec.rb
|
|
177
|
-
- spec/shared_examples/boleto_bancario_shared_example.rb
|
|
178
|
-
- spec/spec_helper.rb
|
|
231
|
+
- lib/generators/boleto_bancario/views_generator.rb
|
|
179
232
|
homepage: https://github.com/tomas-stefano/boleto_bancario
|
|
180
|
-
licenses:
|
|
181
|
-
|
|
233
|
+
licenses:
|
|
234
|
+
- MIT
|
|
235
|
+
metadata: {}
|
|
236
|
+
post_install_message:
|
|
182
237
|
rdoc_options: []
|
|
183
238
|
require_paths:
|
|
184
239
|
- lib
|
|
185
240
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
186
|
-
none: false
|
|
187
241
|
requirements:
|
|
188
|
-
- -
|
|
242
|
+
- - ">="
|
|
189
243
|
- !ruby/object:Gem::Version
|
|
190
|
-
version:
|
|
244
|
+
version: 3.1.0
|
|
191
245
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
|
-
none: false
|
|
193
246
|
requirements:
|
|
194
|
-
- -
|
|
247
|
+
- - ">="
|
|
195
248
|
- !ruby/object:Gem::Version
|
|
196
|
-
version:
|
|
249
|
+
version: '0'
|
|
197
250
|
requirements: []
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
specification_version: 3
|
|
251
|
+
rubygems_version: 3.3.7
|
|
252
|
+
signing_key:
|
|
253
|
+
specification_version: 4
|
|
202
254
|
summary: Emissão de Boletos Bancários em Ruby
|
|
203
|
-
test_files:
|
|
204
|
-
- spec/boleto_bancario/calculos/digitos_spec.rb
|
|
205
|
-
- spec/boleto_bancario/calculos/fator_vencimento_spec.rb
|
|
206
|
-
- spec/boleto_bancario/calculos/fatores_de_multiplicacao_spec.rb
|
|
207
|
-
- spec/boleto_bancario/calculos/linha_digitavel_spec.rb
|
|
208
|
-
- spec/boleto_bancario/calculos/modulo10_spec.rb
|
|
209
|
-
- spec/boleto_bancario/calculos/modulo11_fator_de2a7_spec.rb
|
|
210
|
-
- spec/boleto_bancario/calculos/modulo11_fator_de2a9_resto_zero_spec.rb
|
|
211
|
-
- spec/boleto_bancario/calculos/modulo11_fator_de2a9_spec.rb
|
|
212
|
-
- spec/boleto_bancario/calculos/modulo11_fator_de9a2_resto_x_spec.rb
|
|
213
|
-
- spec/boleto_bancario/calculos/modulo11_spec.rb
|
|
214
|
-
- spec/boleto_bancario/core/banco_brasil_spec.rb
|
|
215
|
-
- spec/boleto_bancario/core/boleto_spec.rb
|
|
216
|
-
- spec/boleto_bancario/core/bradesco_spec.rb
|
|
217
|
-
- spec/boleto_bancario/core/itau_spec.rb
|
|
218
|
-
- spec/boleto_bancario/core/santander_spec.rb
|
|
219
|
-
- spec/shared_examples/boleto_bancario_shared_example.rb
|
|
220
|
-
- spec/spec_helper.rb
|
|
221
|
-
has_rdoc:
|
|
255
|
+
test_files: []
|
data/.gitignore
DELETED
data/.rspec
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
--color -f d
|
data/.rvmrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
rvm 1.9.3@boleto_bancario --create
|
data/Gemfile
DELETED
data/Planning.markdown
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
# BoletoBancario
|
|
2
|
-
|
|
3
|
-
Emissão de Boletos Bancários em Ruby. Simples, fácil e principalmente, flexível.
|
|
4
|
-
|
|
5
|
-
## Alternativas
|
|
6
|
-
|
|
7
|
-
Essa biblioteca é baseada em outras **ótimas** bibliotecas (**Recomendo analisar muito bem cada solução e usar a que resolver o seu problema!**):
|
|
8
|
-
|
|
9
|
-
* Stella Caelum [http://stella.caelum.com.br/](http://stella.caelum.com.br/)
|
|
10
|
-
* Novo Gateway de Pagamentos da Locaweb [http://www.locaweb.com.br/produtos/gateway-pagamento.html](http://www.locaweb.com.br/produtos/gateway-pagamento.html)
|
|
11
|
-
* Brcobranca [https://github.com/kivanio/brcobranca](https://github.com/kivanio/brcobranca)
|
|
12
|
-
* Boleto Php [http://boletophp.com.br/](http://boletophp.com.br/)
|
|
13
|
-
* Gem de Boleto Bancário (essa gem) [https://github.com/tomas-stefano/boleto_bancario](https://github.com/tomas-stefano/boleto_bancario)
|
|
14
|
-
|
|
15
|
-
## Instalação
|
|
16
|
-
|
|
17
|
-
gem install boleto_bancario
|
|
18
|
-
|
|
19
|
-
## Bancos Suportados
|
|
20
|
-
|
|
21
|
-
* TODO: Precisa escrever essa parte
|
|
22
|
-
|
|
23
|
-
## Usage
|
|
24
|
-
|
|
25
|
-
Você pode usar as próprias classes da gem, porém, **recomendo criar uma subclasse** para os bancos que você gostaria de desenvolver.
|
|
26
|
-
|
|
27
|
-
Exemplo:
|
|
28
|
-
|
|
29
|
-
```ruby
|
|
30
|
-
class Itau < BoletoBancario::Itau
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
class Santander < BoletoBancario::Santander
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
class Bradesco < BoletoBancario::Bradesco
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
class BancoBrasil < BoletoBancario::BancoBrasil
|
|
40
|
-
end
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Attributos
|
|
44
|
-
|
|
45
|
-
* TODO: Precisa escrever essa parte
|
|
46
|
-
|
|
47
|
-
## Internacionalização (i18n)
|
|
48
|
-
|
|
49
|
-
* TODO: Precisa escrever essa parte
|
|
50
|
-
|
|
51
|
-
## Validações
|
|
52
|
-
|
|
53
|
-
* TODO: Precisa escrever essa parte
|
|
54
|
-
|
|
55
|
-
## Código do Banco
|
|
56
|
-
|
|
57
|
-
* TODO: Precisa escrever essa parte
|
|
58
|
-
|
|
59
|
-
## Agência / Código do Cedente
|
|
60
|
-
|
|
61
|
-
* TODO: Precisa escrever essa parte
|
|
62
|
-
|
|
63
|
-
## Nosso Número
|
|
64
|
-
|
|
65
|
-
* TODO: Precisa escrever essa parte
|
|
66
|
-
|
|
67
|
-
## Código de Barras
|
|
68
|
-
|
|
69
|
-
* TODO: Precisa escrever essa parte
|
|
70
|
-
|
|
71
|
-
## Linha digitável
|
|
72
|
-
|
|
73
|
-
* TODO: Precisa escrever essa parte
|
|
74
|
-
|
|
75
|
-
## Documentação
|
|
76
|
-
|
|
77
|
-
* TODO: Precisa escrever essa parte
|
|
78
|
-
|
|
79
|
-
## Formatos
|
|
80
|
-
|
|
81
|
-
* TODO: Essa parte ainda pode mudar até a versão 0.0.1.
|
|
82
|
-
|
|
83
|
-
HTML 5 é o formato suportado por enquanto. Para usar em Html, você precisa usar a gem **[boleto_bancario_html](https://github.com/tomas-stefano/boleto_bancario_html)**:
|
|
84
|
-
|
|
85
|
-
gem install boleto_bancario_html
|
|
86
|
-
|
|
87
|
-
E colocar na classe:
|
|
88
|
-
|
|
89
|
-
```ruby
|
|
90
|
-
class Itau < BoletoBancario::Itau
|
|
91
|
-
def format
|
|
92
|
-
BoletoBancario::HTML5
|
|
93
|
-
end
|
|
94
|
-
end
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
Para renderizar o html:
|
|
98
|
-
|
|
99
|
-
```ruby
|
|
100
|
-
itau = Itau.new
|
|
101
|
-
|
|
102
|
-
itau.render # Irá chamar o método render da instância do objeto passado no método format.
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
### Criando um novo Formato
|
|
106
|
-
|
|
107
|
-
Em relação a parte de formatos a gem de boleto bancário é extremamente flexível.
|
|
108
|
-
|
|
109
|
-
Basta criar um objeto que responda ao método **render**:
|
|
110
|
-
|
|
111
|
-
```ruby
|
|
112
|
-
module BoletoBancario
|
|
113
|
-
module Formato
|
|
114
|
-
class Pdf < Boleto
|
|
115
|
-
def render(*args)
|
|
116
|
-
# ...
|
|
117
|
-
end
|
|
118
|
-
end
|
|
119
|
-
end
|
|
120
|
-
end
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
## Contribuições
|
|
124
|
-
|
|
125
|
-
Seja um contribuidor. Você pode contribuir de N formas. Seguem elas:
|
|
126
|
-
|
|
127
|
-
* Homologando boletos junto ao banco.
|
|
128
|
-
* Fornecendo documentações mais atualizadas dos Bancos.
|
|
129
|
-
* Escrevendo novos formatos (PDF, PNG), e me avisando para divulgar no Readme.
|
|
130
|
-
* Refatorando código!!
|
|
131
|
-
* Fornecendo Feedback construtivo! (Sempre bem vindo!)
|
data/Rakefile
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
require 'bundler/gem_tasks'
|
|
3
|
-
require 'yard'
|
|
4
|
-
|
|
5
|
-
desc 'Generate documentation'
|
|
6
|
-
YARD::Rake::YardocTask.new do |t|
|
|
7
|
-
t.files = ['lib/**/*.rb', '-', 'LICENSE']
|
|
8
|
-
t.options = ['--main', 'README.markdown', '--no-private', '--title', "Boleto Bancário #{BoletoBancario::VERSION}"]
|
|
9
|
-
end
|
data/TODO.markdown
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
* Colocar exemplos melhores na documentação de cada banco.
|
|
2
|
-
* Nos exemplos de cada banco colocar os métodos que são chamados pelo objeto.
|
|
3
|
-
* Verificar as validações e suas mensagens de erro.
|
|
4
|
-
* Internacionalização / Locales.
|
|
5
|
-
* Verificar a questão dos formatos (html, pdf).
|
data/boleto_bancario.gemspec
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
|
2
|
-
require File.expand_path('../lib/boleto_bancario/version', __FILE__)
|
|
3
|
-
|
|
4
|
-
Gem::Specification.new do |gem|
|
|
5
|
-
gem.authors = ["Tomas D'Stefano"]
|
|
6
|
-
gem.email = ["tomas_stefano@successoft.com"]
|
|
7
|
-
gem.description = %q{Emissão de Boletos Bancários em Ruby}
|
|
8
|
-
gem.summary = %q{Emissão de Boletos Bancários em Ruby}
|
|
9
|
-
gem.homepage = "https://github.com/tomas-stefano/boleto_bancario"
|
|
10
|
-
|
|
11
|
-
gem.files = `git ls-files`.split($\).reject { |f| File.extname(f) == '.pdf' }
|
|
12
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
|
13
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
|
14
|
-
gem.name = "boleto_bancario"
|
|
15
|
-
gem.require_paths = ["lib"]
|
|
16
|
-
gem.version = BoletoBancario::VERSION
|
|
17
|
-
|
|
18
|
-
gem.add_dependency "activesupport", "~> 3.2"
|
|
19
|
-
gem.add_dependency "activemodel", "~> 3.2"
|
|
20
|
-
gem.add_development_dependency "rspec", "~> 2.11"
|
|
21
|
-
gem.add_development_dependency "valid_attribute", "~> 1.3"
|
|
22
|
-
gem.add_development_dependency "pry", "~> 0.9"
|
|
23
|
-
gem.add_development_dependency "simplecov", "~> 0.2"
|
|
24
|
-
gem.add_development_dependency "simplecov-html", "~> 0.7"
|
|
25
|
-
end
|
|
Binary file
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
module BoletoBancario
|
|
4
|
-
module Calculos
|
|
5
|
-
describe Digitos do
|
|
6
|
-
(0..9).each do |number|
|
|
7
|
-
it "should return self when is #{number}" do
|
|
8
|
-
Digitos.new(number).sum.should eq number
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
{ 11 => 2, '18' => 9, 99 => 18, '58' => 13, 112 => 4, '235' => 10 }.each do |number, expecting|
|
|
13
|
-
it "should sum the sum of the digits when is '#{number}', expecting to be '#{expecting}'" do
|
|
14
|
-
Digitos.new(number).sum.should eq expecting
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|