Class: Forecast::OAuthCredentials
- Inherits:
-
Object
- Object
- Forecast::OAuthCredentials
- Defined in:
- lib/forecast/credentials.rb
Overview
# def basic_auth
# Base64.encode64("#{@username}:#{@password}").delete("\r\n")
# end
end
Instance Method Summary collapse
- #host ⇒ Object
-
#initialize(ops = {}) ⇒ OAuthCredentials
constructor
A new instance of OAuthCredentials.
- #set_authentication(request_options) ⇒ Object
Constructor Details
#initialize(ops = {}) ⇒ OAuthCredentials
Returns a new instance of OAuthCredentials.
26 27 28 29 |
# 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 |
Instance Method Details
#host ⇒ Object
38 39 40 |
# File 'lib/forecast/credentials.rb', line 38 def host "https://api.forecastapp.com" end |
#set_authentication(request_options) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/forecast/credentials.rb', line 31 def set_authentication() [:headers] ||= {} [:headers]['Forecast-Account-Id'] = @forecast_account_id [:headers]['Authorization'] = "Bearer #{@access_token}" [: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 |