Class: Basecamp::Services::GoogleDocumentsService

Inherits:
BaseService
  • Object
show all
Defined in:
lib/basecamp/generated/services/google_documents_service.rb

Overview

Service for GoogleDocuments operations

Instance Method Summary collapse

Constructor Details

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

Instance Method Details

#create_google_document(bucket_id:, vault_id:, url:, document_type:, title: nil, description: nil, status: nil, subscriptions: nil, visible_to_clients: nil) ⇒ Hash

Create a new Google document in a vault.

Parameters:

  • bucket_id (Integer)

    bucket id ID

  • vault_id (Integer)

    vault id ID

  • url (String)

    url

  • document_type (String)

    One of "doc", "sheet", "slide", "other". Backed by a Rails enum, so an unrecognized value is rejected up front with a field-keyed 422 ({"document_type": ["is not a valid document type"]}) rather than reaching validation.

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

    title

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

    description

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

    active|drafted — defaults to drafted

  • subscriptions (Array, nil) (defaults to: nil)

    subscriptions

  • visible_to_clients (Boolean, nil) (defaults to: nil)

    Whether the document is visible to the project's clients. Applies only when creating directly in the tool's vault — an item created inside a folder inherits the folder's visibility and ignores this. A client caller always creates client-visible records regardless of what is sent.

Returns:

  • (Hash)

    response data



27
28
29
30
31
# File 'lib/basecamp/generated/services/google_documents_service.rb', line 27

def create_google_document(bucket_id:, vault_id:, url:, document_type:, title: nil, description: nil, status: nil, subscriptions: nil, visible_to_clients: nil)
  with_operation(service: "googledocuments", operation: "create_google_document", is_mutation: true, project_id: bucket_id, resource_id: vault_id) do
    http_post("/buckets/#{bucket_id}/vaults/#{vault_id}/google_documents.json", body: compact_params(url: url, document_type: document_type, title: title, description: description, status: status, subscriptions: subscriptions, visible_to_clients: visible_to_clients)).json
  end
end

#get_google_document(google_document_id:) ⇒ Hash

Get a single Google document by id

Parameters:

  • google_document_id (Integer)

    google document id ID

Returns:

  • (Hash)

    response data



36
37
38
39
40
# File 'lib/basecamp/generated/services/google_documents_service.rb', line 36

def get_google_document(google_document_id:)
  with_operation(service: "googledocuments", operation: "get_google_document", is_mutation: false, resource_id: google_document_id) do
    http_get("/google_documents/#{google_document_id}", operation: "GetGoogleDocument").json
  end
end

#update_google_document(google_document_id:, url:, document_type:, title: nil, description: nil, status: nil, subscriptions: nil) ⇒ Hash

Replace a Google document with a new complete representation.

Parameters:

  • google_document_id (Integer)

    google document id ID

  • url (String)

    url

  • document_type (String)

    One of "doc", "sheet", "slide", "other". Backed by a Rails enum, so an unrecognized value is rejected up front with a field-keyed 422 ({"document_type": ["is not a valid document type"]}) rather than reaching validation.

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

    title

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

    description

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

    active|drafted

  • subscriptions (Array, nil) (defaults to: nil)

    subscriptions

Returns:

  • (Hash)

    response data



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

def update_google_document(google_document_id:, url:, document_type:, title: nil, description: nil, status: nil, subscriptions: nil)
  with_operation(service: "googledocuments", operation: "update_google_document", is_mutation: true, resource_id: google_document_id) do
    http_put("/google_documents/#{google_document_id}", body: compact_params(url: url, document_type: document_type, title: title, description: description, status: status, subscriptions: subscriptions)).json
  end
end