Class: Harvest::BasicAuthCredentials

Inherits:
Object
  • Object
show all
Defined in:
lib/harvest/credentials.rb

Instance Method Summary collapse

Constructor Details

#initialize(access_token: nil, account_id: nil) ⇒ BasicAuthCredentials

Returns a new instance of BasicAuthCredentials.



3
4
5
6
# File 'lib/harvest/credentials.rb', line 3

def initialize(access_token: nil, account_id: nil)
  @access_token = access_token
  @account_id = 
end

Instance Method Details

#hostObject



14
15
16
# File 'lib/harvest/credentials.rb', line 14

def host
  'https://api.harvestapp.com/v2'
end

#set_authentication(request_options) ⇒ Object



8
9
10
11
12
# File 'lib/harvest/credentials.rb', line 8

def set_authentication(request_options)
  request_options[:headers] ||= {}
  request_options[:headers]['Authorization'] = "Bearer #{@access_token}"
  request_options[:headers]['Harvest-Account-ID'] = @account_id
end