Class: CityPayApiClient::AirlineAdvice

Inherits:
Object
  • Object
show all
Defined in:
lib/citypay_api_client/models/airline_advice.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AirlineAdvice

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
178
179
180
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
# File 'lib/citypay_api_client/models/airline_advice.rb', line 118

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `CityPayApiClient::AirlineAdvice` 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::AirlineAdvice`. 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?(:'carrier_name')
    self.carrier_name = attributes[:'carrier_name']
  else
    self.carrier_name = nil
  end

  if attributes.key?(:'conjunction_ticket_indicator')
    self.conjunction_ticket_indicator = attributes[:'conjunction_ticket_indicator']
  end

  if attributes.key?(:'eticket_indicator')
    self.eticket_indicator = attributes[:'eticket_indicator']
  end

  if attributes.key?(:'no_air_segments')
    self.no_air_segments = attributes[:'no_air_segments']
  end

  if attributes.key?(:'number_in_party')
    self.number_in_party = attributes[:'number_in_party']
  end

  if attributes.key?(:'original_ticket_no')
    self.original_ticket_no = attributes[:'original_ticket_no']
  end

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

  if attributes.key?(:'segment1')
    self.segment1 = attributes[:'segment1']
  else
    self.segment1 = nil
  end

  if attributes.key?(:'segment2')
    self.segment2 = attributes[:'segment2']
  end

  if attributes.key?(:'segment3')
    self.segment3 = attributes[:'segment3']
  end

  if attributes.key?(:'segment4')
    self.segment4 = attributes[:'segment4']
  end

  if attributes.key?(:'ticket_issue_city')
    self.ticket_issue_city = attributes[:'ticket_issue_city']
  else
    self.ticket_issue_city = nil
  end

  if attributes.key?(:'ticket_issue_date')
    self.ticket_issue_date = attributes[:'ticket_issue_date']
  else
    self.ticket_issue_date = nil
  end

  if attributes.key?(:'ticket_issue_name')
    self.ticket_issue_name = attributes[:'ticket_issue_name']
  else
    self.ticket_issue_name = nil
  end

  if attributes.key?(:'ticket_no')
    self.ticket_no = attributes[:'ticket_no']
  else
    self.ticket_no = nil
  end

  if attributes.key?(:'transaction_type')
    self.transaction_type = attributes[:'transaction_type']
  else
    self.transaction_type = nil
  end
end

Instance Attribute Details

#carrier_nameObject

The name of the airline carrier that generated the tickets for airline travel.



18
19
20
# File 'lib/citypay_api_client/models/airline_advice.rb', line 18

def carrier_name
  @carrier_name
end

#conjunction_ticket_indicatorObject

true if a conjunction ticket (with additional coupons) was issued for an itinerary with more than four segments. Defaults to false.



21
22
23
# File 'lib/citypay_api_client/models/airline_advice.rb', line 21

def conjunction_ticket_indicator
  @conjunction_ticket_indicator
end

#eticket_indicatorObject

The Electronic Ticket Indicator, a code that indicates if an electronic ticket was issued. Defaults to true.



24
25
26
# File 'lib/citypay_api_client/models/airline_advice.rb', line 24

def eticket_indicator
  @eticket_indicator
end

#no_air_segmentsObject

A value that indicates the number of air travel segments included on this ticket. Valid entries include the numerals “0” through “4”. Required only if the transaction type is TKT or EXC.



27
28
29
# File 'lib/citypay_api_client/models/airline_advice.rb', line 27

def no_air_segments
  @no_air_segments
end

#number_in_partyObject

The number of people in the party.



30
31
32
# File 'lib/citypay_api_client/models/airline_advice.rb', line 30

def number_in_party
  @number_in_party
end

#original_ticket_noObject

Required if transaction type is EXC.



33
34
35
# File 'lib/citypay_api_client/models/airline_advice.rb', line 33

def original_ticket_no
  @original_ticket_no
end

#passenger_nameObject

The name of the passenger when the traveller is not the card member that purchased the ticket. Required only if the transaction type is TKT or EXC.



36
37
38
# File 'lib/citypay_api_client/models/airline_advice.rb', line 36

def passenger_name
  @passenger_name
end

#segment1Object

Returns the value of attribute segment1.



38
39
40
# File 'lib/citypay_api_client/models/airline_advice.rb', line 38

def segment1
  @segment1
end

#segment2Object

Returns the value of attribute segment2.



40
41
42
# File 'lib/citypay_api_client/models/airline_advice.rb', line 40

def segment2
  @segment2
end

#segment3Object

Returns the value of attribute segment3.



42
43
44
# File 'lib/citypay_api_client/models/airline_advice.rb', line 42

def segment3
  @segment3
end

#segment4Object

Returns the value of attribute segment4.



44
45
46
# File 'lib/citypay_api_client/models/airline_advice.rb', line 44

def segment4
  @segment4
end

#ticket_issue_cityObject

The name of the city town or village where the transaction took place.



47
48
49
# File 'lib/citypay_api_client/models/airline_advice.rb', line 47

def ticket_issue_city
  @ticket_issue_city
end

#ticket_issue_dateObject

The date the ticket was issued in ISO Date format (yyyy-MM-dd).



50
51
52
# File 'lib/citypay_api_client/models/airline_advice.rb', line 50

def ticket_issue_date
  @ticket_issue_date
end

#ticket_issue_nameObject

The name of the agency generating the ticket.



53
54
55
# File 'lib/citypay_api_client/models/airline_advice.rb', line 53

def ticket_issue_name
  @ticket_issue_name
end

#ticket_noObject

This must be a valid ticket number, i.e. numeric (the first 3 digits must represent the valid IATA plate carrier code). The final check digit should be validated prior to submission. On credit charges, this field should contain the number of the original ticket, and not of a replacement.



56
57
58
# File 'lib/citypay_api_client/models/airline_advice.rb', line 56

def ticket_no
  @ticket_no
end

#transaction_typeObject

This field contains the Transaction Type code assigned to this transaction. Valid codes include: - ‘TKT` = Ticket Purchase - `REF` = Refund - `EXC` = Exchange Ticket - `MSC` = Miscellaneous (non-Ticket Purchase- and non-Exchange Ticket-related transactions only).



