Module: Auth0::Mixins::Initializer

Included in:
Auth0::Mixins
Defined in:
lib/auth0/mixins/initializer.rb

Overview

Help class where Auth0::Client initialization described

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object

including initializer in top of klass



20
21
22
# File 'lib/auth0/mixins/initializer.rb', line 20

def self.included(klass)
  klass.send :prepend, Initializer
end

Instance Method Details

#initialize(config) ⇒ Object

Default initialization mechanism, moved here to keep Auth0::Client clear accepts hash as parameter you can get all required fields from here: auth0.com/docs/auth-api

By Default API v2



10
11
12
13
14
15
16
17
# File 'lib/auth0/mixins/initializer.rb', line 10

def initialize(config)
  options = Hash[config.map { |(k, v)| [k.to_sym, v] }]
  self.class.base_uri base_url(options)
  self.class.headers client_headers(config)
  extend Auth0::Api::AuthenticationEndpoints
  @client_id = options[:client_id]
  initialize_api(options)
end