Class: OAuth2c::TwoLegged::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/oauth2c/two_legged.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(agent, scope: []) ⇒ Base

Returns a new instance of Base.



22
23
24
25
# File 'lib/oauth2c/two_legged.rb', line 22

def initialize(agent, scope: [])
  @agent = agent
  update_scope(scope)
end

Instance Attribute Details

#scopeObject (readonly)

Returns the value of attribute scope.



20
21
22
# File 'lib/oauth2c/two_legged.rb', line 20

def scope
  @scope
end

Instance Method Details

#tokenObject



31
32
33
34
# File 'lib/oauth2c/two_legged.rb', line 31

def token
  ok, response = @agent.token(**token_params, scope: @scope)
  handle_token_response(ok, response)
end

#update_scope(scope) ⇒ Object



27
28
29
# File 'lib/oauth2c/two_legged.rb', line 27

def update_scope(scope)
  @scope = scope.dup.freeze
end