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
- #create(name:, is_test: nil) ⇒ Object
- #deactivate(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
- #retrieve(key:) ⇒ Object
- #set_default(key:) ⇒ Object
- #update(key:, name:) ⇒ Object
Constructor Details
#initialize(http_client) ⇒ WorkspacesClient
Returns a new instance of WorkspacesClient.
12 13 14 |
# File 'lib/seatsio/workspaces.rb', line 12 def initialize(http_client) @http_client = http_client end |
Instance Method Details
#activate(key:) ⇒ Object
36 37 38 |
# File 'lib/seatsio/workspaces.rb', line 36 def activate(key:) @http_client.post("workspaces/#{key}/actions/activate") end |
#active(filter: nil) ⇒ Object
54 55 56 57 58 |
# File 'lib/seatsio/workspaces.rb', line 54 def active(filter: nil) extended_cursor = Pagination::Cursor.new(Workspace, 'workspaces/active', @http_client) extended_cursor.set_query_param('filter', filter) extended_cursor end |
#create(name:, is_test: nil) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/seatsio/workspaces.rb', line 16 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
40 41 42 |
# File 'lib/seatsio/workspaces.rb', line 40 def deactivate(key:) @http_client.post("workspaces/#{key}/actions/deactivate") end |
#inactive(filter: nil) ⇒ Object
60 61 62 63 64 |
# File 'lib/seatsio/workspaces.rb', line 60 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
48 49 50 51 52 |
# File 'lib/seatsio/workspaces.rb', line 48 def list(filter: nil) extended_cursor = cursor extended_cursor.set_query_param('filter', filter) extended_cursor end |
#regenerate_secret_key(key:) ⇒ Object
31 32 33 34 |
# File 'lib/seatsio/workspaces.rb', line 31 def regenerate_secret_key(key:) response = @http_client.post("workspaces/#{key}/actions/regenerate-secret-key") response['secretKey'] end |
#retrieve(key:) ⇒ Object
66 67 68 69 |
# File 'lib/seatsio/workspaces.rb', line 66 def retrieve(key:) response = @http_client.get("/workspaces/#{key}") Workspace.new(response) end |
#set_default(key:) ⇒ Object
44 45 46 |
# File 'lib/seatsio/workspaces.rb', line 44 def set_default(key:) @http_client.post("workspaces/actions/set-default/#{key}") end |
#update(key:, name:) ⇒ Object
25 26 27 28 29 |
# File 'lib/seatsio/workspaces.rb', line 25 def update(key:, name:) body = {} body['name'] = name @http_client.post("workspaces/#{key}", body) end |