class Harvest::BasicAuthCredentials
Public Class Methods
new(subdomain: nil, username: nil, password: nil)
click to toggle source
# File lib/harvest/credentials.rb, line 3 def initialize(subdomain: nil, username: nil, password: nil) @subdomain, @username, @password = subdomain, username, password end
Public Instance Methods
host()
click to toggle source
# File lib/harvest/credentials.rb, line 12 def host "https://#{@subdomain}.harvestapp.com" end
set_authentication(request_options)
click to toggle source
# File lib/harvest/credentials.rb, line 7 def set_authentication(request_options) request_options[:headers] ||= {} request_options[:headers]["Authorization"] = "Basic #{basic_auth}" end
Private Instance Methods
basic_auth()
click to toggle source
# File lib/harvest/credentials.rb, line 18 def basic_auth Base64.encode64("#{@username}:#{@password}").delete("\r\n") end