Class: Seam::Clients::Workspaces

Inherits:
Object
  • Object
show all
Defined in:
lib/seam/routes/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/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, organization_id: nil, webview_logo_shape: nil, webview_primary_button_color: nil, webview_primary_button_text_color: nil, webview_success_message: nil) ⇒ Seam::Resources::Workspace

Deprecated.

connect_partner_name: Use company_name instead.

Creates a new workspace.

Parameters:

  • name

    Name of the new workspace.

  • company_name (defaults to: nil)

    Company name for the new workspace.

  • connect_partner_name (defaults to: nil)

    Connect partner name for the new workspace.

  • connect_webview_customization (Connect Webview) (defaults to: nil)
  • is_sandbox (defaults to: nil)

    Indicates whether the new workspace is a sandbox workspace.

  • organization_id (defaults to: nil)

    ID of the organization to associate with the new workspace.

  • webview_logo_shape (defaults to: nil)
  • webview_primary_button_color (defaults to: nil)
  • webview_primary_button_text_color (defaults to: nil)
  • webview_success_message (defaults to: nil)

Returns:



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

def create(name:, company_name: nil, connect_partner_name: nil, connect_webview_customization: nil, is_sandbox: nil, organization_id: 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, organization_id: organization_id, 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

#getSeam::Resources::Workspace

Returns the workspace associated with the authentication value.

Returns:



38
39
40
41
42
# File 'lib/seam/routes/workspaces.rb', line 38

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

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

#listSeam::Resources::Workspace

Returns a list of workspaces associated with the authentication value.

Returns:



46
47
48
49
50
# File 'lib/seam/routes/workspaces.rb', line 46

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

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

#reset_sandbox(wait_for_action_attempt: nil) ⇒ Seam::Resources::ActionAttempt

Resets the sandbox workspace associated with the authentication value. Note that this endpoint is only available for sandbox workspaces.

Returns:



54
55
56
57
58
59
60
# File 'lib/seam/routes/workspaces.rb', line 54

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

#update(connect_partner_name: nil, connect_webview_customization: nil, is_publishable_key_auth_enabled: nil, is_suspended: nil, name: nil, organization_id: nil) ⇒ nil

Updates the workspace associated with the authentication value.

Parameters:

  • connect_partner_name (defaults to: nil)

    Connect partner name for the workspace.

  • connect_webview_customization (Connect Webview) (defaults to: nil)
  • is_publishable_key_auth_enabled (defaults to: nil)

    Indicates whether publishable key authentication is enabled for this workspace.

  • is_suspended (defaults to: nil)

    Indicates whether the workspace is suspended.

  • name (defaults to: nil)

    Name of the workspace.

  • organization_id (defaults to: nil)

    ID of the organization to assign the workspace to. The authenticated user must be the owner of the workspace and an admin of the target organization.

Returns:

  • (nil)

    OK



70
71
72
73
74
# File 'lib/seam/routes/workspaces.rb', line 70

def update(connect_partner_name: nil, connect_webview_customization: nil, is_publishable_key_auth_enabled: nil, is_suspended: nil, name: nil, organization_id: nil)
  @client.post("/workspaces/update", {connect_partner_name: connect_partner_name, connect_webview_customization: connect_webview_customization, is_publishable_key_auth_enabled: is_publishable_key_auth_enabled, is_suspended: is_suspended, name: name, organization_id: organization_id}.compact)

  nil
end