Class: CityPayApiClient::AirlineSegment
- Inherits:
-
Object
- Object
- CityPayApiClient::AirlineSegment
- Defined in:
- lib/citypay_api_client/models/airline_segment.rb
Instance Attribute Summary collapse
-
#arrival_location_code ⇒ Object
A standard airline routing code (airport code or location identifier) applicable to the arrival portion of this segment.
-
#carrier_code ⇒ Object
This field contains the two character airline designator code (air carrier code or airline code) that corresponds to the airline carrier applicable for up to four flight segments of this trip itinerary.
-
#class_service_code ⇒ Object
This field contains a code that corresponds to the fare class (A, B, C, D, Premium, Discounted, etc.) within the overall class of service (e.g., First Class, Business, Economy) applicable to this travel segment, as specified in the IATA Standard Code allocation table.
-
#departure_date ⇒ Object
The Departure Date for the travel segment in ISO Date Format (yyyy-MM-dd).
-
#departure_location_code ⇒ Object
A standard airline routing code (airport code or location identifier) applicable to the departure portion of this segment.
-
#flight_number ⇒ Object
This field contains the carrier-assigned Flight Number for this travel segment.
-
#segment_fare ⇒ Object
This field contains the total Fare for this travel segment.
-
#stop_over_indicator ⇒ Object
O = Stopover allowed, X = Stopover not allowed.
Class Method Summary collapse
-
._deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ AirlineSegment
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 ⇒ 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 = {}) ⇒ AirlineSegment
Initializes the object
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 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 |
# File 'lib/citypay_api_client/models/airline_segment.rb', line 82 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `CityPayApiClient::AirlineSegment` 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 `CityPayApiClient::AirlineSegment`. 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?(:'arrival_location_code') self.arrival_location_code = attributes[:'arrival_location_code'] else self.arrival_location_code = nil end if attributes.key?(:'carrier_code') self.carrier_code = attributes[:'carrier_code'] else self.carrier_code = nil end if attributes.key?(:'class_service_code') self.class_service_code = attributes[:'class_service_code'] else self.class_service_code = nil end if attributes.key?(:'departure_date') self.departure_date = attributes[:'departure_date'] else self.departure_date = nil end if attributes.key?(:'departure_location_code') self.departure_location_code = attributes[:'departure_location_code'] end if attributes.key?(:'flight_number') self.flight_number = attributes[:'flight_number'] else self.flight_number = nil end if attributes.key?(:'segment_fare') self.segment_fare = attributes[:'segment_fare'] end if attributes.key?(:'stop_over_indicator') self.stop_over_indicator = attributes[:'stop_over_indicator'] end end |
Instance Attribute Details
#arrival_location_code ⇒ Object
A standard airline routing code (airport code or location identifier) applicable to the arrival portion of this segment.
18 19 20 |
# File 'lib/citypay_api_client/models/airline_segment.rb', line 18 def arrival_location_code @arrival_location_code end |
#carrier_code ⇒ Object
This field contains the two character airline designator code (air carrier code or airline code) that corresponds to the airline carrier applicable for up to four flight segments of this trip itinerary.
21 22 23 |
# File 'lib/citypay_api_client/models/airline_segment.rb', line 21 def carrier_code @carrier_code end |
#class_service_code ⇒ Object
This field contains a code that corresponds to the fare class (A, B, C, D, Premium, Discounted, etc.) within the overall class of service (e.g., First Class, Business, Economy) applicable to this travel segment, as specified in the IATA Standard Code allocation table.
24 25 26 |
# File 'lib/citypay_api_client/models/airline_segment.rb', line 24 def class_service_code @class_service_code end |
#departure_date ⇒ Object
The Departure Date for the travel segment in ISO Date Format (yyyy-MM-dd).
27 28 29 |
# File 'lib/citypay_api_client/models/airline_segment.rb', line 27 def departure_date @departure_date end |
#departure_location_code ⇒ Object
A standard airline routing code (airport code or location identifier) applicable to the departure portion of this segment.
30 31 32 |
# File 'lib/citypay_api_client/models/airline_segment.rb', line 30 def departure_location_code @departure_location_code end |
#flight_number ⇒ Object
This field contains the carrier-assigned Flight Number for this travel segment.
33 34 35 |
# File 'lib/citypay_api_client/models/airline_segment.rb', line 33 def flight_number @flight_number end |
#segment_fare ⇒ Object
This field contains the total Fare for this travel segment.
36 37 38 |
# File 'lib/citypay_api_client/models/airline_segment.rb', line 36 def segment_fare @segment_fare end |
#stop_over_indicator ⇒ Object
O = Stopover allowed, X = Stopover not allowed.
39 40 41 |
# File 'lib/citypay_api_client/models/airline_segment.rb', line 39 def stop_over_indicator @stop_over_indicator end |
Class Method Details
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 |
# File 'lib/citypay_api_client/models/airline_segment.rb', line 346 def self._deserialize(type, value) case type.to_sym when :Time Time.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 # models (e.g. Pet) or oneOf klass = CityPayApiClient.const_get(type) klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
56 57 58 |
# File 'lib/citypay_api_client/models/airline_segment.rb', line 56 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/citypay_api_client/models/airline_segment.rb', line 42 def self.attribute_map { :'arrival_location_code' => :'arrival_location_code', :'carrier_code' => :'carrier_code', :'class_service_code' => :'class_service_code', :'departure_date' => :'departure_date', :'departure_location_code' => :'departure_location_code', :'flight_number' => :'flight_number', :'segment_fare' => :'segment_fare', :'stop_over_indicator' => :'stop_over_indicator' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 |
# File 'lib/citypay_api_client/models/airline_segment.rb', line 322 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif 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) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
75 76 77 78 |
# File 'lib/citypay_api_client/models/airline_segment.rb', line 75 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/citypay_api_client/models/airline_segment.rb', line 61 def self.openapi_types { :'arrival_location_code' => :'String', :'carrier_code' => :'String', :'class_service_code' => :'String', :'departure_date' => :'Date', :'departure_location_code' => :'String', :'flight_number' => :'String', :'segment_fare' => :'Integer', :'stop_over_indicator' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
294 295 296 297 298 299 300 301 302 303 304 305 |
# File 'lib/citypay_api_client/models/airline_segment.rb', line 294 def ==(o) return true if self.equal?(o) self.class == o.class && arrival_location_code == o.arrival_location_code && carrier_code == o.carrier_code && class_service_code == o.class_service_code && departure_date == o.departure_date && departure_location_code == o.departure_location_code && flight_number == o.flight_number && segment_fare == o.segment_fare && stop_over_indicator == o.stop_over_indicator end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
417 418 419 420 421 422 423 424 425 426 427 428 429 |
# File 'lib/citypay_api_client/models/airline_segment.rb', line 417 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 |
#eql?(o) ⇒ Boolean
309 310 311 |
# File 'lib/citypay_api_client/models/airline_segment.rb', line 309 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
315 316 317 |
# File 'lib/citypay_api_client/models/airline_segment.rb', line 315 def hash [arrival_location_code, carrier_code, class_service_code, departure_date, departure_location_code, flight_number, segment_fare, stop_over_indicator].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 |
# File 'lib/citypay_api_client/models/airline_segment.rb', line 140 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @arrival_location_code.nil? invalid_properties.push('invalid value for "arrival_location_code", arrival_location_code cannot be nil.') end if @arrival_location_code.to_s.length > 3 invalid_properties.push('invalid value for "arrival_location_code", the character length must be smaller than or equal to 3.') end if @carrier_code.nil? invalid_properties.push('invalid value for "carrier_code", carrier_code cannot be nil.') end if @carrier_code.to_s.length > 2 invalid_properties.push('invalid value for "carrier_code", the character length must be smaller than or equal to 2.') end if @class_service_code.nil? invalid_properties.push('invalid value for "class_service_code", class_service_code cannot be nil.') end if @class_service_code.to_s.length > 2 invalid_properties.push('invalid value for "class_service_code", the character length must be smaller than or equal to 2.') end if @departure_date.nil? invalid_properties.push('invalid value for "departure_date", departure_date cannot be nil.') end if !@departure_location_code.nil? && @departure_location_code.to_s.length > 3 invalid_properties.push('invalid value for "departure_location_code", the character length must be smaller than or equal to 3.') end if @flight_number.nil? invalid_properties.push('invalid value for "flight_number", flight_number cannot be nil.') end if @flight_number.to_s.length > 4 invalid_properties.push('invalid value for "flight_number", the character length must be smaller than or equal to 4.') end if !@stop_over_indicator.nil? && @stop_over_indicator.to_s.length > 1 invalid_properties.push('invalid value for "stop_over_indicator", the character length must be smaller than or equal to 1.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
393 394 395 |
# File 'lib/citypay_api_client/models/airline_segment.rb', line 393 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
399 400 401 402 403 404 405 406 407 408 409 410 411 |
# File 'lib/citypay_api_client/models/airline_segment.rb', line 399 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.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
387 388 389 |
# File 'lib/citypay_api_client/models/airline_segment.rb', line 387 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/citypay_api_client/models/airline_segment.rb', line 192 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @arrival_location_code.nil? return false if @arrival_location_code.to_s.length > 3 return false if @carrier_code.nil? return false if @carrier_code.to_s.length > 2 return false if @class_service_code.nil? return false if @class_service_code.to_s.length > 2 return false if @departure_date.nil? return false if !@departure_location_code.nil? && @departure_location_code.to_s.length > 3 return false if @flight_number.nil? return false if @flight_number.to_s.length > 4 return false if !@stop_over_indicator.nil? && @stop_over_indicator.to_s.length > 1 true end |