Class: Seatsio::WorkspacesClient

Inherits:
Object
  • Object
show all
Defined in:
lib/seatsio/workspaces.rb

Instance Method Summary collapse

Constructor Details

#initialize(secret_key, base_url) ⇒ WorkspacesClient

Returns a new instance of WorkspacesClient.



11
12
13
# File 'lib/seatsio/workspaces.rb', line 11

def initialize(secret_key, base_url)
  @http_client = ::Seatsio::HttpClient.new(secret_key, nil, base_url)
end

Instance Method Details

#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)
  Domain::Workspace.new(response)
end

#list(filter: nil) ⇒ Object



30
31
32
33
34
# File 'lib/seatsio/workspaces.rb', line 30

def list(filter: nil)
  extended_cursor = cursor
  extended_cursor.set_query_param('filter', filter)
  extended_cursor
end

#retrieve(key:) ⇒ Object



36
37
38
39
# File 'lib/seatsio/workspaces.rb', line 36

def retrieve(key:)
  response = @http_client.get("/workspaces/#{key}")
  Domain::Workspace.new(response)
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