class STP::Structs::Account

Attributes

account[RW]
birthdate[RW]
company[RW]
country[RW]
economic_activity[RW]
email[RW]
exterior_number[RW]
identification_id[RW]
interior_number[RW]
maternal_surname[RW]
municipality[RW]
name[RW]
neighborhood[RW]
paternal_surname[RW]
phone[RW]
rfc[RW]
sex[RW]
signature[RW]
state[RW]
street[RW]
zip_code[RW]

Public Class Methods

new() click to toggle source
# File lib/stp/structs/account.rb, line 26
def initialize
  @company = STP.company
end

Public Instance Methods

as_json(_options = {}) click to toggle source
# File lib/stp/structs/account.rb, line 36
def as_json(_options = {})
  name = @name.present? ? I18n.transliterate(@name) : nil
  paternal_surname = @paternal_surname.present? ? I18n.transliterate(@paternal_surname) : nil
  maternal_surname = @maternal_surname.present? ? I18n.transliterate(@maternal_surname) : nil
  {
    cuenta: @account,
    empresa: @company,
    nombre: name,
    apellidoPaterno: paternal_surname,
    apellidoMaterno: maternal_surname,
    rfcCurp: @rfc,
    fechaNacimiento: @birthdate,
    genero: @sex,
    entidadFederativa: @state,
    actividadEconomica: @economic_activity,
    calle: @street,
    numExterior: @exterior_number,
    numInterior: @interior_number,
    colonia: @neighborhood,
    alcaldiaMunicipio: @municipality,
    codigoPostal: @zip_code,
    paisNacimiento: @country,
    email: @email,
    idIdentificacion: @identification_id,
    telefono: @phone,
    firma: @signature,
  }.compact
end
original_chain() click to toggle source
# File lib/stp/structs/account.rb, line 30
def original_chain
  "||#{@company}|"\
    "#{@account}|"\
    "#{@rfc}||"
end
to_json(*options) click to toggle source
# File lib/stp/structs/account.rb, line 65
def to_json(*options)
  as_json(*options).to_json(*options)
end