Class: Dude::Toggl::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/dude/time_trackers/toggl/base.rb

Direct Known Subclasses

StartTimeEntry, StopTimeEntry

Instance Method Summary collapse

Instance Method Details

#projects_responseObject



15
16
17
# File 'lib/dude/time_trackers/toggl/base.rb', line 15

def projects_response
  toggl_api.get("/api/v8/workspaces/#{Dude::SETTINGS.dig(:toggl, :workspace_id)}/projects")
end

#toggl_apiObject



8
9
10
11
12
13
# File 'lib/dude/time_trackers/toggl/base.rb', line 8

def toggl_api
  Faraday.new('https://api.track.toggl.com') do |conn|
    conn.basic_auth Dude::SETTINGS.dig(:toggl, :token), 'api_token'
    conn.headers['Content-Type'] = 'application/json'
  end
end