Class: Attio::Resources::Notes Private

Inherits:
Base
  • Object
show all
Defined in:
lib/attio/resources/notes.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

API resource for managing notes in Attio

Notes can be attached to records to track important information, meeting notes, or any other textual data.

Examples:

Creating a note on a person

client.notes.create(
  parent_object: "people",
  parent_record_id: "person_123",
  title: "Meeting Notes",
  content: "Discussed Q4 goals..."
)

Listing notes for a record

client.notes.list(
  parent_object: "companies",
  parent_record_id: "company_456"
)

Since:

  • 1.0.0

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from Attio::Resources::Base

Instance Method Details

#create(parent_object:, parent_record_id:, title:, content:, **data) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Create a new note

Parameters:

  • parent_object (String)

    The parent object type

  • parent_record_id (String)

    The ID of the parent record

  • title (String)

    The note title

  • content (String)

    The note content (supports markdown)

  • data (Hash)

    Additional note data

Returns:

  • (Hash)

    The created note

Raises:

  • (ArgumentError)

    if required parameters are missing

Since:

  • 1.0.0



63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/attio/resources/notes.rb', line 63

def create(parent_object:, parent_record_id:, title:, content:, **data)
  validate_parent!(parent_object, parent_record_id)
  validate_required_string!(title, "Note title")
  validate_required_string!(content, "Note content")

  request(:post, "notes", data.merge(
                            parent_object: parent_object,
                            parent_record_id: parent_record_id,
                            title: title,
                            content: content
                          ))
end

#delete(id:) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Delete a note

Parameters:

  • id (String)

    The note ID to delete

Returns:

  • (Hash)

    Deletion confirmation

Raises:

  • (ArgumentError)

    if id is nil or empty

Since:

  • 1.0.0



97
98
99
100
# File 'lib/attio/resources/notes.rb', line 97

def delete(id:)
  validate_id!(id, "Note")
  request(:delete, "notes/#{id}")
end

#get(id:) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Get a specific note by ID

Parameters:

  • id (String)

    The note ID

Returns:

  • (Hash)

    The note data

Raises:

  • (ArgumentError)

    if id is nil or empty

Since:

  • 1.0.0



48
49
50
51
# File 'lib/attio/resources/notes.rb', line 48

def get(id:)
  validate_id!(id, "Note")
  request(:get, "notes/#{id}")
end

#list(parent_object:, parent_record_id:, **params) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

List notes for a specific parent record

Parameters:

  • parent_object (String)

    The parent object type (e.g., "people", "companies")

  • parent_record_id (String)

    The ID of the parent record

  • params (Hash)

    Additional query parameters

Options Hash (**params):

  • :limit (Integer)

    Number of notes to return

  • :cursor (String)

    Pagination cursor

Returns:

  • (Hash)

    API response containing notes

Raises:

  • (ArgumentError)

    if parent_object or parent_record_id is nil

Since:

  • 1.0.0



34
35
36
37
38
39
40
# File 'lib/attio/resources/notes.rb', line 34

def list(parent_object:, parent_record_id:, **params)
  validate_parent!(parent_object, parent_record_id)
  request(:get, "notes", params.merge(
                           parent_object: parent_object,
                           parent_record_id: parent_record_id
                         ))
end

#update(id:, **data) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Update an existing note

Parameters:

  • id (String)

    The note ID

  • data (Hash)

    The fields to update

Options Hash (**data):

  • :title (String)

    New title

  • :content (String)

    New content

Returns:

  • (Hash)

    The updated note

Raises:

  • (ArgumentError)

    if id or data is invalid

Since:

  • 1.0.0



85
86
87
88
89
# File 'lib/attio/resources/notes.rb', line 85

def update(id:, **data)
  validate_id!(id, "Note")
  validate_note_update_data!(data)
  request(:patch, "notes/#{id}", data)
end

#validate_note_update_data!(data) ⇒ Object (private)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Raises:

  • (ArgumentError)

Since:

  • 1.0.0



102
103
104
105
106
107
# File 'lib/attio/resources/notes.rb', line 102

private def validate_note_update_data!(data)
  raise ArgumentError, "Update data is required" if data.empty?
  return if data.key?(:title) || data.key?(:content)

  raise ArgumentError, "Must provide title or content to update"
end