class TogglBillable::Client

Public Class Methods

api_base() click to toggle source
# File lib/toggl_billable/client.rb, line 11
def self.api_base
  'https://www.toggl.com/api/v8'
end
api_get(end_point) click to toggle source
# File lib/toggl_billable/client.rb, line 23
def self.api_get(end_point)
  connection.get("#{api_base}/#{end_point}")
end
connection() click to toggle source
# File lib/toggl_billable/client.rb, line 19
def self.connection
  @connection
end
report_get(end_point) click to toggle source
# File lib/toggl_billable/client.rb, line 27
def self.report_get(end_point)
  connection.get("#{reports_base}/#{end_point}")
end
reports_base() click to toggle source
# File lib/toggl_billable/client.rb, line 15
def self.reports_base
  'https://toggl.com/reports/api/v2'
end
start(api_token) click to toggle source
# File lib/toggl_billable/client.rb, line 3
def self.start(api_token)
  @connection = Faraday.new(url: 'https://www.toggle.com') do |faraday|
    faraday.use Faraday::Request::BasicAuthentication, api_token, 'api_token'
    faraday.request :url_encoded
    faraday.adapter Faraday.default_adapter
  end
end