class Forecast::OAuthCredentials

# def basic_auth
#   Base64.encode64("#{@username}:#{@password}").delete("\r\n")
# end

end

Public Class Methods

new(ops={}) click to toggle source
# File lib/forecast/credentials.rb, line 26
def initialize(ops={})
  @access_token = ops[:access_token] || nil
  @forecast_account_id = ops[:forecast_account_id] || nil
end

Public Instance Methods

host() click to toggle source
# File lib/forecast/credentials.rb, line 38
def host
  "https://api.forecastapp.com"
end
set_authentication(request_options) click to toggle source
# File lib/forecast/credentials.rb, line 31
def set_authentication(request_options)
  request_options[:headers] ||= {}
  request_options[:headers]['Forecast-Account-Id'] = @forecast_account_id
  request_options[:headers]['Authorization'] = "Bearer #{@access_token}"
  request_options[:headers]['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36'
end