class Harvest::Client

Constants

BASE_URL

Attributes

connection[R]

Public Class Methods

new(access_token: nil, account_id: nil, user_agent: nil) click to toggle source
# File lib/harvest/client.rb, line 13
def initialize access_token: nil, account_id: nil, user_agent: nil
  @connection = Faraday.new(url: BASE_URL) do |conn|
    conn.request :json
    conn.request :oauth2, access_token, token_type: :bearer

    conn.headers = {
      'Harvest-Account-Id' => account_id,
      'User-Agent' => user_agent
    }

    conn.response :json, :content_type => /\bjson$/

    conn.adapter Faraday.default_adapter
  end
end