Class: IBM::Cloud::SDK::IAM
- Inherits:
-
BaseService
- Object
- BaseService
- IBM::Cloud::SDK::IAM
- Defined in:
- lib/ibm/cloud/sdk/iam.rb,
lib/ibm/cloud/sdk/iam/token.rb
Defined Under Namespace
Classes: Token
Instance Method Summary collapse
- #endpoint ⇒ Object
- #get_identity_token ⇒ Object
-
#initialize(api_key) ⇒ IAM
constructor
A new instance of IAM.
Methods inherited from BaseService
#delete, endpoint, #get, #post
Constructor Details
#initialize(api_key) ⇒ IAM
Returns a new instance of IAM.
9 10 11 |
# File 'lib/ibm/cloud/sdk/iam.rb', line 9 def initialize(api_key) @api_key = api_key end |
Instance Method Details
#endpoint ⇒ Object
5 6 7 |
# File 'lib/ibm/cloud/sdk/iam.rb', line 5 def endpoint "https://iam.cloud.ibm.com".freeze end |
#get_identity_token ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ibm/cloud/sdk/iam.rb', line 13 def get_identity_token payload = { :grant_type => "urn:ibm:params:oauth:grant-type:apikey", :apikey => api_key } result = post("identity/token", payload) require "ibm/cloud/sdk/iam/token" Token.new(*result.values_at("token_type", "access_token")) end |