59
60
61
# File 'lib/citypay_api_client/models/airline_advice.rb', line 59

def transaction_type
  @transaction_type
end

Class Method Details

._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



492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
# File 'lib/citypay_api_client/models/airline_advice.rb', line 492

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_attributesObject

Returns all the JSON keys this model knows about



84
85
86
# File 'lib/citypay_api_client/models/airline_advice.rb', line 84

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/citypay_api_client/models/airline_advice.rb', line 62

def self.attribute_map
  {
    :'carrier_name' => :'carrier_name',
    :'conjunction_ticket_indicator' => :'conjunction_ticket_indicator',
    :'eticket_indicator' => :'eticket_indicator',
    :'no_air_segments' => :'no_air_segments',
    :'number_in_party' => :'number_in_party',
    :'original_ticket_no' => :'original_ticket_no',
    :'passenger_name' => :'passenger_name',
    :'segment1' => :'segment1',
    :'segment2' => :'segment2',
    :'segment3' => :'segment3',
    :'segment4' => :'segment4',
    :'ticket_issue_city' => :'ticket_issue_city',
    :'ticket_issue_date' => :'ticket_issue_date',
    :'ticket_issue_name' => :'ticket_issue_name',
    :'ticket_no' => :'ticket_no',
    :'transaction_type' => :'transaction_type'
  }
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



468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
# File 'lib/citypay_api_client/models/airline_advice.rb', line 468

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_nullableObject

List of attributes with nullable: true



111
112
113
114
# File 'lib/citypay_api_client/models/airline_advice.rb', line 111

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    :'carrier_name' => :'String',
    :'conjunction_ticket_indicator' => :'Boolean',
    :'eticket_indicator' => :'Boolean',
    :'no_air_segments' => :'Integer',
    :'number_in_party' => :'Integer',
    :'original_ticket_no' => :'String',
    :'passenger_name' => :'String',
    :'segment1' => :'AirlineSegment',
    :'segment2' => :'AirlineSegment',
    :'segment3' => :'AirlineSegment',
    :'segment4' => :'AirlineSegment',
    :'ticket_issue_city' => :'String',
    :'ticket_issue_date' => :'Date',
    :'ticket_issue_name' => :'String',
    :'ticket_no' => :'String',
    :'transaction_type' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
# File 'lib/citypay_api_client/models/airline_advice.rb', line 432

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      carrier_name == o.carrier_name &&
      conjunction_ticket_indicator == o.conjunction_ticket_indicator &&
      eticket_indicator == o.eticket_indicator &&
      no_air_segments == o.no_air_segments &&
      number_in_party == o.number_in_party &&
      original_ticket_no == o.original_ticket_no &&
      passenger_name == o.passenger_name &&
      segment1 == o.segment1 &&
      segment2 == o.segment2 &&
      segment3 == o.segment3 &&
      segment4 == o.segment4 &&
      ticket_issue_city == o.ticket_issue_city &&
      ticket_issue_date == o.ticket_issue_date &&
      ticket_issue_name == o.ticket_issue_name &&
      ticket_no == o.ticket_no &&
      transaction_type == o.transaction_type
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



