Module: Code42::API::Token
- Included in:
- Client
- Defined in:
- lib/code42/api/token.rb
Instance Method Summary collapse
- #apply_mlk(mlk, attrs) ⇒ Object
-
#delete_token(token = nil) ⇒ Object
Manually expires a token.
-
#get_login_token ⇒ CrashPlan::Token
Returns LoginToken and ServerUrl.
-
#get_token ⇒ Object
Gets a token for the currently authorized user.
-
#validate_token(token) ⇒ Code42::TokenValidation
Validates an authorization token.
Instance Method Details
#apply_mlk(mlk, attrs) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/code42/api/token.rb', line 11 def apply_mlk(mlk, attrs) settings.mlk = mlk response = object_from_response(Code42::Token, :post, 'authToken', attrs) settings.mlk = nil response end |
#delete_token(token = nil) ⇒ Object
Manually expires a token
33 34 35 36 |
# File 'lib/code42/api/token.rb', line 33 def delete_token(token = nil) token = token || settings.token delete "authToken/#{token.to_s}" end |
#get_login_token ⇒ CrashPlan::Token
Returns LoginToken and ServerUrl
20 21 22 |
# File 'lib/code42/api/token.rb', line 20 def get_login_token object_from_response(Code42::Token, :post, "loginToken") end |
#get_token ⇒ Object
Gets a token for the currently authorized user
7 8 9 |
# File 'lib/code42/api/token.rb', line 7 def get_token object_from_response(Code42::Token, :post, "authToken") end |
#validate_token(token) ⇒ Code42::TokenValidation
Validates an authorization token
27 28 29 |
# File 'lib/code42/api/token.rb', line 27 def validate_token(token) object_from_response(Code42::TokenValidation, :get, "authToken/#{token.to_s}") end |