class TimeCamp::Entry
Attributes
addons_external_id[R]
billable[R]
date[R]
description[R]
duration[R]
end_time[R]
end_time_hour[R]
entry_id[R]
id[R]
invoice_id[R]
last_modify[R]
name[R]
note[R]
start_time[R]
start_time_hour[R]
started_at[R]
task_id[R]
time_span[R]
user_id[R]
Public Class Methods
create(opts={})
click to toggle source
required :date(%Y-%m-%d), :duration(in seconds) optional :note, :start_time(13:30:00), :end_time, :billable, :task_id
# File lib/ruby-timecamp/resources/entry.rb, line 43 def self.create(opts={}) data_keys = [:date, :duration, :note, :start_time, :end_time, :billable, :task_id] data, opts = opts.partition{ |k, v| data_keys.include?(k) }.map(&:to_h) response = TimeCamp::Request.post(resource_name, opts, data) return EntryCollection.parse(response) end
delete(opts={})
click to toggle source
# File lib/ruby-timecamp/resources/entry.rb, line 59 def self.delete(opts={}) data_keys = [:id, :entry_id] data, opts = opts.partition{ |k, v| data_keys.include?(k) }.map(&:to_h) response = TimeCamp::Request.delete(resource_name, opts, data) return EntryCollection.parse(response) end
get(opts={})
click to toggle source
Example GET response [
{ "id":"3621", "duration":"3600", // in seconds "user_id":"123", "description":"", "last_modify":"2014-03-19 14:34:50", "billable":1, "task_id":"3132", "date":"2013-03-30", "start_time":"12:20:00", // this value may be null if user did not specify time frame "name":"Task name", "addons_external_id":"123241", // for integrations with Trello, Pivotal Tracker, etc., "0" if no integration "billable":0/1, "invoiceId":0/invoiceId }
] required :from, :to optional :task_ids, :with_subtasks, :user_ids
# File lib/ruby-timecamp/resources/entry.rb, line 31 def self.get(opts={}) response = TimeCamp::Request.get(resource_name, opts) return EntryCollection.parse(response) end
timers(opts={})
click to toggle source
# File lib/ruby-timecamp/resources/entry.rb, line 36 def self.timers(opts={}) response = TimeCamp::Request.get('timer_running', opts) return EntryCollection.parse(response) end
update(opts={})
click to toggle source
required :id optional :duration, :note, :start_time, :end_time, :billable, :invoiceId, :task_id, :updateActivities
# File lib/ruby-timecamp/resources/entry.rb, line 52 def self.update(opts={}) data_keys = [:id, :duration, :note, :start_time, :end_time, :billable, :invoiceId, :task_id, :updateActivities] data, opts = opts.partition{ |k, v| data_keys.include?(k) }.map(&:to_h) response = TimeCamp::Request.put(resource_name, opts, data) return EntryCollection.parse(response) end
Private Instance Methods
load_attributes(response)
click to toggle source
INSTANCE METHODS #
# File lib/ruby-timecamp/resources/entry.rb, line 72 def load_attributes(response) @id = response[:id] @duration = response[:duration] @user_id = response[:user_id] @description = response[:description] @last_modify = response[:last_modify] @billable = response[:billable] @task_id = response[:task_id] @date = response[:date] @start_time = response[:start_time] @start_time_hour = response[:start_time_hour] @end_time = response[:end_time] @end_time_hour = response[:end_time_hour] @name = response[:name] @addons_external_id = response[:addons_external_id] @invoice_id = response[:invoice_id] @started_at = response[:started_at] @entry_id = response[:entry_id] @note = response[:note] @time_span = response[:time_span] end