class MCFDI::Address

Address Class for transmitter and receptor.

Attributes

city[RW]
country[RW]
interior_number[RW]
location[RW]
neighborhood[RW]
reference[RW]
state[RW]
street[RW]
street_number[RW]
zip_code[RW]

Public Class Methods

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

Public Instance Methods

original_string() click to toggle source

return original string (cadena original) of the address.

# File lib/m_cfdi/address.rb, line 24
def original_string
  c = []
  self.attributes.each do |k|
    v = send(k)
    next unless v.present?
    c << v
  end
  c
end
to_x() click to toggle source

return hash with values in spanish for the xml.

# File lib/m_cfdi/address.rb, line 35
def to_x
  { calle: @street, noExterior: @street_number,
    noInterior: @interior_number, colonia: @neighborhood,
    localidad: @location, referencia: @reference, municipio: @city,
    estado: @state, pais: @country, codigoPostal: @zip_code }
end