Class: STP::Structs::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/stp/structs/account.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAccount

Returns a new instance of Account.



26
27
28
# File 'lib/stp/structs/account.rb', line 26

def initialize
  @company = STP.company
end

Instance Attribute Details

#accountObject

cuenta



4
5
6
# File 'lib/stp/structs/account.rb', line 4

def 
  @account
end

#birthdateObject

cuenta



4
5
6
# File 'lib/stp/structs/account.rb', line 4

def birthdate
  @birthdate
end

#companyObject

cuenta



4
5
6
# File 'lib/stp/structs/account.rb', line 4

def company
  @company
end

#countryObject

cuenta



4
5
6
# File 'lib/stp/structs/account.rb', line 4

def country
  @country
end

#economic_activityObject

cuenta



4
5
6
# File 'lib/stp/structs/account.rb', line 4

def economic_activity
  @economic_activity
end

#emailObject

cuenta



4
5
6
# File 'lib/stp/structs/account.rb', line 4

def email
  @email
end

#exterior_numberObject

cuenta



4
5
6
# File 'lib/stp/structs/account.rb', line 4

def exterior_number
  @exterior_number
end

#identification_idObject

cuenta



4
5
6
# File 'lib/stp/structs/account.rb', line 4

def identification_id
  @identification_id
end

#interior_numberObject

cuenta



4
5
6
# File 'lib/stp/structs/account.rb', line 4

def interior_number
  @interior_number
end

#maternal_surnameObject

cuenta



4
5
6
# File 'lib/stp/structs/account.rb', line 4

def maternal_surname
  @maternal_surname
end

#municipalityObject

cuenta



4
5
6
# File 'lib/stp/structs/account.rb', line 4

def municipality
  @municipality
end

#nameObject

cuenta



4
5
6
# File 'lib/stp/structs/account.rb', line 4

def name
  @name
end

#neighborhoodObject

cuenta



4
5
6
# File 'lib/stp/structs/account.rb', line 4

def neighborhood
  @neighborhood
end

#paternal_surnameObject

cuenta



4
5
6
# File 'lib/stp/structs/account.rb', line 4

def paternal_surname
  @paternal_surname
end

#phoneObject

cuenta



4
5
6
# File 'lib/stp/structs/account.rb', line 4

def phone
  @phone
end

#rfcObject

cuenta



4
5
6
# File 'lib/stp/structs/account.rb', line 4

def rfc
  @rfc
end

#sexObject

cuenta



4
5
6
# File 'lib/stp/structs/account.rb', line 4

def sex
  @sex
end

#signatureObject

cuenta



4
5
6
# File 'lib/stp/structs/account.rb', line 4

def signature
  @signature
end

#stateObject

cuenta



4
5
6
# File 'lib/stp/structs/account.rb', line 4

def state
  @state
end

#streetObject

cuenta



4
5
6
# File 'lib/stp/structs/account.rb', line 4

def street
  @street
end

#zip_codeObject

cuenta



4
5
6
# File 'lib/stp/structs/account.rb', line 4

def zip_code
  @zip_code
end

Instance Method Details

#as_json(_options = {}) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# 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_chainObject



30
31
32
33
34
# File 'lib/stp/structs/account.rb', line 30

def original_chain
  "||#{@company}|"\
    "#{@account}|"\
    "#{@rfc}||"
end

#to_json(*options) ⇒ Object



65
66
67
# File 'lib/stp/structs/account.rb', line 65

def to_json(*options)
  as_json(*options).to_json(*options)
end