Class: Zaala::API::InvoiceAddress

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

Overview

The class InvoiceAddress represents the invoice address of a purchase.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_message(h) ⇒ Object



166
167
168
169
170
171
172
173
174
175
176
# File 'lib/zaala/api/types.rb', line 166

def self.from_message(h)
  InvoiceAddress.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],
  })
end

Instance Method Details

#to_messageObject



178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/zaala/api/types.rb', line 178

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
end