class Harvest::TimeEntry

Public Class Methods

new(args = {}, _ = nil) click to toggle source
Calls superclass method
# File lib/harvest/time_entry.rb, line 11
def initialize(args = {}, _ = nil)
  args = args.stringify_keys
  self.user = args.delete('user') if args['user']
  self.task = args.delete('task') if args['task']
  self.client = args.delete('client') if args['client']
  self.project = args.delete('project') if args['project']
  self.spent_date = args.delete('spent_date') if args['spent_date']
  self.user_assignment = args.delete('user_assignment') if args['user_assignment']
  self.task_assignment = args.delete('task_assignment') if args['task_assignment']
  super
end

Public Instance Methods

as_json(args = {}) click to toggle source
Calls superclass method
# File lib/harvest/time_entry.rb, line 51
def as_json(args = {})
  super(args).to_hash.stringify_keys.tap do |hash|
    hash.update('spent_date' => (spent_date.nil? ? nil : spent_date.xmlschema))
  end
end
client=(client) click to toggle source
# File lib/harvest/time_entry.rb, line 27
def client=(client)
  self['client_id'] = client['id']
end
project=(project) click to toggle source
# File lib/harvest/time_entry.rb, line 31
def project=(project)
  self['project_id'] = project['id']
end
spent_date=(date) click to toggle source
# File lib/harvest/time_entry.rb, line 47
def spent_date=(date)
  self['spent_date'] = Date.parse(date.to_s)
end
task=(task) click to toggle source
# File lib/harvest/time_entry.rb, line 35
def task=(task)
  self['task_id'] = task['id']
end
task_assignment=(task_assignment) click to toggle source
# File lib/harvest/time_entry.rb, line 43
def task_assignment=(task_assignment)
  self['task_assignment_id'] = task_assignment['id']
end
user=(user) click to toggle source
# File lib/harvest/time_entry.rb, line 23
def user=(user)
  self['user_id'] = user['id']
end
user_assignment=(user_assignment) click to toggle source
# File lib/harvest/time_entry.rb, line 39
def user_assignment=(user_assignment)
  self['user_assignment_id'] = user_assignment['id']
end