Class: AuthProvider::Config::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/auth_provider/config.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Builder

Returns a new instance of Builder.



27
28
29
30
31
32
33
34
35
# File 'lib/auth_provider/config.rb', line 27

def initialize(&block)
  @config = Config.new

  instance_eval(&block)

  # Define default
  @config.default_resource_owner_type ||= 'User'
  @config.access_token_expiration_time ||= 2.hours
end

Instance Method Details

#access_token_expires_in(time) ⇒ Object



51
52
53
# File 'lib/auth_provider/config.rb', line 51

def access_token_expires_in(time)
  @config.access_token_expiration_time = time
end

#buildObject



37
38
39
# File 'lib/auth_provider/config.rb', line 37

def build
  @config
end

#default_resource_owner_type(type) ⇒ Object

Configuration methods



43
44
45
# File 'lib/auth_provider/config.rb', line 43

def default_resource_owner_type(type)
  @config.default_resource_owner_type = type.to_s
end

#resource_owner_from_credentials(&block) ⇒ Object



47
48
49
# File 'lib/auth_provider/config.rb', line 47

def resource_owner_from_credentials(&block)
  @config.resource_owner_from_credentials = block
end