Class: TripIt::LodgingObject
- Inherits:
-
ReservationObject
- Object
- Base
- BaseObject
- ReservationObject
- TripIt::LodgingObject
- Defined in:
- lib/trip_it/classes/objects/lodging_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) ⇒ LodgingObject
constructor
A new instance of LodgingObject.
- #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) ⇒ LodgingObject
Returns a new instance of LodgingObject.
8 9 10 11 12 13 14 |
# File 'lib/trip_it/classes/objects/lodging_object.rb', line 8 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
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/trip_it/classes/objects/lodging_object.rb', line 16 def populate(source) info = source || @client.get("/lodging", :id => @obj_id)["LodgingObject"] super(info) @start_date_time = convertDT(info["StartDateTime"]) @end_date_time = convertDT(info["EndDateTime"]) @number_guests = info["number_guests"] @number_rooms = info["number_rooms"] @room_type = info["room_type"] @address = TripIt::Address.new(info["Address"]) unless info["Address"].nil? @guest = [] chkAndPopulate(@guest, TripIt::Traveler, info["Guest"]) end |
#sequence ⇒ Object
29 30 31 32 |
# File 'lib/trip_it/classes/objects/lodging_object.rb', line 29 def sequence arr = super arr + ["@start_date_time", "@end_date_time", "@address", "@guest", "@number_guests", "@number_rooms", "@room_type"] end |