Class: TripIt::RestaurantObject

Inherits:
ReservationObject show all
Defined in:
lib/trip_it/classes/objects/restaurant_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) ⇒ RestaurantObject

Returns a new instance of RestaurantObject.



8
9
10
11
12
13
14
# File 'lib/trip_it/classes/objects/restaurant_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/restaurant_object.rb', line 16

def populate(source)
  info = source || @client.get("/restaurant", :id => @obj_id)["RestaurantObject"]
  super(info)
  @date_time          = convertDT(info["DateTime"])
  @address            = TripIt::Address.new(info["Address"]) unless info["Address"].nil?
  @reservation_holder = TripIt::Traveler.new(info["ReservationHolder"]) unless info["ReservationHolder"].nil?
  @cuisine            = info["cuisine"]
  @dress_code         = info["dress_code"]
  @hours              = info["hours"]
  @number_patrons     = info["number_patrons"]
  @price_range        = info["price_range"]
end

#sequenceObject



29
30
31
32
# File 'lib/trip_it/classes/objects/restaurant_object.rb', line 29

def sequence
  arr = super
  arr + ["@date_time", "@address", "@reservation_holder", "@cuisine", "@dress_code", "@hours", "@number_patrons", "@price_range"]      
end