Class: Zaala::API::DeliveryAddress

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

Overview

The class DeliveryAddress represents the delivery address of a purchase.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_message(h) ⇒ Object



218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/zaala/api/types.rb', line 218

def self.from_message(h)
  DeliveryAddress.new({
    country: h[:country],
    city: h[:city],
    zip_code: h[:zipCode],
    address_add_on: h[:addressAddOn],
    house_number: h[:houseNumber],
    street: h[:street],
    street_extension: h[:streetExtension],
    company_name: h[:companyName],
    title: h[:title],
    first_name: h[:firstName],
    name: h[:name],
  })
end

Instance Method Details

#to_messageObject



234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
# File 'lib/zaala/api/types.rb', line 234

def to_message
  m = {
    country: country,
    city: city,
    zipCode: zip_code
  }
  m[:addressAddOn] = address_add_on unless address_add_on.nil?
  m[:houseNumber] = house_number unless house_number.nil?
  m[:street] = street unless street.nil?
  m[:streetExtension] = street_extension unless street_extension.nil?
  m[:companyName] = company_name unless company_name.nil?
  m[:title] = title unless title.nil?
  m[:firstName] = first_name unless first_name.nil?
  m[:name] = name unless name.nil?
  m
end