Class: Zaala::API::AdditionalData

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_message(h) ⇒ Object



409
410
411
412
413
414
415
416
417
418
419
420
# File 'lib/zaala/api/types.rb', line 409

def self.from_message(h)
  AdditionalData.new({
    requested_payment_method: h[:requestedPaymentMethod],
    sales_channel: h[:salesChannel],
    invoice_date: h[:invoiceDate],
    free_text1: h[:freeText1],
    free_text2: h[:freeText2],
    preferred_rate_model: h[:preferredRateModel],
    risk_taker_shift: h[:riskTakerShift],
    invoice_channel: h[:invoiceChannel],
  })
end

Instance Method Details

#to_messageObject



422
423
424
425
426
427
428
429
430
431
432
433
434
# File 'lib/zaala/api/types.rb', line 422

def to_message
  m = {
    requestedPaymentMethod: requested_payment_method,
  }
  m[:salesChannel] = sales_channel unless sales_channel.nil?
  m[:invoiceDate] = invoice_date  unless invoice_date.nil?
  m[:freeText1] = free_text1 unless free_text1.nil?
  m[:freeText2] = free_text2 unless free_text2.nil?
  m[:preferredRateModel] = preferred_rate_model unless preferred_rate_model.nil?
  m[:riskTakerShift] = risk_taker_shift unless risk_taker_shift.nil?
  m[:invoiceChannel] = invoice_channel unless invoice_channel.nil?
  m
end