Class: Makeleaps::Request::BasicAuth
- Includes:
- ErrorHandler
- Defined in:
- lib/makeleaps/request/basic_auth.rb
Constant Summary collapse
- AUTH_ENDPOINT =
'user/oauth2/token/'
Constants inherited from Base
Makeleaps::Request::Base::ENDPOINT
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(username, password) ⇒ BasicAuth
constructor
A new instance of BasicAuth.
- #make_request! ⇒ Object
Methods included from ErrorHandler
Constructor Details
#initialize(username, password) ⇒ BasicAuth
Returns a new instance of BasicAuth.
10 11 12 13 14 |
# File 'lib/makeleaps/request/basic_auth.rb', line 10 def initialize(username, password) super() do |conn| conn.basic_auth(username, password) end end |
Instance Method Details
#make_request! ⇒ Object
16 17 18 19 20 21 |
# File 'lib/makeleaps/request/basic_auth.rb', line 16 def make_request! response = handle_api_response do connection.post(AUTH_ENDPOINT) { |req| req.params['grant_type'] = 'client_credentials'} end Makeleaps::Response::TokenStore.new response end |