class CityPayApiClient::AirlineAdvice

Attributes

carrier_name[RW]

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

conjunction_ticket_indicator[RW]

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

eticket_indicator[RW]

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

no_air_segments[RW]

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.

number_in_party[RW]

The number of people in the party.

original_ticket_no[RW]

Required if transaction type is EXC.

passenger_name[RW]

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.

segment1[RW]
segment2[RW]
segment3[RW]
segment4[RW]
ticket_issue_city[RW]

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

ticket_issue_date[RW]

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

ticket_issue_name[RW]

The name of the agency generating the ticket.

ticket_no[RW]

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.

transaction_type[RW]

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

Public Class Methods

attribute_map() click to toggle source

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

# File lib/citypay_api_client/models/airline_advice.rb, line 61
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) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/citypay_api_client/models/airline_advice.rb, line 439
def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash

# File lib/citypay_api_client/models/airline_advice.rb, line 112
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']
  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']
  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']
  end

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

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

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

  if attributes.key?(:'transaction_type')
    self.transaction_type = attributes[:'transaction_type']
  end
end
openapi_nullable() click to toggle source

List of attributes with nullable: true

# File lib/citypay_api_client/models/airline_advice.rb, line 105
def self.openapi_nullable
  Set.new([
  ])
end
openapi_types() click to toggle source

Attribute type mapping.

# File lib/citypay_api_client/models/airline_advice.rb, line 83
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

Public Instance Methods

==(o) click to toggle source

Checks equality by comparing each attribute. @param [Object] Object to be compared

# File lib/citypay_api_client/models/airline_advice.rb, line 403
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
_deserialize(type, value) click to toggle source

Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data

# File lib/citypay_api_client/models/airline_advice.rb, line 467
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
    CityPayApiClient.const_get(type).build_from_hash(value)
  end
end
_to_hash(value) click to toggle source

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash

# File lib/citypay_api_client/models/airline_advice.rb, line 536
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) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/citypay_api_client/models/airline_advice.rb, line 446
def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.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[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
carrier_name=(carrier_name) click to toggle source

Custom attribute writer method with validation @param [Object] carrier_name Value to be assigned

# File lib/citypay_api_client/models/airline_advice.rb, line 295
def carrier_name=(carrier_name)
  if carrier_name.nil?
    fail ArgumentError, 'carrier_name cannot be nil'
  end

  if carrier_name.to_s.length > 25
    fail ArgumentError, 'invalid value for "carrier_name", the character length must be smaller than or equal to 25.'
  end

  @carrier_name = carrier_name
end
eql?(o) click to toggle source

@see the `==` method @param [Object] Object to be compared

# File lib/citypay_api_client/models/airline_advice.rb, line 426
def eql?(o)
  self == o
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Integer] Hash code

# File lib/citypay_api_client/models/airline_advice.rb, line 432
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_properties() click to toggle source

Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons

# File lib/citypay_api_client/models/airline_advice.rb, line 192
def list_invalid_properties
  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 @number_in_party.nil?
    invalid_properties.push('invalid value for "number_in_party", number_in_party cannot be nil.')
  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
no_air_segments=(no_air_segments) click to toggle source

Custom attribute writer method with validation @param [Object] no_air_segments Value to be assigned

# File lib/citypay_api_client/models/airline_advice.rb, line 309
def no_air_segments=(no_air_segments)
  if !no_air_segments.nil? && no_air_segments > 4
    fail ArgumentError, 'invalid value for "no_air_segments", must be smaller than or equal to 4.'
  end

  if !no_air_segments.nil? && no_air_segments < 0
    fail ArgumentError, 'invalid value for "no_air_segments", must be greater than or equal to 0.'
  end

  @no_air_segments = no_air_segments
end
original_ticket_no=(original_ticket_no) click to toggle source

Custom attribute writer method with validation @param [Object] original_ticket_no Value to be assigned

