Class: Basecamp::Services::AttachmentsService

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

Overview

Service for Attachments operations

Instance Method Summary collapse

Constructor Details

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

Instance Method Details

#create(data:, content_type:, name:) ⇒ Hash

Create an attachment (upload a file for embedding)

Parameters:

  • data (String)

    Binary file data to upload

  • content_type (String)

    MIME type of the file (e.g., "application/pdf", "image/png")

  • name (String)

    name

Returns:

  • (Hash)

    response data



17
18
19
20
21
# File 'lib/basecamp/generated/services/attachments_service.rb', line 17

def create(data:, content_type:, name:)
  with_operation(service: "attachments", operation: "create", is_mutation: true) do
    http_post_raw("/attachments.json?name=#{URI.encode_www_form_component(name.to_s)}", body: data, content_type: content_type).json
  end
end