Class: TripIt::ActivityObject
- Inherits:
-
ReservationObject
- Object
- Base
- BaseObject
- ReservationObject
- TripIt::ActivityObject
- Defined in:
- lib/trip_it/classes/objects/activity_object.rb
Instance Attribute Summary
Attributes inherited from BaseObject
#id, #is_client_traveler, #relative_url
Instance Method Summary collapse
- #detail_type_code ⇒ Object
- #detail_type_code=(val) ⇒ Object
-
#initialize(client, obj_id = nil, source = nil) ⇒ ActivityObject
constructor
A new instance of ActivityObject.
- #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) ⇒ ActivityObject
Returns a new instance of ActivityObject.
9 10 11 12 13 14 15 |
# File 'lib/trip_it/classes/objects/activity_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
#detail_type_code ⇒ Object
29 30 31 |
# File 'lib/trip_it/classes/objects/activity_object.rb', line 29 def detail_type_code @detail_type_code end |
#detail_type_code=(val) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/trip_it/classes/objects/activity_object.rb', line 32 def detail_type_code=(val) if ACTIVITY_DETAIL_TYPE_CODE.has_key?(val) @detail_type_code = val else raise ArgumentError, "detail_type_code must have a valid ACTIVITY_DETAIL_TYPE_CODE" end end |
#populate(source) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/trip_it/classes/objects/activity_object.rb', line 17 def populate(source) info = source || @client.get("/activity", :id => @obj_id)["ActivityObject"] super(info) @start_date_time = convertDT(info["StartDateTime"]) @end_time = Time.parse(info["end_time"]) unless info["end_time"].nil? @address = TripIt::Address.new(info["Address"]) unless info["Address"].nil? @location_name = info["location_name"] @detail_type_code = info["detail_type_code"] @participant = [] chkAndPopulate(@participant, TripIt::Traveler, info["Participant"]) end |
#sequence ⇒ Object
40 41 42 43 |
# File 'lib/trip_it/classes/objects/activity_object.rb', line 40 def sequence arr = super arr + ["@start_date_time", "@end_time", "@address", "@participant", "@detail_type_code", "@location_name"] end |