Class: CNAB240::BancoABC::Entities::HeaderBuilder

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

Instance Method Summary collapse

Methods inherited from Base

#register?, #trailler?

Instance Method Details

#codigo_do_banco(data) ⇒ Object



11
12
13
# File 'lib/cnab240/bancoabc/entities/header_builder.rb', line 11

def codigo_do_banco(data)
  prepend_zero(data, 3)
end

#codigo_identificacao_empresa_banco(data) ⇒ Object



35
36
37
# File 'lib/cnab240/bancoabc/entities/header_builder.rb', line 35

def codigo_identificacao_empresa_banco(data)
  prepend_zero(data, 20)
end

#codigo_retorno(data) ⇒ Object



51
52
53
# File 'lib/cnab240/bancoabc/entities/header_builder.rb', line 51

def codigo_retorno(data)
  prepend_zero(data, 1)
end

#data_geracao(date_time) ⇒ Object



55
56
57
# File 'lib/cnab240/bancoabc/entities/header_builder.rb', line 55

def data_geracao(date_time)
  date_time.strftime("%d%m%Y")
end

#desidade_gravacao_arquivo(data) ⇒ Object



73
74
75
# File 'lib/cnab240/bancoabc/entities/header_builder.rb', line 73

def desidade_gravacao_arquivo(data)
  prepend_zero(data, 5)
end

#header?Boolean

Returns:

  • (Boolean)


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

def header?
  true
end

#hora_geracao(date_time) ⇒ Object



59
60
61
# File 'lib/cnab240/bancoabc/entities/header_builder.rb', line 59

def hora_geracao(date_time)
  date_time.strftime("%H%M%S")
end

#lote_servico(data) ⇒ Object



15
16
17
# File 'lib/cnab240/bancoabc/entities/header_builder.rb', line 15

def lote_servico(data)
  prepend_zero(data, 4)
end

#nome_banco(data) ⇒ Object



43
44
45
# File 'lib/cnab240/bancoabc/entities/header_builder.rb', line 43

def nome_banco(data)
  append_space(data, 30)
end

#nome_empresa(data) ⇒ Object



39
40
41
# File 'lib/cnab240/bancoabc/entities/header_builder.rb', line 39

def nome_empresa(data)
  append_space(data, 30)
end

#numero_inscricao_da_empresa(data) ⇒ Object



31
32
33
# File 'lib/cnab240/bancoabc/entities/header_builder.rb', line 31

def numero_inscricao_da_empresa(data)
  prepend_zero(data, 14)
end

#numero_sequencial(date_time) ⇒ Object



63
64
65
66
67
# File 'lib/cnab240/bancoabc/entities/header_builder.rb', line 63

def numero_sequencial(date_time)
  date = date_time.day.to_s + date_time.hour.to_s + date_time.min.to_s

  prepend_zero(date, 6)
end

#numero_versao_layout(data) ⇒ Object



69
70
71
# File 'lib/cnab240/bancoabc/entities/header_builder.rb', line 69

def numero_versao_layout(data)
  prepend_zero(data, 3)
end

#tipo_inscricao_da_empresa(data) ⇒ Object



27
28
29
# File 'lib/cnab240/bancoabc/entities/header_builder.rb', line 27

def tipo_inscricao_da_empresa(data)
  prepend_zero(data, 1)
end

#tipo_servico(data) ⇒ Object



19
20
21
# File 'lib/cnab240/bancoabc/entities/header_builder.rb', line 19

def tipo_servico(data)
  prepend_zero(data, 1)
end

#uso_exclusivo_febraban_1(data = nil) ⇒ Object



23
24
25
# File 'lib/cnab240/bancoabc/entities/header_builder.rb', line 23

def uso_exclusivo_febraban_1(data = nil)
  append_space(data, 9)
end

#uso_exclusivo_febraban_2(data = nil) ⇒ Object



47
48
49
# File 'lib/cnab240/bancoabc/entities/header_builder.rb', line 47

def uso_exclusivo_febraban_2(data = nil)
  append_space(data, 10)
end

#uso_exclusivo_febraban_3(data = nil) ⇒ Object



85
86
87
# File 'lib/cnab240/bancoabc/entities/header_builder.rb', line 85

def uso_exclusivo_febraban_3(data = nil)
  append_space(data, 29)
end

#uso_reservado_banco(data = nil) ⇒ Object



77
78
79
# File 'lib/cnab240/bancoabc/entities/header_builder.rb', line 77

def uso_reservado_banco(data = nil)
  append_space(data, 20)
end

#uso_reservado_empresa(data = nil) ⇒ Object



81
82
83
# File 'lib/cnab240/bancoabc/entities/header_builder.rb', line 81

def uso_reservado_empresa(data = nil)
  append_space(data, 20)
end