Class: VisaAcceptanceMergedSpec::CreateSessionRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/visa_acceptance_merged_spec/models/create_session_request.rb

Overview

CreateSessionRequest Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(client_reference_information: SKIP, processing_information: SKIP, payment_information: SKIP, order_information: SKIP, buyer_information: SKIP, device_information: SKIP, merchant_information: SKIP, user_interface: SKIP, merchant_defined_information: SKIP, agreement_information: SKIP, travel_information: SKIP, additional_properties: nil) ⇒ CreateSessionRequest

Returns a new instance of CreateSessionRequest.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/visa_acceptance_merged_spec/models/create_session_request.rb', line 95

def initialize(client_reference_information: SKIP,
               processing_information: SKIP, payment_information: SKIP,
               order_information: SKIP, buyer_information: SKIP,
               device_information: SKIP, merchant_information: SKIP,
               user_interface: SKIP, merchant_defined_information: SKIP,
               agreement_information: SKIP, travel_information: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  unless client_reference_information == SKIP
    @client_reference_information =
      client_reference_information
  end
  @processing_information = processing_information unless processing_information == SKIP
  @payment_information = payment_information unless payment_information == SKIP
  @order_information = order_information unless order_information == SKIP
  @buyer_information = buyer_information unless buyer_information == SKIP
  @device_information = device_information unless device_information == SKIP
  @merchant_information = merchant_information unless merchant_information == SKIP
  @user_interface = user_interface unless user_interface == SKIP
  unless merchant_defined_information == SKIP
    @merchant_defined_information =
      merchant_defined_information
  end
  @agreement_information = agreement_information unless agreement_information == SKIP
  @travel_information = travel_information unless travel_information == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#agreement_informationAgreementInformation10

The object containing the custom data that the merchant defines.



50
51
52
# File 'lib/visa_acceptance_merged_spec/models/create_session_request.rb', line 50

def agreement_information
  @agreement_information
end

#buyer_informationBuyerInformation9

TODO: Write general description for this method

Returns:



30
31
32
# File 'lib/visa_acceptance_merged_spec/models/create_session_request.rb', line 30

def buyer_information
  @buyer_information
end

#client_reference_informationClientReferenceInformation26

TODO: Write general description for this method



14
15
16
# File 'lib/visa_acceptance_merged_spec/models/create_session_request.rb', line 14

def client_reference_information
  @client_reference_information
end

#device_informationDeviceInformation7

TODO: Write general description for this method

Returns:



34
35
36
# File 'lib/visa_acceptance_merged_spec/models/create_session_request.rb', line 34

def device_information
  @device_information
end

#merchant_defined_informationArray[MerchantDefinedInformation]

The object containing the custom data that the merchant defines.

Returns:



46
47
48
# File 'lib/visa_acceptance_merged_spec/models/create_session_request.rb', line 46

def merchant_defined_information
  @merchant_defined_information
end

#merchant_informationMerchantInformation14

TODO: Write general description for this method



38
39
40
# File 'lib/visa_acceptance_merged_spec/models/create_session_request.rb', line 38

def merchant_information
  @merchant_information
end

#order_informationOrderInformation26

TODO: Write general description for this method

Returns:



26
27
28
# File 'lib/visa_acceptance_merged_spec/models/create_session_request.rb', line 26

def order_information
  @order_information
end

#payment_informationPaymentInformation22

TODO: Write general description for this method



22
23
24
# File 'lib/visa_acceptance_merged_spec/models/create_session_request.rb', line 22

def payment_information
  @payment_information
end

#processing_informationProcessingInformation23

TODO: Write general description for this method



18
19
20
# File 'lib/visa_acceptance_merged_spec/models/create_session_request.rb', line 18

def processing_information
  @processing_information
end

#travel_informationTravelInformation6

The object containing the custom data that the merchant defines.

Returns:



54
55
56
# File 'lib/visa_acceptance_merged_spec/models/create_session_request.rb', line 54

def travel_information
  @travel_information
end

#user_interfaceUserInterface

TODO: Write general description for this method

Returns:



42
43
44
# File 'lib/visa_acceptance_merged_spec/models/create_session_request.rb', line 42

def user_interface
  @user_interface
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



126
127
128
129
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/visa_acceptance_merged_spec/models/create_session_request.rb', line 126

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  if hash['clientReferenceInformation']
    client_reference_information = ClientReferenceInformation26.from_hash(hash['clientReferenceInformation'])
  end
  processing_information = ProcessingInformation23.from_hash(hash['processingInformation']) if
    hash['processingInformation']
  payment_information = PaymentInformation22.from_hash(hash['paymentInformation']) if
    hash['paymentInformation']
  order_information = OrderInformation26.from_hash(hash['orderInformation']) if
    hash['orderInformation']
  buyer_information = BuyerInformation9.from_hash(hash['buyerInformation']) if
    hash['buyerInformation']
  device_information = DeviceInformation7.from_hash(hash['deviceInformation']) if
    hash['deviceInformation']
  merchant_information = MerchantInformation14.from_hash(hash['merchantInformation']) if
    hash['merchantInformation']
  user_interface = UserInterface.from_hash(hash['userInterface']) if hash['userInterface']
  # Parameter is an array, so we need to iterate through it
  merchant_defined_information = nil
  unless hash['merchantDefinedInformation'].nil?
    merchant_defined_information = []
    hash['merchantDefinedInformation'].each do |structure|
      merchant_defined_information << (MerchantDefinedInformation.from_hash(structure) if structure)
    end
  end

  merchant_defined_information = SKIP unless hash.key?('merchantDefinedInformation')
  agreement_information = AgreementInformation10.from_hash(hash['agreementInformation']) if
    hash['agreementInformation']
  travel_information = TravelInformation6.from_hash(hash['travelInformation']) if
    hash['travelInformation']

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  CreateSessionRequest.new(client_reference_information: client_reference_information,
                           processing_information: processing_information,
                           payment_information: payment_information,
                           order_information: order_information,
                           buyer_information: buyer_information,
                           device_information: device_information,
                           merchant_information: merchant_information,
                           user_interface: user_interface,
                           merchant_defined_information: merchant_defined_information,
                           agreement_information: agreement_information,
                           travel_information: travel_information,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/visa_acceptance_merged_spec/models/create_session_request.rb', line 57

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['client_reference_information'] = 'clientReferenceInformation'
  @_hash['processing_information'] = 'processingInformation'
  @_hash['payment_information'] = 'paymentInformation'
  @_hash['order_information'] = 'orderInformation'
  @_hash['buyer_information'] = 'buyerInformation'
  @_hash['device_information'] = 'deviceInformation'
  @_hash['merchant_information'] = 'merchantInformation'
  @_hash['user_interface'] = 'userInterface'
  @_hash['merchant_defined_information'] = 'merchantDefinedInformation'
  @_hash['agreement_information'] = 'agreementInformation'
  @_hash['travel_information'] = 'travelInformation'
  @_hash
end

.nullablesObject

An array for nullable fields



91
92
93
# File 'lib/visa_acceptance_merged_spec/models/create_session_request.rb', line 91

def self.nullables
  []
end

.optionalsObject

An array for optional fields



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/visa_acceptance_merged_spec/models/create_session_request.rb', line 74

def self.optionals
  %w[
    client_reference_information
    processing_information
    payment_information
    order_information
    buyer_information
    device_information
    merchant_information
    user_interface
    merchant_defined_information
    agreement_information
    travel_information
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/visa_acceptance_merged_spec/models/create_session_request.rb', line 197

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} client_reference_information: #{@client_reference_information.inspect},"\
  " processing_information: #{@processing_information.inspect}, payment_information:"\
  " #{@payment_information.inspect}, order_information: #{@order_information.inspect},"\
  " buyer_information: #{@buyer_information.inspect}, device_information:"\
  " #{@device_information.inspect}, merchant_information: #{@merchant_information.inspect},"\
  " user_interface: #{@user_interface.inspect}, merchant_defined_information:"\
  " #{@merchant_defined_information.inspect}, agreement_information:"\
  " #{@agreement_information.inspect}, travel_information: #{@travel_information.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



184
185
186
187
188
189
190
191
192
193
194
# File 'lib/visa_acceptance_merged_spec/models/create_session_request.rb', line 184

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} client_reference_information: #{@client_reference_information},"\
  " processing_information: #{@processing_information}, payment_information:"\
  " #{@payment_information}, order_information: #{@order_information}, buyer_information:"\
  " #{@buyer_information}, device_information: #{@device_information}, merchant_information:"\
  " #{@merchant_information}, user_interface: #{@user_interface},"\
  " merchant_defined_information: #{@merchant_defined_information}, agreement_information:"\
  " #{@agreement_information}, travel_information: #{@travel_information},"\
  " additional_properties: #{@additional_properties}>"
end