Class: VisaAcceptanceMergedSpec::Leg

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

Overview

Leg 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(carrier_code: SKIP, flight_number: SKIP, originating_airport_code: SKIP, mclass: SKIP, stopover_indicator: SKIP, departure_date: SKIP, destination_airport_code: SKIP, fare_basis: SKIP, depart_tax_amount: SKIP, conjunction_ticket: SKIP, exchange_ticket_number: SKIP, coupon_number: SKIP, departure_time: SKIP, departure_time_meridian: SKIP, arrival_time: SKIP, arrival_time_meridian: SKIP, endorsements_restrictions: SKIP, total_fare_amount: SKIP, fee_amount: SKIP, tax_amount: SKIP, additional_properties: nil) ⇒ Leg

Returns a new instance of Leg.



238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
# File 'lib/visa_acceptance_merged_spec/models/leg.rb', line 238

def initialize(carrier_code: SKIP, flight_number: SKIP,
               originating_airport_code: SKIP, mclass: SKIP,
               stopover_indicator: SKIP, departure_date: SKIP,
               destination_airport_code: SKIP, fare_basis: SKIP,
               depart_tax_amount: SKIP, conjunction_ticket: SKIP,
               exchange_ticket_number: SKIP, coupon_number: SKIP,
               departure_time: SKIP, departure_time_meridian: SKIP,
               arrival_time: SKIP, arrival_time_meridian: SKIP,
               endorsements_restrictions: SKIP, total_fare_amount: SKIP,
               fee_amount: SKIP, tax_amount: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @carrier_code = carrier_code unless carrier_code == SKIP
  @flight_number = flight_number unless flight_number == SKIP
  @originating_airport_code = originating_airport_code unless originating_airport_code == SKIP
  @mclass = mclass unless mclass == SKIP
  @stopover_indicator = stopover_indicator unless stopover_indicator == SKIP
  @departure_date = departure_date unless departure_date == SKIP
  @destination_airport_code = destination_airport_code unless destination_airport_code == SKIP
  @fare_basis = fare_basis unless fare_basis == SKIP
  @depart_tax_amount = depart_tax_amount unless depart_tax_amount == SKIP
  @conjunction_ticket = conjunction_ticket unless conjunction_ticket == SKIP
  @exchange_ticket_number = exchange_ticket_number unless exchange_ticket_number == SKIP
  @coupon_number = coupon_number unless coupon_number == SKIP
  @departure_time = departure_time unless departure_time == SKIP
  @departure_time_meridian = departure_time_meridian unless departure_time_meridian == SKIP
  @arrival_time = arrival_time unless arrival_time == SKIP
  @arrival_time_meridian = arrival_time_meridian unless arrival_time_meridian == SKIP
  unless endorsements_restrictions == SKIP
    @endorsements_restrictions =
      endorsements_restrictions
  end
  @total_fare_amount = total_fare_amount unless total_fare_amount == SKIP
  @fee_amount = fee_amount unless fee_amount == SKIP
  @tax_amount = tax_amount unless tax_amount == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#arrival_timeInteger

Time of arrival for this leg of the trip. The format is military time and HHMM: If not all zeros, then the hours must be 00-23 and the minutes must be 00-59 Format: English characters only. Optional request field for travel legs.

Returns:

  • (Integer)


139
140
141
# File 'lib/visa_acceptance_merged_spec/models/leg.rb', line 139

def arrival_time
  @arrival_time
end

#arrival_time_meridianString

AM or PM for the arrival time for this leg of the trip. Possible values:

  • A: 12:00 midnight to 11:59 a.m.
  • P: 12:00 noon to 11:59 p.m. Format: English characters only. Restricted string data type that indicates a sequence of letters, numbers, and spaces; special characters are not included. Optional request field for travel legs.

Returns:

  • (String)


150
151
152
# File 'lib/visa_acceptance_merged_spec/models/leg.rb', line 150

def arrival_time_meridian
  @arrival_time_meridian
end

#carrier_codeString

IATA code for the carrier for this leg of the trip. Format: English characters only. Restricted string data type that indicates a sequence of letters, numbers, and spaces; special characters are not included. Optional request field for travel legs.

Returns:

  • (String)


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

def carrier_code
  @carrier_code
end

#conjunction_ticketString

Ticket that contains additional coupons for this leg of the trip on an itinerary that has more than four segments. Format: English characters only. Restricted string data type that indicates a sequence of letters, numbers, and spaces; special characters are not included. Optional request field for travel legs.

Returns:

  • (String)


92
93
94
# File 'lib/visa_acceptance_merged_spec/models/leg.rb', line 92

def conjunction_ticket
  @conjunction_ticket
end

#coupon_numberString

Coupon number. Each leg on the ticket requires a separate coupon, and each coupon is identified by the coupon number. Format: English characters only. Restricted string data type that indicates a sequence of letters, numbers, and spaces; special characters are not included. Optional request field for travel legs.

Returns:

  • (String)


110
111
112
# File 'lib/visa_acceptance_merged_spec/models/leg.rb', line 110

def coupon_number
  @coupon_number
end

#depart_tax_amountString

Amount of departure tax for this leg of the trip.

Returns:

  • (String)


83
84
85
# File 'lib/visa_acceptance_merged_spec/models/leg.rb', line 83

def depart_tax_amount
  @depart_tax_amount
end

#departure_dateInteger

Departure date for the first leg of the trip. Format: YYYYMMDD. Format: English characters only. Optional request field for travel legs.

Returns:

  • (Integer)


60
61
62
# File 'lib/visa_acceptance_merged_spec/models/leg.rb', line 60

def departure_date
  @departure_date
end

#departure_timeInteger

Time of departure for this leg of the trip. The format is military time and HHMM: If not all zeros, then the hours must be 00-23 and the minutes must be 00-59. Format: English characters only. Optional request field for travel legs.

Returns:

  • (Integer)


119
120
121
# File 'lib/visa_acceptance_merged_spec/models/leg.rb', line 119

def departure_time
  @departure_time
end

#departure_time_meridianString

AM or PM for the departure time. Possible values:

  • A: 12:00 midnight to 11:59 a.m.
  • P: 12:00 noon to 11:59 p.m Format: English characters only. Restricted string data type that indicates a sequence of letters, numbers, and spaces; special characters are not included. Optional request field for travel legs.

Returns:

  • (String)


130
131
132
# File 'lib/visa_acceptance_merged_spec/models/leg.rb', line 130

def departure_time_meridian
  @departure_time_meridian
end

#destination_airport_codeString

IATA code for the destination airport for this leg of the trip. Format: English characters only. Restricted string data type that indicates a sequence of letters, numbers, and spaces; special characters are not included. Optional request field for travel legs.

Returns:

  • (String)


68
69
70
# File 'lib/visa_acceptance_merged_spec/models/leg.rb', line 68

def destination_airport_code
  @destination_airport_code
end

#endorsements_restrictionsString

Notes or notations about endorsements and restrictions for this leg of the trip. Endorsements can be notations added by the travel agency, including mandatory government-required notations such as value added tax. Restrictions are limitations for the ticket based on the type of fare, such as a nonrefundable ticket or a 3-day minimum stay. Format: English characters only. Optional request field for travel legs.

Returns:

  • (String)


161
162
163
# File 'lib/visa_acceptance_merged_spec/models/leg.rb', line 161

def endorsements_restrictions
  @endorsements_restrictions
end

#exchange_ticket_numberString

New ticket number that is issued when the ticket is exchanged for this leg of the trip. Restrictions are limitations for the ticket based on the type of fare, such as a nonrefundable ticket or a 3-day minimum stay. Format: English characters only. Optional request field for travel legs.

Returns:

  • (String)


101
102
103
# File 'lib/visa_acceptance_merged_spec/models/leg.rb', line 101

def exchange_ticket_number
  @exchange_ticket_number
end

#fare_basisString

Code for the fare basis for this leg of the trip. The fare basis is assigned by the carriers and indicates a particular ticket type, such as business class or discounted/nonrefundable. Restricted string data type that indicates a sequence of letters, numbers, and spaces; special characters are not included. Format: English characters only. Optional request field for travel legs.auto_rental_regular_mileage_cost

Returns:

  • (String)


79
80
81
# File 'lib/visa_acceptance_merged_spec/models/leg.rb', line 79

def fare_basis
  @fare_basis
end

#fee_amountString

Fee for this leg of the trip, such as an airport fee or country fee. Format: English characters only. Optional request field for travel legs.

Returns:

  • (String)


173
174
175
# File 'lib/visa_acceptance_merged_spec/models/leg.rb', line 173

def fee_amount
  @fee_amount
end

#flight_numberString

Flight number for this leg of the trip. Restrictions are limitations for the ticket based on the type of fare, such as a nonrefundable ticket or a 3-day minimum stay. Format: English characters only. Optional request field for travel legs.

Returns:

  • (String)


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

def flight_number
  @flight_number
end

#mclassString

IATA code for the class of service for this leg of the trip. Format: English characters only. Restricted string data type that indicates a sequence of letters, numbers, and spaces; special characters are not included. Optional request field for travel legs.

Returns:

  • (String)


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

def mclass
  @mclass
end

#originating_airport_codeString

IATA code for the originating airport for this leg of the trip. Format: English characters only. Restricted string data type that indicates a sequence of letters, numbers, and spaces; special characters are not included. Optional request field for travel legs.

Returns:

  • (String)


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

def originating_airport_code
  @originating_airport_code
end

#stopover_indicatorInteger

Code that indicates whether a stopover is allowed on this leg of the trip. Possible values:

  • O (capital letter “O”) (default): Stopover allowed
  • X (capital letter “X”): Stopover not allowed Format: English characters only. Restricted string data type that indicates a sequence of letters, numbers, and spaces; special characters are not included. Optional request field for travel legs.

Returns:

  • (Integer)


53
54
55
# File 'lib/visa_acceptance_merged_spec/models/leg.rb', line 53

def stopover_indicator
  @stopover_indicator
end

#tax_amountString

Tax for this leg of the trip. Format: English characters only. Optional request field for travel legs.

Returns:

  • (String)


179
180
181
# File 'lib/visa_acceptance_merged_spec/models/leg.rb', line 179

def tax_amount
  @tax_amount
end

#total_fare_amountString

Total fare for this leg of the trip. Format: English characters only. Optional request field for travel legs.

Returns:

  • (String)


167
168
169
# File 'lib/visa_acceptance_merged_spec/models/leg.rb', line 167

def total_fare_amount
  @total_fare_amount
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/visa_acceptance_merged_spec/models/leg.rb', line 279

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  carrier_code = hash.key?('carrierCode') ? hash['carrierCode'] : SKIP
  flight_number = hash.key?('flightNumber') ? hash['flightNumber'] : SKIP
  originating_airport_code =
    hash.key?('originatingAirportCode') ? hash['originatingAirportCode'] : SKIP
  mclass = hash.key?('class') ? hash['class'] : SKIP
  stopover_indicator =
    hash.key?('stopoverIndicator') ? hash['stopoverIndicator'] : SKIP
  departure_date = hash.key?('departureDate') ? hash['departureDate'] : SKIP
  destination_airport_code =
    hash.key?('destinationAirportCode') ? hash['destinationAirportCode'] : SKIP
  fare_basis = hash.key?('fareBasis') ? hash['fareBasis'] : SKIP
  depart_tax_amount =
    hash.key?('departTaxAmount') ? hash['departTaxAmount'] : SKIP
  conjunction_ticket =
    hash.key?('conjunctionTicket') ? hash['conjunctionTicket'] : SKIP
  exchange_ticket_number =
    hash.key?('exchangeTicketNumber') ? hash['exchangeTicketNumber'] : SKIP
  coupon_number = hash.key?('couponNumber') ? hash['couponNumber'] : SKIP
  departure_time = hash.key?('departureTime') ? hash['departureTime'] : SKIP
  departure_time_meridian =
    hash.key?('departureTimeMeridian') ? hash['departureTimeMeridian'] : SKIP
  arrival_time = hash.key?('arrivalTime') ? hash['arrivalTime'] : SKIP
  arrival_time_meridian =
    hash.key?('arrivalTimeMeridian') ? hash['arrivalTimeMeridian'] : SKIP
  endorsements_restrictions =
    hash.key?('endorsementsRestrictions') ? hash['endorsementsRestrictions'] : SKIP
  total_fare_amount =
    hash.key?('totalFareAmount') ? hash['totalFareAmount'] : SKIP
  fee_amount = hash.key?('feeAmount') ? hash['feeAmount'] : SKIP
  tax_amount = hash.key?('taxAmount') ? hash['taxAmount'] : 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.
  Leg.new(carrier_code: carrier_code,
          flight_number: flight_number,
          originating_airport_code: originating_airport_code,
          mclass: mclass,
          stopover_indicator: stopover_indicator,
          departure_date: departure_date,
          destination_airport_code: destination_airport_code,
          fare_basis: fare_basis,
          depart_tax_amount: depart_tax_amount,
          conjunction_ticket: conjunction_ticket,
          exchange_ticket_number: exchange_ticket_number,
          coupon_number: coupon_number,
          departure_time: departure_time,
          departure_time_meridian: departure_time_meridian,
          arrival_time: arrival_time,
          arrival_time_meridian: arrival_time_meridian,
          endorsements_restrictions: endorsements_restrictions,
          total_fare_amount: total_fare_amount,
          fee_amount: fee_amount,
          tax_amount: tax_amount,
          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/visa_acceptance_merged_spec/models/leg.rb', line 182

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['carrier_code'] = 'carrierCode'
  @_hash['flight_number'] = 'flightNumber'
  @_hash['originating_airport_code'] = 'originatingAirportCode'
  @_hash['mclass'] = 'class'
  @_hash['stopover_indicator'] = 'stopoverIndicator'
  @_hash['departure_date'] = 'departureDate'
  @_hash['destination_airport_code'] = 'destinationAirportCode'
  @_hash['fare_basis'] = 'fareBasis'
  @_hash['depart_tax_amount'] = 'departTaxAmount'
  @_hash['conjunction_ticket'] = 'conjunctionTicket'
  @_hash['exchange_ticket_number'] = 'exchangeTicketNumber'
  @_hash['coupon_number'] = 'couponNumber'
  @_hash['departure_time'] = 'departureTime'
  @_hash['departure_time_meridian'] = 'departureTimeMeridian'
  @_hash['arrival_time'] = 'arrivalTime'
  @_hash['arrival_time_meridian'] = 'arrivalTimeMeridian'
  @_hash['endorsements_restrictions'] = 'endorsementsRestrictions'
  @_hash['total_fare_amount'] = 'totalFareAmount'
  @_hash['fee_amount'] = 'feeAmount'
  @_hash['tax_amount'] = 'taxAmount'
  @_hash
end

.nullablesObject

An array for nullable fields



234
235
236
# File 'lib/visa_acceptance_merged_spec/models/leg.rb', line 234

def self.nullables
  []
end

.optionalsObject

An array for optional fields



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/visa_acceptance_merged_spec/models/leg.rb', line 208

def self.optionals
  %w[
    carrier_code
    flight_number
    originating_airport_code
    mclass
    stopover_indicator
    departure_date
    destination_airport_code
    fare_basis
    depart_tax_amount
    conjunction_ticket
    exchange_ticket_number
    coupon_number
    departure_time
    departure_time_meridian
    arrival_time
    arrival_time_meridian
    endorsements_restrictions
    total_fare_amount
    fee_amount
    tax_amount
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
# File 'lib/visa_acceptance_merged_spec/models/leg.rb', line 362

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} carrier_code: #{@carrier_code.inspect}, flight_number:"\
  " #{@flight_number.inspect}, originating_airport_code: #{@originating_airport_code.inspect},"\
  " mclass: #{@mclass.inspect}, stopover_indicator: #{@stopover_indicator.inspect},"\
  " departure_date: #{@departure_date.inspect}, destination_airport_code:"\
  " #{@destination_airport_code.inspect}, fare_basis: #{@fare_basis.inspect},"\
  " depart_tax_amount: #{@depart_tax_amount.inspect}, conjunction_ticket:"\
  " #{@conjunction_ticket.inspect}, exchange_ticket_number:"\
  " #{@exchange_ticket_number.inspect}, coupon_number: #{@coupon_number.inspect},"\
  " departure_time: #{@departure_time.inspect}, departure_time_meridian:"\
  " #{@departure_time_meridian.inspect}, arrival_time: #{@arrival_time.inspect},"\
  " arrival_time_meridian: #{@arrival_time_meridian.inspect}, endorsements_restrictions:"\
  " #{@endorsements_restrictions.inspect}, total_fare_amount: #{@total_fare_amount.inspect},"\
  " fee_amount: #{@fee_amount.inspect}, tax_amount: #{@tax_amount.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



346
347
348
349
350
351
352
353
354
355
356
357
358
359
# File 'lib/visa_acceptance_merged_spec/models/leg.rb', line 346

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} carrier_code: #{@carrier_code}, flight_number: #{@flight_number},"\
  " originating_airport_code: #{@originating_airport_code}, mclass: #{@mclass},"\
  " stopover_indicator: #{@stopover_indicator}, departure_date: #{@departure_date},"\
  " destination_airport_code: #{@destination_airport_code}, fare_basis: #{@fare_basis},"\
  " depart_tax_amount: #{@depart_tax_amount}, conjunction_ticket: #{@conjunction_ticket},"\
  " exchange_ticket_number: #{@exchange_ticket_number}, coupon_number: #{@coupon_number},"\
  " departure_time: #{@departure_time}, departure_time_meridian: #{@departure_time_meridian},"\
  " arrival_time: #{@arrival_time}, arrival_time_meridian: #{@arrival_time_meridian},"\
  " endorsements_restrictions: #{@endorsements_restrictions}, total_fare_amount:"\
  " #{@total_fare_amount}, fee_amount: #{@fee_amount}, tax_amount: #{@tax_amount},"\
  " additional_properties: #{@additional_properties}>"
end