Class: MCFDI::Concept

Inherits:
Base
  • Object
show all
Defined in:
lib/m_cfdi/concept.rb

Overview

Concepts Class

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

attr_accessor, attributes, #attributes, #to_h

Constructor Details

#initialize(args = {}) ⇒ Concept

Returns a new instance of Concept.



14
15
16
# File 'lib/m_cfdi/concept.rb', line 14

def initialize(args = {})
  args.each { |key, value| send("#{key}=", value) }
end

Instance Attribute Details

#codeObject

Returns the value of attribute code.



12
13
14
# File 'lib/m_cfdi/concept.rb', line 12

def code
  @code
end

#importObject

Returns the value of attribute import.



12
13
14
# File 'lib/m_cfdi/concept.rb', line 12

def import
  @import
end

#measure_unitObject

Returns the value of attribute measure_unit.



12
13
14
# File 'lib/m_cfdi/concept.rb', line 12

def measure_unit
  @measure_unit
end

#nameObject

Returns the value of attribute name.



12
13
14
# File 'lib/m_cfdi/concept.rb', line 12

def name
  @name
end

#priceObject

Returns the value of attribute price.



12
13
14
# File 'lib/m_cfdi/concept.rb', line 12

def price
  @price
end

#quantityObject

Returns the value of attribute quantity.



12
13
14
# File 'lib/m_cfdi/concept.rb', line 12

def quantity
  @quantity
end

Instance Method Details

#original_stringObject

return original string of concept.



27
28
29
# File 'lib/m_cfdi/concept.rb', line 27

def original_string
  [@quantity, @measure_unit, @code, @name, @price.to_f, @import]
end

#to_xObject

return hash with values for invoice xml.



32
33
34
35
# File 'lib/m_cfdi/concept.rb', line 32

def to_x
  { cantidad: @quantity, unidad: @measure_unit, noIdentificacion: @code,
    descripcion: @name, valorUnitario: @price, importe: @import }
end