Class: Seam::Clients::Workspaces

Inherits:
Object
  • Object
show all
Defined in:
lib/seam/routes/clients/workspaces.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:, defaults:) ⇒ Workspaces

Returns a new instance of Workspaces.



8
9
10
11
# File 'lib/seam/routes/clients/workspaces.rb', line 8

def initialize(client:, defaults:)
  @client = client
  @defaults = defaults
end

Instance Method Details

#create(name:, company_name: nil, connect_partner_name: nil, connect_webview_customization: nil, is_sandbox: nil, webview_logo_shape: nil, webview_primary_button_color: nil, webview_primary_button_text_color: nil, webview_success_message: nil) ⇒ Object



13
14
15
16
17
# File 'lib/seam/routes/clients/workspaces.rb', line 13

def create(name:, company_name: nil, connect_partner_name: nil, connect_webview_customization: nil, is_sandbox: nil, webview_logo_shape: nil, webview_primary_button_color: nil, webview_primary_button_text_color: nil, webview_success_message: nil)
  res = @client.post("/workspaces/create", {name: name, company_name: company_name, connect_partner_name: connect_partner_name, connect_webview_customization: connect_webview_customization, is_sandbox: is_sandbox, webview_logo_shape: webview_logo_shape, webview_primary_button_color: webview_primary_button_color, webview_primary_button_text_color: webview_primary_button_text_color, webview_success_message: webview_success_message}.compact)

  Seam::Resources::Workspace.load_from_response(res.body["workspace"])
end

#getObject



19
20
21
22
23
# File 'lib/seam/routes/clients/workspaces.rb', line 19

def get
  res = @client.post("/workspaces/get")

  Seam::Resources::Workspace.load_from_response(res.body["workspace"])
end

#listObject



25
26
27
28
29
# File 'lib/seam/routes/clients/workspaces.rb', line 25

def list
  res = @client.post("/workspaces/list")

  Seam::Resources::Workspace.load_from_response(res.body["workspaces"])
end

#reset_sandbox(wait_for_action_attempt: nil) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/seam/routes/clients/workspaces.rb', line 31

def reset_sandbox(wait_for_action_attempt: nil)
  res = @client.post("/workspaces/reset_sandbox")

  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt

  Helpers::ActionAttempt.decide_and_wait(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
end