Class: Harvest::BasicAuthCredentials

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

Instance Method Summary collapse

Constructor Details

#initialize(subdomain: nil, username: nil, password: nil) ⇒ BasicAuthCredentials

Returns a new instance of BasicAuthCredentials



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

def initialize(subdomain: nil, username: nil, password: nil)
  @subdomain, @username, @password = subdomain, username, password
end

Instance Method Details

#hostObject



12
13
14
# File 'lib/harvest/credentials.rb', line 12

def host
  "https://#{@subdomain}.harvestapp.com"
end

#set_authentication(request_options) ⇒ Object



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

def set_authentication(request_options)
  request_options[:headers] ||= {}
  request_options[:headers]["Authorization"] = "Basic #{basic_auth}"
end