Module: Wso2Toolbox::TokenManager::ApiManagerService

Defined in:
lib/wso2_toolbox/token_manager/api_manager_service.rb

Class Method Summary collapse

Class Method Details

.build_paramsObject



19
20
21
22
23
24
# File 'lib/wso2_toolbox/token_manager/api_manager_service.rb', line 19

def build_params
  {
    username: config.token_username,
    password: config.token_password
  }
end

.configObject



15
16
17
# File 'lib/wso2_toolbox/token_manager/api_manager_service.rb', line 15

def config
  @config ||= Wso2Toolbox.configuration
end

.create_tokenObject



9
10
11
# File 'lib/wso2_toolbox/token_manager/api_manager_service.rb', line 9

def create_token
  post(build_params)
end

.post(params) ⇒ Object



26
27
28
29
30
# File 'lib/wso2_toolbox/token_manager/api_manager_service.rb', line 26

def post(params)
  response = RestClient.post(config.token_url, params.to_json,
                             content_type: :json)
  JSON.parse(response).with_indifferent_access
end