Method: ShellCardManagementApIs::PINDeliverTo.from_hash

Defined in:
lib/shell_card_management_ap_is/models/pin_deliver_to.rb

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/shell_card_management_ap_is/models/pin_deliver_to.rb', line 130

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  company_name = hash.key?('CompanyName') ? hash['CompanyName'] : nil
  address_line = hash.key?('AddressLine') ? hash['AddressLine'] : nil
  zip_code = hash.key?('ZipCode') ? hash['ZipCode'] : nil
  city = hash.key?('City') ? hash['City'] : nil
  contact_name = hash.key?('ContactName') ? hash['ContactName'] : SKIP
  contact_title = hash.key?('ContactTitle') ? hash['ContactTitle'] : SKIP
  region_id = hash.key?('RegionID') ? hash['RegionID'] : SKIP
  country_id = hash.key?('CountryID') ? hash['CountryID'] : SKIP
  phone_number = hash.key?('PhoneNumber') ? hash['PhoneNumber'] : SKIP
  email_address = hash.key?('EmailAddress') ? hash['EmailAddress'] : SKIP
  save_pin_reminder =
    hash.key?('SavePINReminder') ? hash['SavePINReminder'] : SKIP

  # Create object from extracted values.

  PINDeliverTo.new(company_name,
                   address_line,
                   zip_code,
                   city,
                   contact_name,
                   contact_title,
                   region_id,
                   country_id,
                   phone_number,
                   email_address,
                   save_pin_reminder)
end