Class: Cieloz::RequisicaoTransacao::DadosPortador
- Inherits:
-
Object
- Object
- Cieloz::RequisicaoTransacao::DadosPortador
- Includes:
- Helpers
- Defined in:
- lib/cieloz/requisicao_transacao/dados_portador.rb
Defined Under Namespace
Modules: TEST
Constant Summary collapse
- INDICADOR_NAO_INFORMADO =
0- INDICADOR_INFORMADO =
1- INDICADOR_ILEGIVEL =
2- INDICADOR_INEXISTENTE =
9
Instance Attribute Summary collapse
-
#codigo_seguranca ⇒ Object
Returns the value of attribute codigo_seguranca.
-
#indicador ⇒ Object
readonly
Returns the value of attribute indicador.
-
#nome_portador ⇒ Object
Returns the value of attribute nome_portador.
-
#numero ⇒ Object
Returns the value of attribute numero.
-
#validade ⇒ Object
Returns the value of attribute validade.
Class Method Summary collapse
Instance Method Summary collapse
- #attributes ⇒ Object
- #indicador_ilegivel! ⇒ Object
- #indicador_inexistente! ⇒ Object
- #indicador_nao_informado! ⇒ Object
-
#initialize(attrs = {}) ⇒ DadosPortador
constructor
A new instance of DadosPortador.
- #mascara ⇒ Object
Methods included from Helpers
Constructor Details
#initialize(attrs = {}) ⇒ DadosPortador
Returns a new instance of DadosPortador.
33 34 35 36 |
# File 'lib/cieloz/requisicao_transacao/dados_portador.rb', line 33 def initialize attrs={} super indicador_nao_informado! if codigo_seguranca.blank? end |
Instance Attribute Details
#codigo_seguranca ⇒ Object
Returns the value of attribute codigo_seguranca.
11 12 13 |
# File 'lib/cieloz/requisicao_transacao/dados_portador.rb', line 11 def codigo_seguranca @codigo_seguranca end |
#indicador ⇒ Object (readonly)
Returns the value of attribute indicador.
11 12 13 |
# File 'lib/cieloz/requisicao_transacao/dados_portador.rb', line 11 def indicador @indicador end |
#nome_portador ⇒ Object
Returns the value of attribute nome_portador.
10 11 12 |
# File 'lib/cieloz/requisicao_transacao/dados_portador.rb', line 10 def nome_portador @nome_portador end |
#numero ⇒ Object
Returns the value of attribute numero.
10 11 12 |
# File 'lib/cieloz/requisicao_transacao/dados_portador.rb', line 10 def numero @numero end |
#validade ⇒ Object
Returns the value of attribute validade.
10 11 12 |
# File 'lib/cieloz/requisicao_transacao/dados_portador.rb', line 10 def validade @validade end |
Class Method Details
.map(source, opts = {}) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/cieloz/requisicao_transacao/dados_portador.rb', line 25 def self.map(source, opts={}) num, val, cod, nome = attrs_from source, opts, :numero, :validade, :codigo_seguranca, :nome_portador new source: source, opts: opts, numero: num, validade: val, codigo_seguranca: cod, nome_portador: nome end |
Instance Method Details
#attributes ⇒ Object
64 65 66 67 68 69 70 71 72 |
# File 'lib/cieloz/requisicao_transacao/dados_portador.rb', line 64 def attributes { numero: @numero, validade: @validade, indicador: indicador, codigo_seguranca: @codigo_seguranca, nome_portador: @nome_portador } end |
#indicador_ilegivel! ⇒ Object
54 55 56 57 |
# File 'lib/cieloz/requisicao_transacao/dados_portador.rb', line 54 def indicador_ilegivel! @indicador = INDICADOR_ILEGIVEL @codigo_seguranca = nil end |
#indicador_inexistente! ⇒ Object
59 60 61 62 |
# File 'lib/cieloz/requisicao_transacao/dados_portador.rb', line 59 def indicador_inexistente! @indicador = INDICADOR_INEXISTENTE @codigo_seguranca = nil end |
#indicador_nao_informado! ⇒ Object
49 50 51 52 |
# File 'lib/cieloz/requisicao_transacao/dados_portador.rb', line 49 def indicador_nao_informado! @indicador = INDICADOR_NAO_INFORMADO @codigo_seguranca = nil end |
#mascara ⇒ Object
38 39 40 41 42 |
# File 'lib/cieloz/requisicao_transacao/dados_portador.rb', line 38 def mascara num = numero.to_s mask_size = num.length - 6 ("*" * mask_size) + num[mask_size..-1] end |