Class: Seatsio::WorkspacesClient

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

Instance Method Summary collapse

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



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

def activate(key:)
  @http_client.post("workspaces/#{key}/actions/activate")
end

#active(filter: nil) ⇒ Object



53
54
55
56
57
# File 'lib/seatsio/workspaces.rb', line 53

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



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



39
40
41
# File 'lib/seatsio/workspaces.rb', line 39

def deactivate(key:)
  @http_client.post("workspaces/#{key}/actions/deactivate")
end

#inactive(filter: nil) ⇒ Object



59
60
61
62
63
# File 'lib/seatsio/workspaces.rb', line 59

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



47
48
49
50
51
# File 'lib/seatsio/workspaces.rb', line 47

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
# File 'lib/seatsio/workspaces.rb', line 30

def regenerate_secret_key(key:)
  response = @http_client.post("workspaces/#{key}/actions/regenerate-secret-key")
  response['secretKey']
end

#retrieve(key:) ⇒ Object



65
66
67
68
# File 'lib/seatsio/workspaces.rb', line 65

def retrieve(key:)
  response = @http_client.get("workspaces/#{key}")
  Workspace.new(response)
end

#set_default(key:) ⇒ Object



43
44
45
# File 'lib/seatsio/workspaces.rb', line 43

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