Module: Toggl::Api::Client

Included in:
Base
Defined in:
lib/toggl_api/api/client.rb

Instance Method Summary collapse

Instance Method Details

#create_client(name, wid, options = {}) ⇒ Object

name: The name of the client (string, required, unique in workspace) wid: workspace ID, where the client will be used (integer, required) notes: Notes for the client (string, not required) hrate: The hourly rate for this client (float, not required, available only for pro workspaces) cur: The name of the client’s currency (string, not required, available only for pro workspaces) at: timestamp that is sent in the response, indicates the time client was last updated



12
13
14
# File 'lib/toggl_api/api/client.rb', line 12

def create_client(name, wid,options={})
  post "/clients", {"client" => {"name"=>name,"wid"=>wid}.merge(options)}
end

#delete_client(cid) ⇒ Object



36
37
38
# File 'lib/toggl_api/api/client.rb', line 36

def delete_client(cid)
  delete "/clients/#{cid}"
end

#get_client(cid) ⇒ Object Also known as: client



16
17
18
# File 'lib/toggl_api/api/client.rb', line 16

def get_client(cid)
  get "/clients/#{cid}"
end

#get_client_projects(cid, active = true) ⇒ Object Also known as: client_projects



26
27
28
# File 'lib/toggl_api/api/client.rb', line 26

def get_client_projects(cid,active=true)
  get "clients/#{cid}/projects",{:active => active}
end

#get_clientsObject Also known as: clients



21
22
23
# File 'lib/toggl_api/api/client.rb', line 21

def get_clients
  get "/clients"
end

#update_client(cid, options) ⇒ Object



31
32
33
34
# File 'lib/toggl_api/api/client.rb', line 31

def update_client(cid,options)
  options = Hashie::Mash.new options
  put "/clients/#{cid}", (options.key?(:client) ? options : {:client => options})
end