Class: Seatsio::WorkspacesClient
- Inherits:
-
Object
- Object
- Seatsio::WorkspacesClient
- Defined in:
- lib/seatsio/workspaces.rb
Instance Method Summary collapse
- #activate(key:) ⇒ Object
- #active(filter: nil) ⇒ Object
- #add_secret_key(key:) ⇒ Object
- #create(name:, is_test: nil) ⇒ Object
- #deactivate(key:) ⇒ Object
- #delete(key:) ⇒ Object
- #inactive(filter: nil) ⇒ Object
-
#initialize(http_client) ⇒ WorkspacesClient
constructor
A new instance of WorkspacesClient.
- #list(filter: nil) ⇒ Object
- #regenerate_secret_key(key:) ⇒ Object
- #remove_secret_key(key:, secret_key_to_remove:) ⇒ Object
- #retrieve(key:) ⇒ Object
- #set_default(key:) ⇒ Object
- #update(key:, name:) ⇒ Object
Constructor Details
#initialize(http_client) ⇒ WorkspacesClient
Returns a new instance of WorkspacesClient.
11 12 13 |
# File 'lib/seatsio/workspaces.rb', line 11 def initialize(http_client) @http_client = http_client end |
Instance Method Details
#activate(key:) ⇒ Object
45 46 47 |
# File 'lib/seatsio/workspaces.rb', line 45 def activate(key:) @http_client.post("workspaces/#{key}/actions/activate") end |
#active(filter: nil) ⇒ Object
67 68 69 70 71 |
# File 'lib/seatsio/workspaces.rb', line 67 def active(filter: nil) extended_cursor = Pagination::Cursor.new(Workspace, 'workspaces/active', @http_client) extended_cursor.set_query_param('filter', filter) extended_cursor end |
#add_secret_key(key:) ⇒ Object
36 37 38 39 |
# File 'lib/seatsio/workspaces.rb', line 36 def add_secret_key(key:) response = @http_client.post("workspaces/#{key}/actions/add-secret-key") response['secretKey'] end |
#create(name:, is_test: nil) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/seatsio/workspaces.rb', line 15 def create(name:, is_test: nil) body = {} body['name'] = name body['isTest'] = is_test if is_test response = @http_client.post("workspaces", body) Workspace.new(response) end |
#deactivate(key:) ⇒ Object
49 50 51 |
# File 'lib/seatsio/workspaces.rb', line 49 def deactivate(key:) @http_client.post("workspaces/#{key}/actions/deactivate") end |
#delete(key:) ⇒ Object
53 54 55 |
# File 'lib/seatsio/workspaces.rb', line 53 def delete(key:) @http_client.delete("workspaces/#{key}") end |
#inactive(filter: nil) ⇒ Object
73 74 75 76 77 |
# File 'lib/seatsio/workspaces.rb', line 73 def inactive(filter: nil) extended_cursor = Pagination::Cursor.new(Workspace, 'workspaces/inactive', @http_client) extended_cursor.set_query_param('filter', filter) extended_cursor end |
#list(filter: nil) ⇒ Object
61 62 63 64 65 |
# File 'lib/seatsio/workspaces.rb', line 61 def list(filter: nil) extended_cursor = cursor extended_cursor.set_query_param('filter', filter) extended_cursor end |
#regenerate_secret_key(key:) ⇒ Object
30 31 32 33 34 |
# File 'lib/seatsio/workspaces.rb', line 30 def regenerate_secret_key(key:) warn "[DEPRECATION] `regenerate_secret_key` is deprecated. Use `add_secret_key` and `remove_secret_key` instead." response = @http_client.post("workspaces/#{key}/actions/regenerate-secret-key") response['secretKey'] end |
#remove_secret_key(key:, secret_key_to_remove:) ⇒ Object
41 42 43 |
# File 'lib/seatsio/workspaces.rb', line 41 def remove_secret_key(key:, secret_key_to_remove:) @http_client.post("workspaces/#{key}/actions/remove-secret-key", {secretKey: secret_key_to_remove}) end |
#retrieve(key:) ⇒ Object
79 80 81 82 |
# File 'lib/seatsio/workspaces.rb', line 79 def retrieve(key:) response = @http_client.get("workspaces/#{key}") Workspace.new(response) end |
#set_default(key:) ⇒ Object
57 58 59 |
# File 'lib/seatsio/workspaces.rb', line 57 def set_default(key:) @http_client.post("workspaces/actions/set-default/#{key}") end |
#update(key:, name:) ⇒ Object
24 25 26 27 28 |
# File 'lib/seatsio/workspaces.rb', line 24 def update(key:, name:) body = {} body['name'] = name @http_client.post("workspaces/#{key}", body) end |