Method: Misty::Auth#initialize
- Defined in:
- lib/misty/auth.rb
#initialize(auth, config) ⇒ Auth
Returns a new instance of Auth.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/misty/auth.rb', line 25 def initialize(auth, config) if auth[:context] # bypass the authentication by given token catalog and expire date @token = auth[:context][:token] @catalog = auth[:context][:catalog] @expires = auth[:context][:expires] else raise URLError, 'No URL provided' if auth[:url].nil? || auth[:url].empty? @uri = URI.parse(auth[:url]) @config = config @credentials = set_credentials(auth) @token, @catalog, @expires = set(authenticate) end end |