Class: Doorkeeper::Config::Builder

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

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Builder

Returns a new instance of Builder.



34
35
36
37
# File 'lib/doorkeeper/config.rb', line 34

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

Instance Method Details

#access_token_methods(*methods) ⇒ Object



64
65
66
# File 'lib/doorkeeper/config.rb', line 64

def access_token_methods(*methods)
  @config.instance_variable_set("@access_token_methods", methods)
end

#buildObject



39
40
41
# File 'lib/doorkeeper/config.rb', line 39

def build
  @config
end

#client_credentials(*methods) ⇒ Object



60
61
62
# File 'lib/doorkeeper/config.rb', line 60

def client_credentials(*methods)
  @config.instance_variable_set("@client_credentials", methods)
end

#confirm_application_ownerObject



48
49
50
# File 'lib/doorkeeper/config.rb', line 48

def confirm_application_owner
  @config.instance_variable_set("@confirm_application_owner", true)
end

#default_scopes(*scopes) ⇒ Object



52
53
54
# File 'lib/doorkeeper/config.rb', line 52

def default_scopes(*scopes)
  @config.instance_variable_set("@default_scopes", Doorkeeper::OAuth::Scopes.from_array(scopes))
end

#enable_application_owner(opts = {}) ⇒ Object



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

def enable_application_owner(opts={})
  @config.instance_variable_set("@enable_application_owner", true)
  confirm_application_owner if opts[:confirmation].present? && opts[:confirmation]
end

#optional_scopes(*scopes) ⇒ Object



56
57
58
# File 'lib/doorkeeper/config.rb', line 56

def optional_scopes(*scopes)
  @config.instance_variable_set("@optional_scopes", Doorkeeper::OAuth::Scopes.from_array(scopes))
end

#use_refresh_tokenObject



68
69
70
# File 'lib/doorkeeper/config.rb', line 68

def use_refresh_token
  @config.instance_variable_set("@refresh_token_enabled", true)
end