Class: SwaggerClient::Airline

Inherits:
Object
  • Object
show all
Defined in:
lib/swagger_client/models/airline.rb

Overview

Additional data specific to the airline industry

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Airline

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



111
112
113
114
115
116
117
118
119
120
121
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/swagger_client/models/airline.rb', line 111

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}

  if attributes.has_key?(:'passengerName')
    self.passenger_name = attributes[:'passengerName']
  end

  if attributes.has_key?(:'ticketNumber')
    self.ticket_number = attributes[:'ticketNumber']
  end

  if attributes.has_key?(:'issuingCarrier')
    self.issuing_carrier = attributes[:'issuingCarrier']
  end

  if attributes.has_key?(:'carrierName')
    self.carrier_name = attributes[:'carrierName']
  end

  if attributes.has_key?(:'travelAgencyIataCode')
    self.travel_agency_iata_code = attributes[:'travelAgencyIataCode']
  end

  if attributes.has_key?(:'travelAgencyName')
    self.travel_agency_name = attributes[:'travelAgencyName']
  end

  if attributes.has_key?(:'airlinePlanNumber')
    self.airline_plan_number = attributes[:'airlinePlanNumber']
  end

  if attributes.has_key?(:'airlineInvoiceNumber')
    self.airline_invoice_number = attributes[:'airlineInvoiceNumber']
  end

  if attributes.has_key?(:'reservationSystem')
    self.reservation_system = attributes[:'reservationSystem']
  end

  if attributes.has_key?(:'restricted')
    self.restricted = attributes[:'restricted']
  end

  if attributes.has_key?(:'travelRoute')
    if (value = attributes[:'travelRoute']).is_a?(Array)
      self.travel_route = value
    end
  end

  if attributes.has_key?(:'relatedTicketNumber')
    self.related_ticket_number = attributes[:'relatedTicketNumber']
  end

  if attributes.has_key?(:'ancillaryServiceCategory')
    if (value = attributes[:'ancillaryServiceCategory']).is_a?(Array)
      self.ancillary_service_category = value
    end
  end

  if attributes.has_key?(:'ticketPurchase')
    self.ticket_purchase = attributes[:'ticketPurchase']
  end

end

Instance Attribute Details

#airline_invoice_numberObject

Returns the value of attribute airline_invoice_number.



32
33
34
# File 'lib/swagger_client/models/airline.rb', line 32

def airline_invoice_number
  @airline_invoice_number
end

#airline_plan_numberObject

Returns the value of attribute airline_plan_number.



30
31
32
# File 'lib/swagger_client/models/airline.rb', line 30

def airline_plan_number
  @airline_plan_number
end

#ancillary_service_categoryObject

Identify the purchase of ancillary goods or services with a false value. If this element is not provided, the transaction is assumed to be a purchase of an airline ticket.



43
44
45
# File 'lib/swagger_client/models/airline.rb', line 43

def ancillary_service_category
  @ancillary_service_category
end

#carrier_nameObject

Returns the value of attribute carrier_name.



24
25
26
# File 'lib/swagger_client/models/airline.rb', line 24

def carrier_name
  @carrier_name
end

#issuing_carrierObject

Returns the value of attribute issuing_carrier.



22
23
24
# File 'lib/swagger_client/models/airline.rb', line 22

def issuing_carrier
  @issuing_carrier
end

#passenger_nameObject

Returns the value of attribute passenger_name.



18
19
20
# File 'lib/swagger_client/models/airline.rb', line 18

def passenger_name
  @passenger_name
end

Returns the value of attribute related_ticket_number.



40
41
42
# File 'lib/swagger_client/models/airline.rb', line 40

def related_ticket_number
  @related_ticket_number
end

#reservation_systemObject

Returns the value of attribute reservation_system.



34
35
36
# File 'lib/swagger_client/models/airline.rb', line 34

def reservation_system
  @reservation_system
end

#restrictedObject

Returns the value of attribute restricted.



36
37
38
# File 'lib/swagger_client/models/airline.rb', line 36

def restricted
  @restricted
end

#ticket_numberObject

Returns the value of attribute ticket_number.



20
21
22
# File 'lib/swagger_client/models/airline.rb', line 20

def ticket_number
  @ticket_number
end

#ticket_purchaseObject

Returns the value of attribute ticket_purchase.



45
46
47
# File 'lib/swagger_client/models/airline.rb', line 45

def ticket_purchase
  @ticket_purchase
end

#travel_agency_iata_codeObject

Returns the value of attribute travel_agency_iata_code.



26
27
28
# File 'lib/swagger_client/models/airline.rb', line 26

def travel_agency_iata_code
  @travel_agency_iata_code
end

#travel_agency_nameObject

Returns the value of attribute travel_agency_name.



28
29
30
# File 'lib/swagger_client/models/airline.rb', line 28

def travel_agency_name
  @travel_agency_name
end

#travel_routeObject

Returns the value of attribute travel_route.



38
39
40
# File 'lib/swagger_client/models/airline.rb', line 38

def travel_route
  @travel_route
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/swagger_client/models/airline.rb', line 70

def self.attribute_map
  {
    :'passenger_name' => :'passengerName',
    :'ticket_number' => :'ticketNumber',
    :'issuing_carrier' => :'issuingCarrier',
    :'carrier_name' => :'carrierName',
    :'travel_agency_iata_code' => :'travelAgencyIataCode',
    :'travel_agency_name' => :'travelAgencyName',
    :'airline_plan_number' => :'airlinePlanNumber',
    :'airline_invoice_number' => :'airlineInvoiceNumber',
    :'reservation_system' => :'reservationSystem',
    :'restricted' => :'restricted',
    :'travel_route' => :'travelRoute',
    :'related_ticket_number' => :'relatedTicketNumber',
    :'ancillary_service_category' => :'ancillaryServiceCategory',
    :'ticket_purchase' => :'ticketPurchase'
  }
