Class: CyberSourceMergedSpec::AncillaryInformation2

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

Overview

AncillaryInformation2 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, additional_properties: nil) ⇒ AncillaryInformation2

Returns a new instance of AncillaryInformation2.



107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/cyber_source_merged_spec/models/ancillary_information2.rb', line 107

def initialize(ticket_number: SKIP, passenger_name: SKIP,
               connected_ticket_number: SKIP, credit_reason_indicator: SKIP,
               service: 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
  @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_information2.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_information2.rb', line 65

def credit_reason_indicator
  @credit_reason_indicator
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_information2.rb', line 34

def passenger_name
  @passenger_name
end

#serviceArray[Service2]

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_information2.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_information2.rb', line 21

def ticket_number
  @ticket_number
end

Class Method Details

.from_element(root) ⇒ Object



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/cyber_source_merged_spec/models/ancillary_information2.rb', line 159

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, 'Service2', Service2)

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

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



122
123
124
125
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
# File 'lib/cyber_source_merged_spec/models/ancillary_information2.rb', line 122

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 << (Service2.from_hash(structure) if structure)
    end
  end

  service = SKIP unless hash.key?('service')

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

.namesObject

A mapping from model property names to API property names.



81
82
83
84
85
86
87
88
89
# File 'lib/cyber_source_merged_spec/models/ancillary_information2.rb', line 81

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
end

.nullablesObject

An array for nullable fields



103
104
105
# File 'lib/cyber_source_merged_spec/models/ancillary_information2.rb', line 103

def self.nullables
  []
end

.optionalsObject

An array for optional fields



92
93
94
95
96
97
98
99
100
# File 'lib/cyber_source_merged_spec/models/ancillary_information2.rb', line 92

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



204
205
206
207
208
209
210
# File 'lib/cyber_source_merged_spec/models/ancillary_information2.rb', line 204

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}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



195
196
197
198
199
200
201
# File 'lib/cyber_source_merged_spec/models/ancillary_information2.rb', line 195

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}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/cyber_source_merged_spec/models/ancillary_information2.rb', line 178

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, 'Service2', service)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end