Class: MCFDI::Entity

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

Overview

Entity Class for transmitter and receptor

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

attr_accessor, attributes, #attributes, #to_h

Constructor Details

#initialize(args = {}) ⇒ Entity

Returns a new instance of Entity.



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

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

Instance Attribute Details

#addressObject

Returns the value of attribute address.



10
11
12
# File 'lib/m_cfdi/entity.rb', line 10

def address
  @address
end

#business_nameObject

Returns the value of attribute business_name.



10
11
12
# File 'lib/m_cfdi/entity.rb', line 10

def business_name
  @business_name
end

#fiscal_regimeObject

Returns the value of attribute fiscal_regime.



10
11
12
# File 'lib/m_cfdi/entity.rb', line 10

def fiscal_regime
  @fiscal_regime
end

#issued_inObject

Returns the value of attribute issued_in.



10
11
12
# File 'lib/m_cfdi/entity.rb', line 10

def issued_in
  @issued_in
end

#rfcObject

Returns the value of attribute rfc.



10
11
12
# File 'lib/m_cfdi/entity.rb', line 10

def rfc
  @rfc
end

Instance Method Details

#original_stringObject

return original string without fiscal regime.



36
37
38
39
40
41
# File 'lib/m_cfdi/entity.rb', line 36

def original_string
  issued = @issued_in ? @issued_in.original_string : nil
  co = [@rfc, @business_name, @address.original_string]
  co.insert(3, issued) if issued
  co.flatten
end

#to_xObject

return hash with values for invoice xml.



31
32
33
# File 'lib/m_cfdi/entity.rb', line 31

def to_x
  { nombre: @business_name, rfc: @rfc }
end