Class: Cnab240::BoletoBancoob
- Defined in:
- lib/cnab240/helper/boleto_bancoob.rb
Instance Attribute Summary
Attributes inherited from Helper
Instance Method Summary collapse
- #<<(campos) ⇒ Object
- #add_lote(campos = {}) ⇒ Object
-
#initialize(campos = {}) ⇒ BoletoBancoob
constructor
A new instance of BoletoBancoob.
Methods inherited from Helper
Methods included from Filler
Constructor Details
#initialize(campos = {}) ⇒ BoletoBancoob
Returns a new instance of BoletoBancoob.
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/cnab240/helper/boleto_bancoob.rb', line 3 def initialize(campos = {}) campos[:controle_banco] ||= '756' campos[:banco_nome] ||= 'BANCO COOPERATIVO DO BRASIL S/A.' campos[:empresa_tipo] ||= '2' campos[:arquivo_data_geracao] ||= (Time.respond_to?(:current) ? Time.current : Time.now).strftime('%d%m%Y') campos[:arquivo_hora_geracao] ||= (Time.respond_to?(:current) ? Time.current : Time.now).strftime('%H%M%S') campos[:arquivo_codigo] ||= '1' @arquivo = Cnab240::Arquivo::Arquivo.new('V81') fill campos, arquivo.header, arquivo.trailer end |
Instance Method Details
#<<(campos) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/cnab240/helper/boleto_bancoob.rb', line 25 def <<(campos) lote = @arquivo.lotes.last campos[:controle_banco] ||= '756' campos[:controle_lote] = @arquivo.lotes.length.to_s campos[:servico_numero_registro] = (lote.segmentos.length + 1).to_s # 01 - Entrada de títulos campos[:servico_codigo_movimento] ||= '01' segmento_p = Cnab240::V81::SegmentoP.new fill campos, segmento_p lote << segmento_p campos[:controle_lote] = @arquivo.lotes.length.to_s campos[:servico_numero_registro] = (lote.segmentos.length + 1).to_s segmento_q = Cnab240::V81::SegmentoQ.new fill campos, segmento_q lote << segmento_q campos[:controle_lote] = @arquivo.lotes.length.to_s campos[:servico_numero_registro] = (lote.segmentos.length + 1).to_s segmento_r = Cnab240::V81::SegmentoR.new fill campos, segmento_r lote << segmento_r campos[:controle_lote] = @arquivo.lotes.length.to_s campos[:servico_numero_registro] = (lote.segmentos.length + 1).to_s segmento_s = Cnab240::V81::SegmentoS.new fill campos, segmento_s lote << segmento_s end |
#add_lote(campos = {}) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/cnab240/helper/boleto_bancoob.rb', line 16 def add_lote(campos = {}) @arquivo.lotes << lote = Cnab240::Lote.new(operacao: :boleto, tipo: :remessa, versao: 'V81') campos[:controle_banco] ||= '756' campos[:controle_lote] = (@arquivo.lotes.length).to_s fill campos, lote.header, lote.trailer end |