Class: RubyCnab240::Arquivo::Lote::Segment::B
- Inherits:
-
RubyCnab240::Arquivo::Lote::Segment
- Object
- RubyCnab240::Arquivo
- RubyCnab240::Arquivo::Lote
- RubyCnab240::Arquivo::Lote::Segment
- RubyCnab240::Arquivo::Lote::Segment::B
- Defined in:
- lib/rubycnab240/arquivo/lotes/segments/b.rb
Instance Attribute Summary collapse
-
#aviso_ao_favorecido ⇒ Object
Returns the value of attribute aviso_ao_favorecido.
-
#campos_de_endereco_opcionais ⇒ Object
Returns the value of attribute campos_de_endereco_opcionais.
-
#codigo_do_banco_na_compensacao ⇒ Object
Returns the value of attribute codigo_do_banco_na_compensacao.
-
#codigo_segmento_do_registro_detalhe ⇒ Object
readonly
Returns the value of attribute codigo_segmento_do_registro_detalhe.
-
#lote_do_servico ⇒ Object
Returns the value of attribute lote_do_servico.
-
#numero_de_inscricao_do_favorecido ⇒ Object
Returns the value of attribute numero_de_inscricao_do_favorecido.
-
#numero_sequencial_de_registro_no_lote ⇒ Object
Returns the value of attribute numero_sequencial_de_registro_no_lote.
-
#tipo_de_inscricao_do_favorecido ⇒ Object
Returns the value of attribute tipo_de_inscricao_do_favorecido.
-
#tipo_de_registro ⇒ Object
Returns the value of attribute tipo_de_registro.
-
#uso_exclusivo_do_siape ⇒ Object
readonly
Returns the value of attribute uso_exclusivo_do_siape.
-
#uso_exclusivo_febraban ⇒ Object
readonly
Returns the value of attribute uso_exclusivo_febraban.
-
#uso_exclusivo_febraban2 ⇒ Object
readonly
Returns the value of attribute uso_exclusivo_febraban2.
Attributes inherited from RubyCnab240::Arquivo::Lote
#lot_header, #lot_trailer, #lots
Attributes inherited from RubyCnab240::Arquivo
#data_dos_pagamentos, #header, #lot_header, #lot_trailer, #segments, #trailer
Instance Method Summary collapse
-
#initialize(fields = {}) ⇒ B
constructor
A new instance of B.
- #to_string ⇒ Object
Methods inherited from RubyCnab240::Arquivo::Lote
Methods inherited from RubyCnab240::Arquivo
#<<, #number_of_segments, #save_to_file
Constructor Details
#initialize(fields = {}) ⇒ B
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rubycnab240/arquivo/lotes/segments/b.rb', line 16 def initialize(fields = {}) @codigo_do_banco_na_compensacao = fields[:codigo_do_banco_na_compensacao].to_s[0..2].rjust(3, '0') #default: 001 @lote_do_servico = fields[:lote_do_servico].to_s[0..3].rjust(4, '0') @tipo_de_registro = fields[:tipo_de_registro] = '3' @numero_sequencial_de_registro_no_lote = fields[:numero_sequencial_de_registro_no_lote].to_s[0..4].rjust(5, '0') #Começar com 00002 e ir incrementando em 1 a cada nova linha do registro detalhe, esse sequencial é continuação do segmento 'A' anterior. @codigo_segmento_do_registro_detalhe = 'B' @uso_exclusivo_febraban = ' ' * 3 @tipo_de_inscricao_do_favorecido = fields[:tipo_de_inscricao_do_favorecido].to_s[0..0].rjust(1, '0') #Informação obrigatória para crédito via DOC/TED, saque on0line e ORPAG e caso a empresa queira que o sistema confronte o CPF/CNPJ com a agência/conta do favorecido informada. @numero_de_inscricao_do_favorecido = fields[:numero_de_inscricao_do_favorecido].to_s[0..13].rjust(14, '0') #Informação obrigatória para crédito via DOC/TED, saque online, ORPAG e caso a empresa queira que o sistema confronte o CPF/CNPJ com a agência/conta do favorecido informada. Neste último caso, deve ser solicitada para a agência que conste no cadastro do serviço para conferir número de inscrição do favorecido.. @campos_de_endereco_opcionais = ' ' * 193 @aviso_ao_favorecido = '0' #O ou 5 – o código 5 (com aviso) somente será tratado caso tenha sido negociado com a agência e conste no cadastramento do serviço a emissão de aviso. @uso_exclusivo_do_siape = ' ' * 6 @uso_exclusivo_febraban2 = ' ' * 8 end |
Instance Attribute Details
#aviso_ao_favorecido ⇒ Object
Returns the value of attribute aviso_ao_favorecido.
8 9 10 |
# File 'lib/rubycnab240/arquivo/lotes/segments/b.rb', line 8 def aviso_ao_favorecido @aviso_ao_favorecido end |
#campos_de_endereco_opcionais ⇒ Object
Returns the value of attribute campos_de_endereco_opcionais.
9 10 11 |
# File 'lib/rubycnab240/arquivo/lotes/segments/b.rb', line 9 def campos_de_endereco_opcionais @campos_de_endereco_opcionais end |
#codigo_do_banco_na_compensacao ⇒ Object
Returns the value of attribute codigo_do_banco_na_compensacao.
2 3 4 |
# File 'lib/rubycnab240/arquivo/lotes/segments/b.rb', line 2 def codigo_do_banco_na_compensacao @codigo_do_banco_na_compensacao end |
#codigo_segmento_do_registro_detalhe ⇒ Object (readonly)
Returns the value of attribute codigo_segmento_do_registro_detalhe.
11 12 13 |
# File 'lib/rubycnab240/arquivo/lotes/segments/b.rb', line 11 def codigo_segmento_do_registro_detalhe @codigo_segmento_do_registro_detalhe end |
#lote_do_servico ⇒ Object
Returns the value of attribute lote_do_servico.
3 4 5 |
# File 'lib/rubycnab240/arquivo/lotes/segments/b.rb', line 3 def lote_do_servico @lote_do_servico end |
#numero_de_inscricao_do_favorecido ⇒ Object
Returns the value of attribute numero_de_inscricao_do_favorecido.
7 8 9 |
# File 'lib/rubycnab240/arquivo/lotes/segments/b.rb', line 7 def numero_de_inscricao_do_favorecido @numero_de_inscricao_do_favorecido end |
#numero_sequencial_de_registro_no_lote ⇒ Object
Returns the value of attribute numero_sequencial_de_registro_no_lote.
5 6 7 |
# File 'lib/rubycnab240/arquivo/lotes/segments/b.rb', line 5 def numero_sequencial_de_registro_no_lote @numero_sequencial_de_registro_no_lote end |
#tipo_de_inscricao_do_favorecido ⇒ Object
Returns the value of attribute tipo_de_inscricao_do_favorecido.
6 7 8 |
# File 'lib/rubycnab240/arquivo/lotes/segments/b.rb', line 6 def tipo_de_inscricao_do_favorecido @tipo_de_inscricao_do_favorecido end |
#tipo_de_registro ⇒ Object
Returns the value of attribute tipo_de_registro.
4 5 6 |
# File 'lib/rubycnab240/arquivo/lotes/segments/b.rb', line 4 def tipo_de_registro @tipo_de_registro end |
#uso_exclusivo_do_siape ⇒ Object (readonly)
Returns the value of attribute uso_exclusivo_do_siape.
12 13 14 |
# File 'lib/rubycnab240/arquivo/lotes/segments/b.rb', line 12 def uso_exclusivo_do_siape @uso_exclusivo_do_siape end |
#uso_exclusivo_febraban ⇒ Object (readonly)
Returns the value of attribute uso_exclusivo_febraban.
13 14 15 |
# File 'lib/rubycnab240/arquivo/lotes/segments/b.rb', line 13 def uso_exclusivo_febraban @uso_exclusivo_febraban end |
#uso_exclusivo_febraban2 ⇒ Object (readonly)
Returns the value of attribute uso_exclusivo_febraban2.
14 15 16 |
# File 'lib/rubycnab240/arquivo/lotes/segments/b.rb', line 14 def uso_exclusivo_febraban2 @uso_exclusivo_febraban2 end |
Instance Method Details
#to_string ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/rubycnab240/arquivo/lotes/segments/b.rb', line 32 def to_string segmento = String.new segmento << self.codigo_do_banco_na_compensacao segmento << self.lote_do_servico segmento << self.tipo_de_registro segmento << self.numero_sequencial_de_registro_no_lote segmento << self.codigo_segmento_do_registro_detalhe segmento << self.uso_exclusivo_febraban segmento << self.tipo_de_inscricao_do_favorecido segmento << self.numero_de_inscricao_do_favorecido segmento << self.campos_de_endereco_opcionais segmento << self.aviso_ao_favorecido segmento << self.uso_exclusivo_do_siape segmento << self.uso_exclusivo_febraban2 end |