Class: BrBoleto::Pagador
- Inherits:
-
ActiveModelBase
- Object
- ActiveModelBase
- BrBoleto::Pagador
- Defined in:
- lib/br_boleto/pagador.rb
Instance Attribute Summary collapse
-
#bairro ⇒ Object
Returns the value of attribute bairro.
-
#cep ⇒ Object
Returns the value of attribute cep.
-
#cidade ⇒ Object
Returns the value of attribute cidade.
-
#cpf_cnpj ⇒ Object
Returns the value of attribute cpf_cnpj.
-
#documento_avalista ⇒ Object
Returns the value of attribute documento_avalista.
-
#endereco ⇒ Object
Returns the value of attribute endereco.
-
#nome ⇒ Object
Returns the value of attribute nome.
-
#nome_avalista ⇒ Object
Returns the value of attribute nome_avalista.
-
#uf ⇒ Object
Returns the value of attribute uf.
-
#valid_endereco_required ⇒ Object
CUSTOM VALIDATIONS #################.
Instance Method Summary collapse
-
#cpf_cnpj_formatado ⇒ Object
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’.
-
#cpf_cnpj_formatado_com_label ⇒ Object
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’.
-
#documento_avalista_formatado ⇒ Object
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’.
-
#documento_avalista_formatado_com_label ⇒ Object
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’.
- #endereco_formatado ⇒ Object
- #tipo_cpf_cnpj(tamanho = 2) ⇒ Object
- #tipo_documento_avalista(tamanho = 2) ⇒ Object
Methods inherited from ActiveModelBase
#assign_attributes, #default_values, #initialize
Constructor Details
This class inherits a constructor from BrBoleto::ActiveModelBase
Instance Attribute Details
#bairro ⇒ Object
Returns the value of attribute bairro.
7 8 9 |
# File 'lib/br_boleto/pagador.rb', line 7 def bairro @bairro end |
#cep ⇒ Object
Returns the value of attribute cep.
8 9 10 |
# File 'lib/br_boleto/pagador.rb', line 8 def cep @cep end |
#cidade ⇒ Object
Returns the value of attribute cidade.
9 10 11 |
# File 'lib/br_boleto/pagador.rb', line 9 def cidade @cidade end |
#cpf_cnpj ⇒ Object
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_avalista ⇒ Object
Returns the value of attribute documento_avalista.
13 14 15 |
# File 'lib/br_boleto/pagador.rb', line 13 def documento_avalista @documento_avalista end |
#endereco ⇒ Object
Returns the value of attribute endereco.
6 7 8 |
# File 'lib/br_boleto/pagador.rb', line 6 def endereco @endereco end |
#nome ⇒ Object
Returns the value of attribute nome.
4 5 6 |
# File 'lib/br_boleto/pagador.rb', line 4 def nome @nome end |
#nome_avalista ⇒ Object
Returns the value of attribute nome_avalista.
12 13 14 |
# File 'lib/br_boleto/pagador.rb', line 12 def nome_avalista @nome_avalista end |
#uf ⇒ Object
Returns the value of attribute uf.
10 11 12 |
# File 'lib/br_boleto/pagador.rb', line 10 def uf @uf end |
#valid_endereco_required ⇒ Object
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_formatado ⇒ Object
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_label ⇒ Object
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_formatado ⇒ Object
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_label ⇒ Object
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_formatado ⇒ Object
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 |