# File lib/citypay_api_client/models/airline_advice.rb, line 323
def original_ticket_no=(original_ticket_no)
  if !original_ticket_no.nil? && original_ticket_no.to_s.length > 14
    fail ArgumentError, 'invalid value for "original_ticket_no", the character length must be smaller than or equal to 14.'
  end

  @original_ticket_no = original_ticket_no
end
passenger_name=(passenger_name) click to toggle source

Custom attribute writer method with validation @param [Object] passenger_name Value to be assigned

# File lib/citypay_api_client/models/airline_advice.rb, line 333
def passenger_name=(passenger_name)
  if !passenger_name.nil? && passenger_name.to_s.length > 25
    fail ArgumentError, 'invalid value for "passenger_name", the character length must be smaller than or equal to 25.'
  end

  @passenger_name = passenger_name
end
ticket_issue_city=(ticket_issue_city) click to toggle source

Custom attribute writer method with validation @param [Object] ticket_issue_city Value to be assigned

# File lib/citypay_api_client/models/airline_advice.rb, line 343
def ticket_issue_city=(ticket_issue_city)
  if ticket_issue_city.nil?
    fail ArgumentError, 'ticket_issue_city cannot be nil'
  end

  if ticket_issue_city.to_s.length > 18
    fail ArgumentError, 'invalid value for "ticket_issue_city", the character length must be smaller than or equal to 18.'
  end

  @ticket_issue_city = ticket_issue_city
end
ticket_issue_name=(ticket_issue_name) click to toggle source

Custom attribute writer method with validation @param [Object] ticket_issue_name Value to be assigned

# File lib/citypay_api_client/models/airline_advice.rb, line 357
def ticket_issue_name=(ticket_issue_name)
  if ticket_issue_name.nil?
    fail ArgumentError, 'ticket_issue_name cannot be nil'
  end

  if ticket_issue_name.to_s.length > 26
    fail ArgumentError, 'invalid value for "ticket_issue_name", the character length must be smaller than or equal to 26.'
  end

  @ticket_issue_name = ticket_issue_name
end
ticket_no=(ticket_no) click to toggle source

Custom attribute writer method with validation @param [Object] ticket_no Value to be assigned

# File lib/citypay_api_client/models/airline_advice.rb, line 371
def ticket_no=(ticket_no)
  if ticket_no.nil?
    fail ArgumentError, 'ticket_no cannot be nil'
  end

  if ticket_no.to_s.length > 14
    fail ArgumentError, 'invalid value for "ticket_no", the character length must be smaller than or equal to 14.'
  end

  @ticket_no = ticket_no
end
to_body() click to toggle source

to_body is an alias to to_hash (backward compatibility) @return [Hash] Returns the object in the form of hash

# File lib/citypay_api_client/models/airline_advice.rb, line 512
def to_body
  to_hash
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# File lib/citypay_api_client/models/airline_advice.rb, line 518
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() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/citypay_api_client/models/airline_advice.rb, line 506
def to_s
  to_hash.to_s
end
transaction_type=(transaction_type) click to toggle source

Custom attribute writer method with validation @param [Object] transaction_type Value to be assigned

# File lib/citypay_api_client/models/airline_advice.rb, line 385
def transaction_type=(transaction_type)
  if transaction_type.nil?
    fail ArgumentError, 'transaction_type cannot be nil'
  end

  if transaction_type.to_s.length > 3
    fail ArgumentError, 'invalid value for "transaction_type", the character length must be smaller than or equal to 3.'
  end

  if transaction_type.to_s.length < 3
    fail ArgumentError, 'invalid value for "transaction_type", the character length must be great than or equal to 3.'
  end

  @transaction_type = transaction_type
end
valid?() click to toggle source

Check to see if the all the properties in the model are valid @return true if the model is valid

# File lib/citypay_api_client/models/airline_advice.rb, line 271
def valid?
  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 @number_in_party.nil?
  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