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

#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_endereco_requiredObject

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



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

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'


47
48
49
# File 'lib/br_boleto/pagador.rb', line 47

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'


55
56
57
# File 'lib/br_boleto/pagador.rb', line 55

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'


70
71
72
# File 'lib/br_boleto/pagador.rb', line 70

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'


78
79
80
# File 'lib/br_boleto/pagador.rb', line 78

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

#endereco_formatadoObject



22
23
24
25
26
27
28
29
# File 'lib/br_boleto/pagador.rb', line 22

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



39
40
41
# File 'lib/br_boleto/pagador.rb', line 39

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

#tipo_documento_avalista(tamanho = 2) ⇒ Object



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

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