Sha256: 3efaa4d5e2fb0f0a6050b8ef8f98a67e9bb9b23164f93b2d4a1f5a3f0289b4c0
Contents?: true
Size: 958 Bytes
Versions: 3
Compression:
Stored size: 958 Bytes
Contents
# frozen_string_literal: true require 'rest-client' require 'active_support/core_ext/hash' module Wso2Toolbox module TokenManager module ApiManagerService class << self def create_token post(config.token_url, build_params) end def refresh_token(token) post(config.refresh_token_url, token: token) end def revoke_token(token) post(config.revoke_token_url, token: token) end private def config @config ||= Wso2Toolbox.configuration end def build_params { user_name: config.token_username, password: config.token_password } end def post(url, params) response = RestClient.post(url, params.to_json, content_type: :json) JSON.parse(response).with_indifferent_access end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems