Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix command line runner

  • Loading branch information...
commit 39efc734d37315388130a359ca8238f8bd87d08d 1 parent 9913464
@browning browning authored
Showing with 6 additions and 6 deletions.
  1. +3 −2 lib/toggl.rb
  2. +3 −4 lib/toggl_cmd/runner.rb
View
5 lib/toggl.rb
@@ -25,11 +25,11 @@ def auth
end
def default_workspace_id
- self.workspaces["data"].first["id"]
+ self.workspaces.first["id"]
end
def find_project_id(str)
- if project = self.projects["data"].find{|project| project["client_project_name"].downcase =~ /#{str}/}
+ if project = self.projects.find{|project| project["client_project_name"].downcase =~ /#{str}/}
project["id"]
end
end
@@ -71,6 +71,7 @@ def create_time_entry(params={})
workspace = params[:workspace] || default_workspace_id
project_id = find_project_id(params[:project]) || create_project(params, workspace)
params[:billable] = true
+ params[:start] = Time.now if params[:start].nil?
params[:start] = params[:start].iso8601
params.merge!({ :created_with => name,
:workspace => {:id => workspace},
View
7 lib/toggl_cmd/runner.rb
@@ -18,10 +18,10 @@ def self.toggl(args)
prettify_projects(Toggl.new(token, NAME).projects)
elsif options[:delete]
toggl = Toggl.new(token, NAME)
- toggl.delete_task(options[:delete])
- prettify_tasks(toggl.tasks)
+ toggl.delete_time_entry(options[:delete])
+ prettify_tasks(toggl.time_entries)
elsif options.any?
- prettify_tasks(Toggl.new(token, NAME, options.delete(:debug)).create_task(options))
+ prettify_tasks(Toggl.new(token, NAME, options.delete(:debug)).create_time_entry(options))
else
puts options.opts
end
@@ -30,7 +30,6 @@ def self.toggl(args)
private
def self.prettify_tasks(values)
- values = values["data"]
values = [values] unless values.is_a?(Array)
values.each do |value|
value["project"] = value["project"]["name"]
Please sign in to comment.
Something went wrong with that request. Please try again.