Class: IMS::LTI::Services::OAuth2Client
- Inherits:
-
Object
- Object
- IMS::LTI::Services::OAuth2Client
- Defined in:
- lib/ims/lti/services/oauth2_client.rb
Instance Attribute Summary collapse
-
#base_url ⇒ Object
Returns the value of attribute base_url.
- #connection ⇒ Object
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
-
#initialize(token:, base_url: nil) ⇒ OAuth2Client
constructor
A new instance of OAuth2Client.
Constructor Details
#initialize(token:, base_url: nil) ⇒ OAuth2Client
Returns a new instance of OAuth2Client.
7 8 9 10 |
# File 'lib/ims/lti/services/oauth2_client.rb', line 7 def initialize(token:, base_url: nil) @base_url = base_url @token = token end |
Instance Attribute Details
#base_url ⇒ Object
Returns the value of attribute base_url.
4 5 6 |
# File 'lib/ims/lti/services/oauth2_client.rb', line 4 def base_url @base_url end |
#connection ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/ims/lti/services/oauth2_client.rb', line 12 def connection @connection ||= Faraday.new base_url do |conn| if Gem::Version.new(Faraday::VERSION) < Gem::Version.new('1.0') conn. :Bearer, token else conn.request :authorization, 'Bearer', token end end end |
#token ⇒ Object
Returns the value of attribute token.
4 5 6 |
# File 'lib/ims/lti/services/oauth2_client.rb', line 4 def token @token end |