Class: OpenapiClient::Airline
- Inherits:
-
Object
- Object
- OpenapiClient::Airline
- Defined in:
- lib/openapi_client/models/airline.rb
Overview
Additional data specific to the airline industry.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#airline_invoice_number ⇒ Object
The invoice number used by the airline.
-
#airline_plan_number ⇒ Object
The airline plan number associated with the transaction.
-
#ancillary_service_category ⇒ Object
Identify the purchase of ancillary goods or services with a false value.
-
#carrier_name ⇒ Object
The carrier associated with the transaction.
-
#issuing_carrier ⇒ Object
The carrier that issued the ticket.
-
#passenger_name ⇒ Object
The passenger name associated with the transaction.
-
#related_ticket_number ⇒ Object
The number of any other tickets associated with the transaction ticket.
-
#reservation_system ⇒ Object
The reservation system used to create the ticket.
-
#restricted ⇒ Object
If the transaction is associated with a restricted class fare.
-
#ticket_number ⇒ Object
The airline ticket number associated with the transaction.
-
#ticket_purchase ⇒ Object
Identifies if the transaction is a ticket purchase.
-
#travel_agency_iata_code ⇒ Object
The IATA code associated with the travel agency.
-
#travel_agency_name ⇒ Object
The business name of the travel agency.
-
#travel_route ⇒ Object
Array containing up to 4 items that describe the route associated with the transaction.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes, attribute_map = self.class.attribute_map, openapi_types = self.class.openapi_types) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Airline
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash(attribute_map = self.class.attribute_map, openapi_nullable = Set.new([])) ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ Airline
Initializes the object
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 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/openapi_client/models/airline.rb', line 124 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::Airline` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Airline`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'passenger_name') self.passenger_name = attributes[:'passenger_name'] end if attributes.key?(:'ticket_number') self.ticket_number = attributes[:'ticket_number'] end if attributes.key?(:'issuing_carrier') self.issuing_carrier = attributes[:'issuing_carrier'] end if attributes.key?(:'carrier_name') self.carrier_name = attributes[:'carrier_name'] end if attributes.key?(:'travel_agency_iata_code') self.travel_agency_iata_code = attributes[:'travel_agency_iata_code'] end if attributes.key?(:'travel_agency_name') self.travel_agency_name = attributes[:'travel_agency_name'] end if attributes.key?(:'airline_plan_number') self.airline_plan_number = attributes[:'airline_plan_number'] end if attributes.key?(:'airline_invoice_number') self.airline_invoice_number = attributes[:'airline_invoice_number'] end if attributes.key?(:'reservation_system') self.reservation_system = attributes[:'reservation_system'] end if attributes.key?(:'restricted') self.restricted = attributes[:'restricted'] end if attributes.key?(:'travel_route') if (value = attributes[:'travel_route']).is_a?(Array) self.travel_route = value end end if attributes.key?(:'related_ticket_number') self. = attributes[:'related_ticket_number'] end if attributes.key?(:'ancillary_service_category') if (value = attributes[:'ancillary_service_category']).is_a?(Array) self.ancillary_service_category = value end end if attributes.key?(:'ticket_purchase') self.ticket_purchase = attributes[:'ticket_purchase'] end end |
Instance Attribute Details
#airline_invoice_number ⇒ Object
The invoice number used by the airline.
40 41 42 |
# File 'lib/openapi_client/models/airline.rb', line 40 def airline_invoice_number @airline_invoice_number end |
#airline_plan_number ⇒ Object
The airline plan number associated with the transaction.
37 38 39 |
# File 'lib/openapi_client/models/airline.rb', line 37 def airline_plan_number @airline_plan_number end |
#ancillary_service_category ⇒ Object
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.
55 56 57 |
# File 'lib/openapi_client/models/airline.rb', line 55 def ancillary_service_category @ancillary_service_category end |
#carrier_name ⇒ Object
The carrier associated with the transaction.
28 29 30 |
# File 'lib/openapi_client/models/airline.rb', line 28 def carrier_name @carrier_name end |
#issuing_carrier ⇒ Object
The carrier that issued the ticket.
25 26 27 |
# File 'lib/openapi_client/models/airline.rb', line 25 def issuing_carrier @issuing_carrier end |
#passenger_name ⇒ Object
The passenger name associated with the transaction.
19 20 21 |
# File 'lib/openapi_client/models/airline.rb', line 19 def passenger_name @passenger_name end |
#related_ticket_number ⇒ Object
The number of any other tickets associated with the transaction ticket.
52 53 54 |
# File 'lib/openapi_client/models/airline.rb', line 52 def @related_ticket_number end |
#reservation_system ⇒ Object
The reservation system used to create the ticket.
43 44 45 |
# File 'lib/openapi_client/models/airline.rb', line 43 def reservation_system @reservation_system end |
#restricted ⇒ Object
If the transaction is associated with a restricted class fare.
46 47 48 |
# File 'lib/openapi_client/models/airline.rb', line 46 def restricted @restricted end |
#ticket_number ⇒ Object
The airline ticket number associated with the transaction.
22 23 24 |
# File 'lib/openapi_client/models/airline.rb', line 22 def ticket_number @ticket_number end |
#ticket_purchase ⇒ Object
Identifies if the transaction is a ticket purchase.
58 59 60 |
# File 'lib/openapi_client/models/airline.rb', line 58 def ticket_purchase @ticket_purchase end |
#travel_agency_iata_code ⇒ Object
The IATA code associated with the travel agency.
31 32 33 |
# File 'lib/openapi_client/models/airline.rb', line 31 def travel_agency_iata_code @travel_agency_iata_code end |
#travel_agency_name ⇒ Object
The business name of the travel agency.
34 35 36 |
# File 'lib/openapi_client/models/airline.rb', line 34 def travel_agency_name @travel_agency_name end |
#travel_route ⇒ Object
Array containing up to 4 items that describe the route associated with the transaction.
49 50 51 |
# File 'lib/openapi_client/models/airline.rb', line 49 def travel_route @travel_route end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/openapi_client/models/airline.rb', line 83 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 |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
394 395 396 |
# File 'lib/openapi_client/models/airline.rb', line 394 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_types ⇒ Object
Attribute type mapping.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/openapi_client/models/airline.rb', line 103 def self.openapi_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.
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 |
# File 'lib/openapi_client/models/airline.rb', line 360 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 && == o. && ancillary_service_category == o.ancillary_service_category && ticket_purchase == o.ticket_purchase end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 |
# File 'lib/openapi_client/models/airline.rb', line 422 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 klass = OpenapiClient.const_get(type) if klass.respond_to?(:openapi_discriminator_name) klass = OpenapiClient.const_get(value[klass.attribute_map[klass.openapi_discriminator_name]]) end klass.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
496 497 498 499 500 501 502 503 504 505 506 507 508 |
# File 'lib/openapi_client/models/airline.rb', line 496 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, attribute_map = self.class.attribute_map, openapi_types = self.class.openapi_types) ⇒ Object
Builds the object from hash
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 |
# File 'lib/openapi_client/models/airline.rb', line 401 def build_from_hash(attributes, attribute_map = self.class.attribute_map, openapi_types = self.class.openapi_types) return nil unless attributes.is_a?(Hash) openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[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
381 382 383 |
# File 'lib/openapi_client/models/airline.rb', line 381 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
387 388 389 |
# File 'lib/openapi_client/models/airline.rb', line 387 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, , ancillary_service_category, ticket_purchase].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
# File 'lib/openapi_client/models/airline.rb', line 200 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 invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
472 473 474 |
# File 'lib/openapi_client/models/airline.rb', line 472 def to_body to_hash end |
#to_hash(attribute_map = self.class.attribute_map, openapi_nullable = Set.new([])) ⇒ Hash
Returns the object in the form of hash
478 479 480 481 482 483 484 485 486 487 488 489 490 |
# File 'lib/openapi_client/models/airline.rb', line 478 def to_hash(attribute_map = self.class.attribute_map, openapi_nullable = Set.new([])) hash = {} attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
466 467 468 |
# File 'lib/openapi_client/models/airline.rb', line 466 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
# File 'lib/openapi_client/models/airline.rb', line 243 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 true end |