Class: Harvest::TimeEntry

Inherits:
BaseModel show all
Includes:
HappyMapper
Defined in:
lib/harvest/time_entry.rb

Instance Method Summary collapse

Methods inherited from BaseModel

#==, api_path, #attributes=, #initialize, #to_i

Constructor Details

This class inherits a constructor from Harvest::BaseModel

Instance Method Details

#spent_at=(date) ⇒ Object



23
24
25
# File 'lib/harvest/time_entry.rb', line 23

def spent_at=(date)
  @spent_at = (String === date ? Time.parse(date) : date)
end

#to_xmlObject



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/harvest/time_entry.rb', line 27

def to_xml
  builder = Builder::XmlMarkup.new
  builder.request do |r|
    r.tag!('notes', notes) if notes
    r.tag!('hours', hours) if hours
    r.tag!('project_id', project_id) if project_id
    r.tag!('task_id', task_id) if task_id
    r.tag!('spent_at', spent_at) if spent_at
    r.tag!('of_user', user_id) if user_id
  end
end