Class: TripIt::DirectionsObject

Inherits:
BaseObject show all
Defined in:
lib/trip_it/classes/objects/directions_object.rb

Instance Attribute Summary

Attributes inherited from BaseObject

#id, #is_client_traveler, #relative_url

Instance Method Summary collapse

Methods inherited from BaseObject

#save

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(client, obj_id = nil, source = nil) ⇒ DirectionsObject



6
7
8
9
10
11
12
# File 'lib/trip_it/classes/objects/directions_object.rb', line 6

def initialize(client, obj_id = nil, source = nil)
  @client = client
  unless obj_id.nil?
    @obj_id = obj_id
    populate(source)
  end
end

Instance Method Details

#populate(source) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/trip_it/classes/objects/directions_object.rb', line 14

def populate(source)
  info = source || @client.get("/directions", :id => @obj_id)["DirectionsObject"]
  super(info)
  @date_time      = convertDT(info["DateTime"])
  @start_address  = TripIt::Address.new(info["StartAddress"]) unless info["StartAddress"].nil?
  @end_address    = TripIt::Address.new(info["EndAddress"]) unless info["EndAddress"].nil?
end

#sequenceObject



22
23
24
25
# File 'lib/trip_it/classes/objects/directions_object.rb', line 22

def sequence
  arr = super
  arr + ["@date_time", "@start_address", "@end_address"]
end