563
564
565
566
567
568
569
570
571
572
573
574
575
# File 'lib/citypay_api_client/models/airline_advice.rb', line 563

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

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


455
456
457
# File 'lib/citypay_api_client/models/airline_advice.rb', line 455

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



461
462
463
# File 'lib/citypay_api_client/models/airline_advice.rb', line 461

def hash
  [carrier_name, conjunction_ticket_indicator, eticket_indicator, no_air_segments, number_in_party, original_ticket_no, passenger_name, segment1, segment2, segment3, segment4, ticket_issue_city, ticket_issue_date, ticket_issue_name, ticket_no, transaction_type].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
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
277
278
279
280
281
282
283
284
# File 'lib/citypay_api_client/models/airline_advice.rb', line 212

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @carrier_name.nil?
    invalid_properties.push('invalid value for "carrier_name", carrier_name cannot be nil.')
  end

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

  if !@no_air_segments.nil? && @no_air_segments > 4
    invalid_properties.push('invalid value for "no_air_segments", must be smaller than or equal to 4.')
  end

  if !@no_air_segments.nil? && @no_air_segments < 0
    invalid_properties.push('invalid value for "no_air_segments", must be greater than or equal to 0.')
  end

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

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

  if @segment1.nil?
    invalid_properties.push('invalid value for "segment1", segment1 cannot be nil.')
  end

  if @ticket_issue_city.nil?
    invalid_properties.push('invalid value for "ticket_issue_city", ticket_issue_city cannot be nil.')
  end

  if @ticket_issue_city.to_s.length > 18
    invalid_properties.push('invalid value for "ticket_issue_city", the character length must be smaller than or equal to 18.')
  end

  if @ticket_issue_date.nil?
    invalid_properties.push('invalid value for "ticket_issue_date", ticket_issue_date cannot be nil.')
  end

  if @ticket_issue_name.nil?
    invalid_properties.push('invalid value for "ticket_issue_name", ticket_issue_name cannot be nil.')
  end

  if @ticket_issue_name.to_s.length > 26
    invalid_properties.push('invalid value for "ticket_issue_name", the character length must be smaller than or equal to 26.')
  end

  if @ticket_no.nil?
    invalid_properties.push('invalid value for "ticket_no", ticket_no cannot be nil.')
  end

  if @ticket_no.to_s.length > 14
    invalid_properties.push('invalid value for "ticket_no", the character length must be smaller than or equal to 14.')
  end

  if @transaction_type.nil?
    invalid_properties.push('invalid value for "transaction_type", transaction_type cannot be nil.')
  end

  if @transaction_type.to_s.length > 3
    invalid_properties.push('invalid value for "transaction_type", the character length must be smaller than or equal to 3.')
  end

  if @transaction_type.to_s.length < 3
    invalid_properties.push('invalid value for "transaction_type", the character length must be great than or equal to 3.')
  end

  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



539
540
541
# File 'lib/citypay_api_client/models/airline_advice.rb', line 539

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



545
546
547
548
549
550
551
552
553
554
555
556
557
# File 'lib/citypay_api_client/models/airline_advice.rb', line 545

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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



533
534
535
# File 'lib/citypay_api_client/models/airline_advice.rb', line 533

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



288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
# File 'lib/citypay_api_client/models/airline_advice.rb', line 288

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @carrier_name.nil?
  return false if @carrier_name.to_s.length > 25
  return false if !@no_air_segments.nil? && @no_air_segments > 4
  return false if !@no_air_segments.nil? && @no_air_segments < 0
  return false if !@original_ticket_no.nil? && @original_ticket_no.to_s.length > 14
  return false if !@passenger_name.nil? && @passenger_name.to_s.length > 25
  return false if @segment1.nil?
  return false if @ticket_issue_city.nil?
  return false if @ticket_issue_city.to_s.length > 18
  return false if @ticket_issue_date.nil?
  return false if @ticket_issue_name.nil?
  return false if @ticket_issue_name.to_s.length > 26
  return false if @ticket_no.nil?
  return false if @ticket_no.to_s.length > 14
  return false if @transaction_type.nil?
  return false if @transaction_type.to_s.length > 3
  return false if @transaction_type.to_s.length < 3
  true
end