Class: TerminalShop::Resources::Token
- Inherits:
-
Object
- Object
- TerminalShop::Resources::Token
- Defined in:
- lib/terminal_shop/resources/token.rb
Instance Method Summary collapse
-
#create(request_options: {}) ⇒ TerminalShop::Models::TokenCreateResponse
Create a personal access token.
-
#delete(id, request_options: {}) ⇒ TerminalShop::Models::TokenDeleteResponse
Delete the personal access token with the given ID.
-
#get(id, request_options: {}) ⇒ TerminalShop::Models::TokenGetResponse
Get the personal access token with the given ID.
-
#initialize(client:) ⇒ Token
constructor
private
A new instance of Token.
-
#list(request_options: {}) ⇒ TerminalShop::Models::TokenListResponse
List the current user’s personal access tokens.
Constructor Details
#initialize(client:) ⇒ Token
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Token.
85 86 87 |
# File 'lib/terminal_shop/resources/token.rb', line 85 def initialize(client:) @client = client end |
Instance Method Details
#create(request_options: {}) ⇒ TerminalShop::Models::TokenCreateResponse
Create a personal access token.
15 16 17 18 19 20 21 22 |
# File 'lib/terminal_shop/resources/token.rb', line 15 def create(params = {}) @client.request( method: :post, path: "token", model: TerminalShop::Models::TokenCreateResponse, options: params[:request_options] ) end |
#delete(id, request_options: {}) ⇒ TerminalShop::Models::TokenDeleteResponse
Delete the personal access token with the given ID.
53 54 55 56 57 58 59 60 |
# File 'lib/terminal_shop/resources/token.rb', line 53 def delete(id, params = {}) @client.request( method: :delete, path: ["token/%1$s", id], model: TerminalShop::Models::TokenDeleteResponse, options: params[:request_options] ) end |
#get(id, request_options: {}) ⇒ TerminalShop::Models::TokenGetResponse
Get the personal access token with the given ID.
73 74 75 76 77 78 79 80 |
# File 'lib/terminal_shop/resources/token.rb', line 73 def get(id, params = {}) @client.request( method: :get, path: ["token/%1$s", id], model: TerminalShop::Models::TokenGetResponse, options: params[:request_options] ) end |
#list(request_options: {}) ⇒ TerminalShop::Models::TokenListResponse
List the current user’s personal access tokens.
33 34 35 36 37 38 39 40 |
# File 'lib/terminal_shop/resources/token.rb', line 33 def list(params = {}) @client.request( method: :get, path: "token", model: TerminalShop::Models::TokenListResponse, options: params[:request_options] ) end |