Class: TripIt::CarObject
- Inherits:
-
ReservationObject
- Object
- Base
- BaseObject
- ReservationObject
- TripIt::CarObject
- Defined in:
- lib/trip_it/classes/objects/car_object.rb
Instance Attribute Summary
Attributes inherited from BaseObject
#id, #is_client_traveler, #relative_url
Instance Method Summary collapse
-
#initialize(client, obj_id = nil, source = nil) ⇒ CarObject
constructor
A new instance of CarObject.
- #populate(source) ⇒ Object
- #sequence ⇒ Object
Methods inherited from BaseObject
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) ⇒ CarObject
Returns a new instance of CarObject.
9 10 11 12 13 14 15 |
# File 'lib/trip_it/classes/objects/car_object.rb', line 9 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
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/trip_it/classes/objects/car_object.rb', line 17 def populate(source) info = source || @client.get("/car", :id => @obj_id)["CarObject"] super(info) @start_date_time = convertDT(info["StartDateTime"]) @end_date_time = convertDT(info["EndDateTime"]) @start_location_address = TripIt::Address.new(info["start_location_address"]) unless info["start_location_address"].nil? @end_location_address = TripIt::Address.new(info["end_location_address"]) unless info["end_location_address"].nil? @start_location_hours = info["start_location_hours"] @start_location_name = info["start_location_name"] @start_location_phone = info["start_location_phone"] @end_location_hours = info["end_location_hours"] @end_location_name = info["end_location_name"] @end_location_phone = info["end_location_phone"] @car_description = info["car_description"] @car_type = info["car_type"] @mileage_charges = info["mileage_charges"] @driver = TripIt::Traveler.new(info["Driver"]) unless info["Driver"].nil? end |
#sequence ⇒ Object
36 37 38 39 40 41 |
# File 'lib/trip_it/classes/objects/car_object.rb', line 36 def sequence arr = super arr + ["@start_date_time", "@end_date_time", "@start_location_address", "@end_location_address", "@driver", "@start_location_hours", "@start_location_name", "@start_location_phone", "@end_location_hours", "@end_location_name", "@end_location_phone", "@car_description", "@car_type", "@mileage_charges"] end |