Class: Basecamp::Services::ToolsService

Inherits:
BaseService show all
Defined in:
lib/basecamp/generated/services/tools_service.rb

Overview

Service for Tools operations

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from Basecamp::Services::BaseService

Instance Method Details

#create(bucket_id:, tool_type:, title: nil) ⇒ Hash

Create a tool in a project dock

Parameters:

  • bucket_id (Integer)

    bucket id ID

  • tool_type (String)

    Tool type to add to the project dock. Values: Chat::Transcript|Inbox|Kanban::Board|Message::Board|Questionnaire|Schedule|Todoset|Vault.

  • title (String, nil) (defaults to: nil)

    Title for the new tool. When omitted, Basecamp assigns the next available default title for the tool type.

Returns:

  • (Hash)

    response data



15
16
17
18
19
# File 'lib/basecamp/generated/services/tools_service.rb', line 15

def create(bucket_id:, tool_type:, title: nil)
  with_operation(service: "tools", operation: "create", is_mutation: true, project_id: bucket_id) do
    http_post("/buckets/#{bucket_id}/dock/tools.json", body: compact_params(tool_type: tool_type, title: title)).json
  end
end

#delete(tool_id:) ⇒ void

This method returns an undefined value.

Delete a tool (trash it)

Parameters:

  • tool_id (Integer)

    tool id ID



43
44
45
46
47
48
# File 'lib/basecamp/generated/services/tools_service.rb', line 43

def delete(tool_id:)
  with_operation(service: "tools", operation: "delete", is_mutation: true, resource_id: tool_id) do
    http_delete("/dock/tools/#{tool_id}")
    nil
  end
end

#disable(tool_id:) ⇒ void

This method returns an undefined value.

Disable a tool (hide it from the project dock)

Parameters:

  • tool_id (Integer)

    tool id ID



74
75
76
77
78
79
# File 'lib/basecamp/generated/services/tools_service.rb', line 74

def disable(tool_id:)
  with_operation(service: "tools", operation: "disable", is_mutation: true, resource_id: tool_id) do
    http_delete("/recordings/#{tool_id}/position.json")
    nil
  end
end

#enable(tool_id:) ⇒ void

This method returns an undefined value.

Enable a tool (show it on the project dock)

Parameters:

  • tool_id (Integer)

    tool id ID



53
54
55
56
57
58
# File 'lib/basecamp/generated/services/tools_service.rb', line 53

def enable(tool_id:)
  with_operation(service: "tools", operation: "enable", is_mutation: true, resource_id: tool_id) do
    http_post("/recordings/#{tool_id}/position.json")
    nil
  end
end

#get(tool_id:) ⇒ Hash

Get a dock tool by id

Parameters:

  • tool_id (Integer)

    tool id ID

Returns:

  • (Hash)

    response data



24
25
26
27
28
# File 'lib/basecamp/generated/services/tools_service.rb', line 24

def get(tool_id:)
  with_operation(service: "tools", operation: "get", is_mutation: false, resource_id: tool_id) do
    http_get("/dock/tools/#{tool_id}").json
  end
end

#reposition(tool_id:, position:) ⇒ void

This method returns an undefined value.

Reposition a tool on the project dock

Parameters:

  • tool_id (Integer)

    tool id ID

  • position (Integer)

    position



64
65
66
67
68
69
# File 'lib/basecamp/generated/services/tools_service.rb', line 64

def reposition(tool_id:, position:)
  with_operation(service: "tools", operation: "reposition", is_mutation: true, resource_id: tool_id) do
    http_put("/recordings/#{tool_id}/position.json", body: compact_params(position: position))
    nil
  end
end

#update(tool_id:, title:) ⇒ Hash

Update (rename) an existing tool

Parameters:

  • tool_id (Integer)

    tool id ID

  • title (String)

    title

Returns:

  • (Hash)

    response data



34
35
36
37
38
# File 'lib/basecamp/generated/services/tools_service.rb', line 34

def update(tool_id:, title:)
  with_operation(service: "tools", operation: "update", is_mutation: true, resource_id: tool_id) do
    http_put("/dock/tools/#{tool_id}", body: compact_params(title: title)).json
  end
end