Class: CyberSourceMergedSpec::AncillaryInformation

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/models/ancillary_information.rb

Overview

AncillaryInformation 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(ticket_number: SKIP, passenger_name: SKIP, connected_ticket_number: SKIP, credit_reason_indicator: SKIP, service: SKIP, fee_description: SKIP, additional_properties: nil) ⇒ AncillaryInformation

Returns a new instance of AncillaryInformation.



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/cyber_source_merged_spec/models/ancillary_information.rb', line 116

def initialize(ticket_number: SKIP, passenger_name: SKIP,
               connected_ticket_number: SKIP, credit_reason_indicator: SKIP,
               service: SKIP, fee_description: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @ticket_number = ticket_number unless ticket_number == SKIP
  @passenger_name = passenger_name unless passenger_name == SKIP
  @connected_ticket_number = connected_ticket_number unless connected_ticket_number == SKIP
  @credit_reason_indicator = credit_reason_indicator unless credit_reason_indicator == SKIP
  @service = service unless service == SKIP
  @fee_description = fee_description unless fee_description == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#connected_ticket_numberString

Number for the airline ticket to which the ancillary purchase is connected. If this purchase has a connection or relationship to another purchase such as a baggage fee for a passenger transport ticket, this field must contain the ticket number for the other purchase. For a stand-alone purchase, the value for this field must be the same as the value for the travelInformation.transit.airline.ancillaryInformation.ticketNumber field. Important This field is required in the U.S. in order for you to qualify for either the custom payment service (CPS) or the electronic interchange reimbursement fee (EIRF) program. Format: English characters only. Optional request field for ancillary services.

Returns:

  • (String)


52
53
54
# File 'lib/cyber_source_merged_spec/models/ancillary_information.rb', line 52

def connected_ticket_number
  @connected_ticket_number
end

#credit_reason_indicatorString

Reason for the credit. Possible values:

  • A: Cancellation of the ancillary passenger transport purchase.
  • B: Cancellation of the airline ticket and the passenger transport ancillary purchase.
  • C: Cancellation of the airline ticket.
  • O: Other.
  • P: Partial refund of the airline ticket. Format: English characters only. Optional field for ancillary services.

Returns:

  • (String)


65
66
67
# File 'lib/cyber_source_merged_spec/models/ancillary_information.rb', line 65

def credit_reason_indicator
  @credit_reason_indicator
end

#fee_descriptionString

This field contains the fee description for the airline ancillary service provided. Format: Alphanumeric, 100 characters maximum. Optional field for ancillary services.

Returns:

  • (String)


85
86
87
# File 'lib/cyber_source_merged_spec/models/ancillary_information.rb', line 85

def fee_description
  @fee_description
end

#passenger_nameString

Name of the passenger. If the passenger’s name is not available, this value is the cardholder’s name. If neither the passenger’s name nor the cardholder’s name is available, this value is a description of the ancillary purchase. Important This field is required in the U.S. in order for you to qualify for either the custom payment service (CPS) or the electronic interchange reimbursement fee (EIRF) program. Format: English characters only. Optional field for ancillary service.

Returns:

  • (String)


34
35
36
# File 'lib/cyber_source_merged_spec/models/ancillary_information.rb', line 34

def passenger_name
  @passenger_name
end

#serviceArray[Service]

Reason for the credit. Possible values:

  • A: Cancellation of the ancillary passenger transport purchase.
  • B: Cancellation of the airline ticket and the passenger transport ancillary purchase.
  • C: Cancellation of the airline ticket.
  • O: Other.
  • P: Partial refund of the airline ticket. Format: English characters only. Optional field for ancillary services.

Returns:



78
79
80
# File 'lib/cyber_source_merged_spec/models/ancillary_information.rb', line 78

def service
  @service
end

#ticket_numberString

Ticket number, which consists of the carrier code, form, and serial number, without the check digit. Important This field is required in the U.S. in order for you to qualify for either the custom payment service (CPS) or the electronic interchange reimbursement fee (EIRF) program. Format: English characters only. Optional field for ancillary services.

Returns:

  • (String)


21
22
23
# File 'lib/cyber_source_merged_spec/models/ancillary_information.rb', line 21

def ticket_number
  @ticket_number
end

Class Method Details

.from_element(root) ⇒ Object



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/cyber_source_merged_spec/models/ancillary_information.rb', line 173

def self.from_element(root)
  ticket_number = XmlUtilities.from_element(root, 'ticketNumber', String)
  passenger_name = XmlUtilities.from_element(root, 'passengerName', String)
  connected_ticket_number = XmlUtilities.from_element(
    root, 'connectedTicketNumber', String
  )
  credit_reason_indicator = XmlUtilities.from_element(
    root, 'creditReasonIndicator', String
  )
  service = XmlUtilities.from_element_to_array(root, 'Service', Service)
  fee_description = XmlUtilities.from_element(root, 'feeDescription',
                                              String)

  new(ticket_number: ticket_number,
      passenger_name: passenger_name,
      connected_ticket_number: connected_ticket_number,
      credit_reason_indicator: credit_reason_indicator,
      service: service,
      fee_description: fee_description,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/cyber_source_merged_spec/models/ancillary_information.rb', line 133

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  ticket_number = hash.key?('ticketNumber') ? hash['ticketNumber'] : SKIP
  passenger_name = hash.key?('passengerName') ? hash['passengerName'] : SKIP
  connected_ticket_number =
    hash.key?('connectedTicketNumber') ? hash['connectedTicketNumber'] : SKIP
  credit_reason_indicator =
    hash.key?('creditReasonIndicator') ? hash['creditReasonIndicator'] : SKIP
  # Parameter is an array, so we need to iterate through it
  service = nil
  unless hash['service'].nil?
    service = []
    hash['service'].each do |structure|
      service << (Service.from_hash(structure) if structure)
    end
  end

  service = SKIP unless hash.key?('service')
  fee_description =
    hash.key?('feeDescription') ? hash['feeDescription'] : SKIP

  # 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.
  AncillaryInformation.new(ticket_number: ticket_number,
                           passenger_name: passenger_name,
                           connected_ticket_number: connected_ticket_number,
                           credit_reason_indicator: credit_reason_indicator,
                           service: service,
                           fee_description: fee_description,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



88
89
90
91
92
93
94
95
96
97
# File 'lib/cyber_source_merged_spec/models/ancillary_information.rb', line 88

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['ticket_number'] = 'ticketNumber'
  @_hash['passenger_name'] = 'passengerName'
  @_hash['connected_ticket_number'] = 'connectedTicketNumber'
  @_hash['credit_reason_indicator'] = 'creditReasonIndicator'
  @_hash['service'] = 'service'
  @_hash['fee_description'] = 'feeDescription'
  @_hash
end

.nullablesObject

An array for nullable fields



112
113
114
# File 'lib/cyber_source_merged_spec/models/ancillary_information.rb', line 112

def self.nullables
  []
end

.optionalsObject

An array for optional fields



100
101
102
103
104
105
106
107
108
109
# File 'lib/cyber_source_merged_spec/models/ancillary_information.rb', line 100

def self.optionals
  %w[
    ticket_number
    passenger_name
    connected_ticket_number
    credit_reason_indicator
    service
    fee_description
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



223
224
225
226
227
228
229
230
# File 'lib/cyber_source_merged_spec/models/ancillary_information.rb', line 223

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} ticket_number: #{@ticket_number.inspect}, passenger_name:"\
  " #{@passenger_name.inspect}, connected_ticket_number: #{@connected_ticket_number.inspect},"\
  " credit_reason_indicator: #{@credit_reason_indicator.inspect}, service:"\
  " #{@service.inspect}, fee_description: #{@fee_description.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



214
215
216
217
218
219
220
# File 'lib/cyber_source_merged_spec/models/ancillary_information.rb', line 214

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} ticket_number: #{@ticket_number}, passenger_name: #{@passenger_name},"\
  " connected_ticket_number: #{@connected_ticket_number}, credit_reason_indicator:"\
  " #{@credit_reason_indicator}, service: #{@service}, fee_description: #{@fee_description},"\
  " additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/cyber_source_merged_spec/models/ancillary_information.rb', line 195

def to_xml_element(doc, root_name)
  root = doc.create_element(root_name)

  XmlUtilities.add_as_subelement(doc, root, 'ticketNumber', ticket_number)
  XmlUtilities.add_as_subelement(doc, root, 'passengerName', passenger_name)
  XmlUtilities.add_as_subelement(doc, root, 'connectedTicketNumber',
                                 connected_ticket_number)
  XmlUtilities.add_as_subelement(doc, root, 'creditReasonIndicator',
                                 credit_reason_indicator)
  XmlUtilities.add_array_as_subelement(doc, root, 'Service', service)
  XmlUtilities.add_as_subelement(doc, root, 'feeDescription',
                                 fee_description)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end