Class: TripIt::NoteObject

Inherits:
BaseObject show all
Defined in:
lib/trip_it/classes/objects/note_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) ⇒ NoteObject

Returns a new instance of NoteObject.



7
8
9
10
11
12
13
# File 'lib/trip_it/classes/objects/note_object.rb', line 7

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_codeObject



27
28
29
# File 'lib/trip_it/classes/objects/note_object.rb', line 27

def detail_type_code
  @detail_type_code
end

#detail_type_code=(val) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/trip_it/classes/objects/note_object.rb', line 30

def detail_type_code=(val)
  if NOTE_DETAIL_TYPE_CODE.has_key?(val)
    @detail_type_code = val
  else
    raise ArgumentError, "detail_type_code must have a valid NOTE_DETAIL_TYPE_CODE"
  end
end

#populate(source) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/trip_it/classes/objects/note_object.rb', line 15

def populate(source)
  info = source || @client.get("/note", :id => @obj_id)["NoteObject"]
  super(info)
  @date_time        = convertDT(info["DateTime"])
  @address          = TripIt::Address.new(info["Address"]) unless info["Address"].nil?
  @source           = info["source"]
  @text             = info["text"]
  @url              = info["url"]
  @notes            = info["notes"]
  @detail_type_code = info["detail_type_code"]
end

#sequenceObject



38
39
40
41
# File 'lib/trip_it/classes/objects/note_object.rb', line 38

def sequence
  arr = super
  arr + ["@date_time", "@address", "@detail_type_code", "@source", "@text", "@url", "@notes"]
end