Class: Zaala::API::PersonalData

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/zaala/api/types.rb

Overview

The class PersonalData represents the detail information about the customer.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_message(h) ⇒ Object



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/zaala/api/types.rb', line 102

def self.from_message(h)
  PersonalData.new({
    customer_type: h[:customerType],
    language: h[:language],
    gender: h[:gender],
    title: h[:title],
    customer_id: h[:customerID],
    first_name: h[:firstName],
    name: h[:name],
    date_of_birth: h[:dateOfBirth],
    fixnet_phone_number: h[:fixnetPhoneNumber],
    mobile_phone_number: h[:mobilePhoneNumber],
    email: h[:eMail],
    company_name: h[:companyName],
    company_number: h[:companyNumber],
    company_uid: h[:companyUid],
    company_legal_form: h[:companyLegalForm],
    company_legal_form_other: h[:companyLegalFormOther],
    company_foundation_date: h[:companyFoundationDate],
  })
end

Instance Method Details

#to_messageObject



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/zaala/api/types.rb', line 124

def to_message
  m = {
    customerType: customer_type,
    language: language
  }
  m[:gender] = gender unless gender.nil?
  m[:title] = title unless title.nil?
  m[:customerID] = customer_id unless customer_id.nil?
  m[:firstName] = first_name unless first_name.nil?
  m[:name] = name unless name.nil?
  m[:dateOfBirth] = date_of_birth unless date_of_birth.nil?
  m[:fixnetPhoneNumber] = fixnet_phone_number unless fixnet_phone_number.nil?
  m[:mobilePhoneNumber] = mobile_phone_number unless mobile_phone_number.nil?
  m[:eMail] = email unless email.nil?
  m[:companyName] = company_name unless company_name.nil?
  m[:companyNumber] = company_number unless company_number.nil?
  m[:companyUid] = company_uid unless company_uid.nil?
  m[:companyLegalForm] = company_legal_form unless company_legal_form.nil?
  m[:companyLegalFormOther] = company_legal_form_other unless company_legal_form_other.nil?
  m[:companyFoundationDate] = company_foundation_date unless company_foundation_date.nil?
  m
end