Method: HaveAPI::Client::Communicator#authenticate

Defined in:
lib/haveapi/client/communicator.rb

#authenticate(auth_method, options = {}, &block) ⇒ Object

Authenticate user with selected auth_method. auth_method is a name of registered authentication provider. options are specific for each authentication provider.



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/haveapi/client/communicator.rb', line 44

def authenticate(auth_method, options = {}, &block)
  desc = describe_api(@version)

  @auth = self.class.auth_methods[auth_method].new(
    self,
    desc[:authentication][auth_method],
    options,
    &block
  )
  @rest = @auth.resource || @rest
end