Class: Bytom::AccessToken
- Inherits:
-
Object
- Object
- Bytom::AccessToken
- Defined in:
- lib/bytom/api/access_token.rb
Instance Method Summary collapse
-
#check_access_token(id:, secret:) ⇒ Object
Check access token is valid.
-
#create_access_token(id:, type: nil) ⇒ Object
Create access token, it provides basic access authentication for HTTP protocol, returns token contain username and password, they are separated by a colon.
-
#delete_access_token(id:) ⇒ Object
Delete existed access token.
-
#initialize(client) ⇒ AccessToken
constructor
A new instance of AccessToken.
-
#list_access_tokens ⇒ Object
Returns the list of all available access tokens.
Constructor Details
#initialize(client) ⇒ AccessToken
Returns a new instance of AccessToken.
6 7 8 |
# File 'lib/bytom/api/access_token.rb', line 6 def initialize(client) @client = client end |
Instance Method Details
#check_access_token(id:, secret:) ⇒ Object
Check access token is valid.
47 48 49 50 51 52 53 |
# File 'lib/bytom/api/access_token.rb', line 47 def check_access_token(id: , secret:) params = { id: id, secret: secret } client.make_request('/check-access-token', 'post', params: params) end |
#create_access_token(id:, type: nil) ⇒ Object
Create access token, it provides basic access authentication for HTTP protocol, returns token contain username and password, they are separated by a colon.
17 18 19 20 21 22 23 |
# File 'lib/bytom/api/access_token.rb', line 17 def create_access_token(id:, type: nil) params = { id: id, type: type } client.make_request('/create-access-token', 'post', params: params) end |
#delete_access_token(id:) ⇒ Object
Delete existed access token.
37 38 39 |
# File 'lib/bytom/api/access_token.rb', line 37 def delete_access_token(id:) client.make_request('/delete-access-token', 'post', params: {id: id}) end |
#list_access_tokens ⇒ Object
Returns the list of all available access tokens.
28 29 30 |
# File 'lib/bytom/api/access_token.rb', line 28 def list_access_tokens client.make_request('/list-access-tokens', 'post', params: {}) end |