class AuthRocket::AuthProvider

Attributes

auth_url[R]
authorization_url[RW]
client_id[RW]
email_field[RW]
loginrocket_domain[R]
min_complexity[RW]
name[RW]

Public Class Methods

authorize(attribs={}) click to toggle source

attribs - :code - required

- :nonce - optional
- :state - required

returns: Session always returns a new object; check .errors? or .valid? to see how it went

# File lib/authrocket/auth_provider.rb, line 63
def authorize(attribs={})
  params = parse_request_params(attribs)
  parsed, creds = request(:post, resource_path+'/authorize', params)
  factory(parsed, creds)
end
authorize_url(auth_provider_id, attribs={}) click to toggle source

attribs - :redirect_uri - required

- :nonce        - optional

returns: simplified AuthProvider

# File lib/authrocket/auth_provider.rb, line 51
def authorize_url(auth_provider_id, attribs={})
  params = parse_request_params(attribs)
  parsed, creds = request(:get, resource_path+"/#{CGI.escape auth_provider_id}/authorize", params)
  raise QueryError, parsed[:errors] if parsed[:errors].any?
  factory(parsed, creds)
end
authorize_urls(attribs={}) click to toggle source

attribs - :redirect_uri - required

- :nonce        - optional

returns: Array of simplified AuthProviders

# File lib/authrocket/auth_provider.rb, line 36
def authorize_urls(attribs={})
  params = parse_request_params(attribs)
  parsed, creds = request(:get, resource_path+'/authorize', params)
  raise QueryError, parsed[:errors] if parsed[:errors].any?
  NCore::Collection.new.tap do |coll|
    coll.metadata = parsed[:metadata]
    parsed[:data].each do |hash|
      coll << factory({data: hash, metadata: parsed[:metadata]}, creds)
    end
  end
end

Public Instance Methods

authorize_token(attribs={}) click to toggle source

attribs - :access_token - required returns: Session always returns a new object; check .errors? or .valid? to see how it went

# File lib/authrocket/auth_provider.rb, line 24
def authorize_token(attribs={})
  params = parse_request_params(attribs)
  parsed, creds = request(:post, resource_path+'/authorize', params)
  self.class.factory(parsed, creds)
end
authorize_url(attribs={}) click to toggle source

same as self.authorize_url(self.id, …)

# File lib/authrocket/auth_provider.rb, line 17
def authorize_url(attribs={})
  self.class.authorize_url id, attribs.reverse_merge(credentials: api_creds)
end