Class: TripIt::TransportSegment

Inherits:
Base
  • Object
show all
Defined in:
lib/trip_it/classes/segments/transport_segment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#Boolean, #camelize, #chkAndPopulate, #chkObjAndPopulate, #convertDT, #to_hash, #to_json, #to_xml

Methods included from ParamUtil

#address_param, #airportcode_param, #array_param, #boolean_param, #boolean_read_param, #camelize, #date_param, #datetime_param, #exceptions, #float_param, #integer_param, #string_param, #time_param, #traveler_array_param, #traveler_param

Constructor Details

#initialize(params = {}) ⇒ TransportSegment

Returns a new instance of TransportSegment.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/trip_it/classes/segments/transport_segment.rb', line 8

def initialize(params = {})
  @start_date_time        = convertDT(params["StartDateTime"])
  @end_date_time          = convertDT(params["EndDateTime"])
  @start_location_address = TripIt::Address.new(params["StartLocationAddress"]) unless params["StartLocationAddress"].nil?
  @end_location_address   = TripIt::Address.new(params["EndLocationAddress"]) unless params["EndLocationAddress"].nil?
  @start_location_name    = params["start_location_name"]
  @end_location_name      = params["end_location_name"]
  @carrier_name           = params["carrier_name"]
  @confirmation_num       = params["confirmation_num"]
  @number_passengers      = params["number_passengers"]
  @vehicle_description    = params["vehicle_description"]
  @id                     = params["id"]
  @detail_type_code       = params["detail_type_code"]
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/trip_it/classes/segments/transport_segment.rb', line 6

def id
  @id
end

Instance Method Details

#detail_type_codeObject



23
24
25
# File 'lib/trip_it/classes/segments/transport_segment.rb', line 23

def detail_type_code
  @detail_type_code
end

#detail_type_code=(val) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/trip_it/classes/segments/transport_segment.rb', line 26

def detail_type_code=(val)
  if TRANSPORT_DETAIL_TYPE_CODE.has_key?(val)
    @detail_type_code = val
  else
    raise ArgumentError, "detail_type_code must be a valid TRANSPORT_DETAIL_TYPE_CODE"
  end
end