Class: Asdawqw::ValidationAsynchronousPushMessageRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/asdawqw/models/validation_asynchronous_push_message_request.rb

Overview

Request for validation messages which BookingPal push asynchronous (webhooks request)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(supplier_id = nil, type = nil, validation = nil) ⇒ ValidationAsynchronousPushMessageRequest

Returns a new instance of ValidationAsynchronousPushMessageRequest.



31
32
33
34
35
36
37
# File 'lib/asdawqw/models/validation_asynchronous_push_message_request.rb', line 31

def initialize(supplier_id = nil,
               type = nil,
               validation = nil)
  @supplier_id = supplier_id
  @type = type
  @validation = validation
end

Instance Attribute Details

#supplier_idInteger

Id of supplier in BookingPal

Returns:

  • (Integer)


12
13
14
# File 'lib/asdawqw/models/validation_asynchronous_push_message_request.rb', line 12

def supplier_id
  @supplier_id
end

#typeAsynchronousPushMessageTypeEnum

push message type. BP_VALIDATION



16
17
18
# File 'lib/asdawqw/models/validation_asynchronous_push_message_request.rb', line 16

def type
  @type
end

#validationList of AsynchronousValidationModel

Validation Model

Returns:



20
21
22
# File 'lib/asdawqw/models/validation_asynchronous_push_message_request.rb', line 20

def validation
  @validation
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/asdawqw/models/validation_asynchronous_push_message_request.rb', line 40

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  supplier_id = hash['supplierId']
  type = hash['type']
  # Parameter is an array, so we need to iterate through it
  validation = nil
  unless hash['validation'].nil?
    validation = []
    hash['validation'].each do |structure|
      validation << (AsynchronousValidationModel.from_hash(structure) if structure)
    end
  end

  # Create object from extracted values.
  ValidationAsynchronousPushMessageRequest.new(supplier_id,
                                               type,
                                               validation)
end

.namesObject

A mapping from model property names to API property names.



23
24
25
26
27
28
29
# File 'lib/asdawqw/models/validation_asynchronous_push_message_request.rb', line 23

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['supplier_id'] = 'supplierId'
  @_hash['type'] = 'type'
  @_hash['validation'] = 'validation'
  @_hash
end