Class: CNAB240::BancoABC::Entities::RegisterT

Inherits:
Base
  • Object
show all
Defined in:
lib/cnab240/bancoabc/entities/register_t.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#header?, #trailler?

Constructor Details

#initialize(line) ⇒ RegisterT

Returns a new instance of RegisterT.



9
10
11
# File 'lib/cnab240/bancoabc/entities/register_t.rb', line 9

def initialize(line)
  @line = line
end

Instance Attribute Details

#lineObject (readonly)

Returns the value of attribute line.



7
8
9
# File 'lib/cnab240/bancoabc/entities/register_t.rb', line 7

def line
  @line
end

Instance Method Details

#agenciaObject



78
79
80
# File 'lib/cnab240/bancoabc/entities/register_t.rb', line 78

def agencia
  line[99..103]
end

#cod_movimentoObject



50
51
52
# File 'lib/cnab240/bancoabc/entities/register_t.rb', line 50

def cod_movimento
  line[15..16]
end

#codigo_carteiraObject



58
59
60
# File 'lib/cnab240/bancoabc/entities/register_t.rb', line 58

def codigo_carteira
  line[57]
end

#dataObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/cnab240/bancoabc/entities/register_t.rb', line 17

def data
  {
    segmento: segmento.strip,
    codigo_movimento: cod_movimento.strip,
    ocorrencia: ocorrencia.strip,
    identificacao_do_titulo: identificacao_do_titulo.strip,
    codigo_carteira: codigo_carteira.strip,
    numero_documento: numero_documento.strip,
    data_vencimento: data_vencimento.strip,
    valor_titulo: valor_titulo.strip,
    numero_do_banco: numero_do_banco.strip,
    agencia: agencia.strip,
    digito_verificador: digito_verificador.strip,
    uso_empresa: uso_empresa.strip,
    tipo_inscricao: tipo_inscricao.strip,
    numero_inscricao: numero_inscricao.strip,
    nome: nome.strip,
    valor_de_tarifas_custas_correspondentes: valor_de_tarifas_custas_correspondentes.strip,
    motivo_ocorrencia: motivo_ocorrencia.strip
  }
end

#data_vencimentoObject



66
67
68
# File 'lib/cnab240/bancoabc/entities/register_t.rb', line 66

def data_vencimento
  line[73..80]
end

#digito_verificadorObject



82
83
84
# File 'lib/cnab240/bancoabc/entities/register_t.rb', line 82

def digito_verificador
  line[104]
end

#identificacao_do_tituloObject



54
55
56
# File 'lib/cnab240/bancoabc/entities/register_t.rb', line 54

def identificacao_do_titulo
  line[46..56]
end

#motivo_ocorrenciaObject



106
107
108
# File 'lib/cnab240/bancoabc/entities/register_t.rb', line 106

def motivo_ocorrencia
  line[213..222]
end

#nomeObject



98
99
100
# File 'lib/cnab240/bancoabc/entities/register_t.rb', line 98

def nome
  line[148..187]
end

#numero_do_bancoObject



74
75
76
# File 'lib/cnab240/bancoabc/entities/register_t.rb', line 74

def numero_do_banco
  line[96..98]
end

#numero_documentoObject



62
63
64
# File 'lib/cnab240/bancoabc/entities/register_t.rb', line 62

def numero_documento
  line[58..72]
end

#numero_inscricaoObject



94
95
96
# File 'lib/cnab240/bancoabc/entities/register_t.rb', line 94

def numero_inscricao
  line[133..147]
end

#ocorrenciaObject



39
40
41
42
43
44
# File 'lib/cnab240/bancoabc/entities/register_t.rb', line 39

def ocorrencia
  action = CNAB240::BancoABC::OCORRENCIAS.select { |_k, v| v == cod_movimento }
  return "ocorrencia_nao_mapeada" if action.empty?

  action.keys.last.to_s
end

#register?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/cnab240/bancoabc/entities/register_t.rb', line 13

def register?
  true
end

#segmentoObject



46
47
48
# File 'lib/cnab240/bancoabc/entities/register_t.rb', line 46

def segmento
  line[13]
end

#tipo_inscricaoObject



90
91
92
# File 'lib/cnab240/bancoabc/entities/register_t.rb', line 90

def tipo_inscricao
  line[132]
end

#uso_empresaObject



86
87
88
# File 'lib/cnab240/bancoabc/entities/register_t.rb', line 86

def uso_empresa
  line[105..129]
end

#valor_de_tarifas_custas_correspondentesObject



102
103
104
# File 'lib/cnab240/bancoabc/entities/register_t.rb', line 102

def valor_de_tarifas_custas_correspondentes
  line[198..212]
end

#valor_tituloObject



70
71
72
# File 'lib/cnab240/bancoabc/entities/register_t.rb', line 70

def valor_titulo
  line[81..95]
end