Class: Culqi::Sale
- Inherits:
-
Object
- Object
- Culqi::Sale
- Defined in:
- lib/culqi/sale.rb
Constant Summary collapse
- DEFAULTS =
{ moneda: 'PEN', cod_pais: 'PE' }
Instance Attribute Summary collapse
-
#apellidos ⇒ Object
Returns the value of attribute apellidos.
-
#ciudad ⇒ Object
Returns the value of attribute ciudad.
-
#cod_pais ⇒ Object
Returns the value of attribute cod_pais.
-
#codigo_comercio ⇒ Object
Returns the value of attribute codigo_comercio.
-
#correo_electronico ⇒ Object
Returns the value of attribute correo_electronico.
-
#descripcion ⇒ Object
Returns the value of attribute descripcion.
-
#direccion ⇒ Object
Returns the value of attribute direccion.
-
#id_usuario_comercio ⇒ Object
Returns the value of attribute id_usuario_comercio.
-
#moneda ⇒ Object
Returns the value of attribute moneda.
-
#monto ⇒ Object
Returns the value of attribute monto.
-
#nombres ⇒ Object
Returns the value of attribute nombres.
-
#num_tel ⇒ Object
Returns the value of attribute num_tel.
-
#numero_pedido ⇒ Object
Returns the value of attribute numero_pedido.
Instance Method Summary collapse
-
#initialize(attrs) ⇒ Sale
constructor
A new instance of Sale.
- #payload ⇒ Object
Constructor Details
#initialize(attrs) ⇒ Sale
Returns a new instance of Sale.
22 23 24 |
# File 'lib/culqi/sale.rb', line 22 def initialize(attrs) attrs.each { |key, value| public_send("#{ key }=", value) } end |
Instance Attribute Details
#apellidos ⇒ Object
Returns the value of attribute apellidos.
8 9 10 |
# File 'lib/culqi/sale.rb', line 8 def apellidos @apellidos end |
#ciudad ⇒ Object
Returns the value of attribute ciudad.
8 9 10 |
# File 'lib/culqi/sale.rb', line 8 def ciudad @ciudad end |
#cod_pais ⇒ Object
Returns the value of attribute cod_pais.
8 9 10 |
# File 'lib/culqi/sale.rb', line 8 def cod_pais @cod_pais end |
#codigo_comercio ⇒ Object
Returns the value of attribute codigo_comercio.
8 9 10 |
# File 'lib/culqi/sale.rb', line 8 def codigo_comercio @codigo_comercio end |
#correo_electronico ⇒ Object
Returns the value of attribute correo_electronico.
8 9 10 |
# File 'lib/culqi/sale.rb', line 8 def correo_electronico @correo_electronico end |
#descripcion ⇒ Object
Returns the value of attribute descripcion.
8 9 10 |
# File 'lib/culqi/sale.rb', line 8 def descripcion @descripcion end |
#direccion ⇒ Object
Returns the value of attribute direccion.
8 9 10 |
# File 'lib/culqi/sale.rb', line 8 def direccion @direccion end |
#id_usuario_comercio ⇒ Object
Returns the value of attribute id_usuario_comercio.
8 9 10 |
# File 'lib/culqi/sale.rb', line 8 def id_usuario_comercio @id_usuario_comercio end |
#moneda ⇒ Object
Returns the value of attribute moneda.
8 9 10 |
# File 'lib/culqi/sale.rb', line 8 def moneda @moneda end |
#monto ⇒ Object
Returns the value of attribute monto.
8 9 10 |
# File 'lib/culqi/sale.rb', line 8 def monto @monto end |
#nombres ⇒ Object
Returns the value of attribute nombres.
8 9 10 |
# File 'lib/culqi/sale.rb', line 8 def nombres @nombres end |
#num_tel ⇒ Object
Returns the value of attribute num_tel.
8 9 10 |
# File 'lib/culqi/sale.rb', line 8 def num_tel @num_tel end |
#numero_pedido ⇒ Object
Returns the value of attribute numero_pedido.
8 9 10 |
# File 'lib/culqi/sale.rb', line 8 def numero_pedido @numero_pedido end |
Instance Method Details
#payload ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/culqi/sale.rb', line 26 def payload { codigo_comercio: (codigo_comercio || ENV['CULQI_CODIGO_COMERCIO']), numero_pedido: numero_pedido, moneda: (moneda || DEFAULTS[:moneda]), monto: monto, descripcion: descripcion[0..79], correo_electronico: correo_electronico[0..49], cod_pais: (cod_pais || DEFAULTS[:cod_pais]), ciudad: ciudad, direccion: direccion, num_tel: num_tel[0..14], id_usuario_comercio: id_usuario_comercio, nombres: nombres[0..49], apellidos: apellidos[0..49] }.to_json end |