Class: DoList::AuthToken

Inherits:
Object
  • Object
show all
Defined in:
lib/do-list/auth_token.rb

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ AuthToken

Returns a new instance of AuthToken.



5
6
7
8
9
10
11
12
# File 'lib/do-list/auth_token.rb', line 5

def initialize(params = {})
  @headers = params[:headers]
  @account_id = params[:account_id]
  @api_key = params[:api_key]
  @uri = DoList::UrlParser.parse_url(params[:url])
  @http = DoList::UrlParser.request_http(@uri)
  @auth_key, @auth_depr_date = request_auth_key
end

Instance Method Details

#auth_keyObject



14
15
16
17
# File 'lib/do-list/auth_token.rb', line 14

def auth_key
  @auth_key, @auth_depr_date = request_auth_key if (DateTime.now + (1 / 24.0)) > @auth_depr_date
  @auth_key
end