class Makeleaps::Request::BasicAuth

Constants

AUTH_ENDPOINT
REVOCATKON_ENDPOINT

Public Class Methods

new(username, password) click to toggle source
Calls superclass method Makeleaps::Request::Base::new
# File lib/makeleaps/request/basic_auth.rb, line 11
def initialize(username, password)
  super() do |conn|
    conn.basic_auth(username, password)
  end
end

Public Instance Methods

authenticate!() click to toggle source
# File lib/makeleaps/request/basic_auth.rb, line 17
def authenticate!
  response = handle_api_response do
    connection.post(AUTH_ENDPOINT) { |req| req.params['grant_type'] = 'client_credentials' }
  end
  Makeleaps::Response::TokenStore.new response
end
revoke!(token) click to toggle source
# File lib/makeleaps/request/basic_auth.rb, line 24
def revoke!(token)
  handle_api_response do
    connection.post(REVOCATKON_ENDPOINT) { |req| req.params['token'] = token }
  end
end