Class: OAuth2Params

Inherits:
Object
  • Object
show all
Defined in:
lib/brine/requester.rb

Overview

Parameter object used to configure OAuth2 middleware Also used to provide basic DSL for configuration

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOAuth2Params

Returns a new instance of OAuth2Params.



11
12
13
# File 'lib/brine/requester.rb', line 11

def initialize
  @token_type = 'bearer'
end

Instance Attribute Details

#tokenObject

Returns the value of attribute token.



9
10
11
# File 'lib/brine/requester.rb', line 9

def token
  @token
end

#token_typeObject

Returns the value of attribute token_type.



9
10
11
# File 'lib/brine/requester.rb', line 9

def token_type
  @token_type
end

Instance Method Details

#fetch_from(id, secret, opts) ⇒ Object



15
16
17
18
# File 'lib/brine/requester.rb', line 15

def fetch_from(id, secret, opts)
  @token = OAuth2::Client.new(id, secret, opts)
    .client_credentials.get_token.token
end