class MCFDI::Entity

Entity Class for transmitter and receptor

Attributes

address[RW]
business_name[RW]
fiscal_regime[RW]
issued_in[RW]
rfc[RW]

Public Class Methods

new(args = {}) click to toggle source
# File lib/m_cfdi/entity.rb, line 12
def initialize(args = {})
  args.each { |key, value| send("#{key}=", value) }
end

Public Instance Methods

address=(data) click to toggle source

if address is a hash, create a class of address with the hash.

# File lib/m_cfdi/entity.rb, line 17
def address=(data)
  data = Address.new(data) unless data.is_a? Address
  @address = data
end
issued_in=(address) click to toggle source

if address is a hash, create a class of address with the hash.

# File lib/m_cfdi/entity.rb, line 23
def issued_in=(address)
  return unless address
  data = Address.new(data) unless data.is_a? Address
  @address = data
end
original_string() click to toggle source

return original string without fiscal regime.

# 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_x() click to toggle source

return hash with values for invoice xml.

# File lib/m_cfdi/entity.rb, line 31
def to_x
  { nombre: @business_name, rfc: @rfc }
end