end

.swagger_typesObject

Attribute type mapping.



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/swagger_client/models/airline.rb', line 90

def self.swagger_types
  {
    :'passenger_name' => :'String',
    :'ticket_number' => :'String',
    :'issuing_carrier' => :'String',
    :'carrier_name' => :'String',
    :'travel_agency_iata_code' => :'String',
    :'travel_agency_name' => :'String',
    :'airline_plan_number' => :'String',
    :'airline_invoice_number' => :'String',
    :'reservation_system' => :'String',
    :'restricted' => :'BOOLEAN',
    :'travel_route' => :'Array<AirlineTravelRoute>',
    :'related_ticket_number' => :'String',
    :'ancillary_service_category' => :'Array<AirlineAncillaryServiceCategory>',
    :'ticket_purchase' => :'BOOLEAN'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
# File 'lib/swagger_client/models/airline.rb', line 350

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      passenger_name == o.passenger_name &&
      ticket_number == o.ticket_number &&
      issuing_carrier == o.issuing_carrier &&
      carrier_name == o.carrier_name &&
      travel_agency_iata_code == o.travel_agency_iata_code &&
      travel_agency_name == o.travel_agency_name &&
      airline_plan_number == o.airline_plan_number &&
      airline_invoice_number == o.airline_invoice_number &&
      reservation_system == o.reservation_system &&
      restricted == o.restricted &&
      travel_route == o.travel_route &&
      related_ticket_number == o.related_ticket_number &&
      ancillary_service_category == o.ancillary_service_category &&
      ticket_purchase == o.ticket_purchase
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
# File 'lib/swagger_client/models/airline.rb', line 405

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = SwaggerClient.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



471
472
473
474
475
476
477
478
479
480
481
482
483
# File 'lib/swagger_client/models/airline.rb', line 471

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map{ |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
# File 'lib/swagger_client/models/airline.rb', line 384

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


371
372
373
# File 'lib/swagger_client/models/airline.rb', line 371

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



377
378
379
# File 'lib/swagger_client/models/airline.rb', line 377

def hash
  [passenger_name, ticket_number, issuing_carrier, carrier_name, travel_agency_iata_code, travel_agency_name, airline_plan_number, airline_invoice_number, reservation_system, restricted, travel_route, related_ticket_number, ancillary_service_category, ticket_purchase].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/swagger_client/models/airline.rb', line 181

def list_invalid_properties
  invalid_properties = Array.new
  if !@passenger_name.nil? && @passenger_name.to_s.length > 30
    invalid_properties.push("invalid value for 'passenger_name', the character length must be smaller than or equal to 30.")
  end

  if !@ticket_number.nil? && @ticket_number.to_s.length > 20
    invalid_properties.push("invalid value for 'ticket_number', the character length must be smaller than or equal to 20.")
  end

  if !@issuing_carrier.nil? && @issuing_carrier.to_s.length > 20
    invalid_properties.push("invalid value for 'issuing_carrier', the character length must be smaller than or equal to 20.")
  end

  if !@carrier_name.nil? && @carrier_name.to_s.length > 20
    invalid_properties.push("invalid value for 'carrier_name', the character length must be smaller than or equal to 20.")
  end

  if !@travel_agency_iata_code.nil? && @travel_agency_iata_code.to_s.length > 20
    invalid_properties.push("invalid value for 'travel_agency_iata_code', the character length must be smaller than or equal to 20.")
  end

  if !@travel_agency_name.nil? && @travel_agency_name.to_s.length > 30
    invalid_properties.push("invalid value for 'travel_agency_name', the character length must be smaller than or equal to 30.")
  end

  if !@airline_plan_number.nil? && @airline_plan_number.to_s.length > 2
    invalid_properties.push("invalid value for 'airline_plan_number', the character length must be smaller than or equal to 2.")
  end

  if !@airline_invoice_number.nil? && @airline_invoice_number.to_s.length > 6
    invalid_properties.push("invalid value for 'airline_invoice_number', the character length must be smaller than or equal to 6.")
  end

  if !@related_ticket_number.nil? && @related_ticket_number.to_s.length > 20
    invalid_properties.push("invalid value for 'related_ticket_number', the character length must be smaller than or equal to 20.")
  end

  return invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



451
452
453
# File 'lib/swagger_client/models/airline.rb', line 451

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



457
458
459
460
461
462
463
464
465
# File 'lib/swagger_client/models/airline.rb', line 457

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



445
446
447
# File 'lib/swagger_client/models/airline.rb', line 445

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/swagger_client/models/airline.rb', line 224

def valid?
  return false if !@passenger_name.nil? && @passenger_name.to_s.length > 30
  return false if !@ticket_number.nil? && @ticket_number.to_s.length > 20
  return false if !@issuing_carrier.nil? && @issuing_carrier.to_s.length > 20
  return false if !@carrier_name.nil? && @carrier_name.to_s.length > 20
  return false if !@travel_agency_iata_code.nil? && @travel_agency_iata_code.to_s.length > 20
  return false if !@travel_agency_name.nil? && @travel_agency_name.to_s.length > 30
  return false if !@airline_plan_number.nil? && @airline_plan_number.to_s.length > 2
  return false if !@airline_invoice_number.nil? && @airline_invoice_number.to_s.length > 6
  reservation_system_validator = EnumAttributeValidator.new('String', ["START", "TWA", "DELTA", "SABRE", "COVIA_APOLLO", "DR_BLANK", "DER", "TUI"])
  return false unless reservation_system_validator.valid?(@reservation_system)
  return false if !@related_ticket_number.nil? && @related_ticket_number.to_s.length > 20
  return true
end