Class: TripIt::LodgingObject

Inherits:
ReservationObject show all
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

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

#sequenceObject



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