Class: BrBoleto::Pagador

Inherits:
ActiveModelBase show all
Defined in:
lib/br_boleto/pagador.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ActiveModelBase

#assign_attributes, #default_values, #initialize

Constructor Details

This class inherits a constructor from BrBoleto::ActiveModelBase

Instance Attribute Details

#bairroObject

Returns the value of attribute bairro.



7
8
9
# File 'lib/br_boleto/pagador.rb', line 7

def bairro
  @bairro
end

#cepObject

Returns the value of attribute cep.



8
9
10
# File 'lib/br_boleto/pagador.rb', line 8

def cep
  @cep
end

#cidadeObject

Returns the value of attribute cidade.



9
10
11
# File 'lib/br_boleto/pagador.rb', line 9

def cidade
  @cidade
end

#cpf_cnpjObject

Returns the value of attribute cpf_cnpj.



5
6
7
# File 'lib/br_boleto/pagador.rb', line 5

def cpf_cnpj
  @cpf_cnpj
end

#documento_avalistaObject

Returns the value of attribute documento_avalista.



13
14
15
# File 'lib/br_boleto/pagador.rb', line 13

def documento_avalista
  @documento_avalista
end

#enderecoObject

Returns the value of attribute endereco.



6
7
8
# File 'lib/br_boleto/pagador.rb', line 6

def endereco
  @endereco
end

#endereco_avalistaObject

Returns the value of attribute endereco_avalista.



14
15
16
# File 'lib/br_boleto/pagador.rb', line 14

def endereco_avalista
  @endereco_avalista
end

#nomeObject

Returns the value of attribute nome.



4
5
6
# File 'lib/br_boleto/pagador.rb', line 4

def nome
  @nome
end

#nome_avalistaObject

Returns the value of attribute nome_avalista.



12
13
14
# File 'lib/br_boleto/pagador.rb', line 12

def nome_avalista
  @nome_avalista
end

#ufObject

Returns the value of attribute uf.



10
11
12
# File 'lib/br_boleto/pagador.rb', line 10

def uf
  @uf
end

#valid_avalista_requiredObject

Returns the value of attribute valid_avalista_required.



20
21
22
# File 'lib/br_boleto/pagador.rb', line 20

def valid_avalista_required
  @valid_avalista_required
end

#valid_endereco_requiredObject

CUSTOM VALIDATIONS #################



17
18
19
# File 'lib/br_boleto/pagador.rb', line 17

def valid_endereco_required
  @valid_endereco_required
end

Instance Method Details

#cpf_cnpj_formatadoObject

Utiliado para sempre retornar numero do CPF/CNPJ com a formatação correta EX:

self.cpf_cnpj = 07475688798
puts self.cpf_cnpj_formatado
   ~> '074.756.887-98'


51
52
53
# File 'lib/br_boleto/pagador.rb', line 51

def cpf_cnpj_formatado
	BrBoleto::Helper::CpfCnpj.new(cpf_cnpj).com_formatacao
end

#cpf_cnpj_formatado_com_labelObject

Retorna o cpf ou cnpj com a formatação de pontos com label EX:

'CNPJ: 12.345.678/0001-88'
'CPF:  074.345.456-83'


59
60
61
# File 'lib/br_boleto/pagador.rb', line 59

def cpf_cnpj_formatado_com_label
	BrBoleto::Helper::CpfCnpj.new(cpf_cnpj).formatado_com_label
end

#documento_avalista_formatadoObject

Utiliado para sempre retornar numero do CPF/CNPJ com a formatação correta EX:

self.documento_avalista = 07475688798
puts self.documento_avalista_formatado
   ~> '074.756.887-98'


74
75
76
# File 'lib/br_boleto/pagador.rb', line 74

def documento_avalista_formatado
	BrBoleto::Helper::CpfCnpj.new(documento_avalista).com_formatacao
end

#documento_avalista_formatado_com_labelObject

Retorna o cpf ou cnpj com a formatação de pontos com label EX:

'CNPJ: 12.345.678/0001-88'
'CPF:  074.345.456-83'


82
83
84
# File 'lib/br_boleto/pagador.rb', line 82

def documento_avalista_formatado_com_label
	BrBoleto::Helper::CpfCnpj.new(documento_avalista).formatado_com_label
end

#endereco_formatadoObject



26
27
28
29
30
31
32
33
# File 'lib/br_boleto/pagador.rb', line 26

def endereco_formatado
	addr = []
	addr << endereco unless endereco.blank?
	addr << bairro   unless bairro.blank?
	addr << @cep     unless cep.blank?
	addr << "#{cidade}-#{uf}" unless cidade.blank?
	addr.join(' - ')
end

#tipo_cpf_cnpj(tamanho = 2) ⇒ Object



43
44
45
# File 'lib/br_boleto/pagador.rb', line 43

def tipo_cpf_cnpj(tamanho = 2)
	BrBoleto::Helper::CpfCnpj.new(cpf_cnpj).tipo_documento(tamanho)
end

#tipo_documento_avalista(tamanho = 2) ⇒ Object



63
64
65
# File 'lib/br_boleto/pagador.rb', line 63

def tipo_documento_avalista(tamanho = 2)
	BrBoleto::Helper::CpfCnpj.new(documento_avalista).tipo_documento(tamanho)
end