class Attio::Thread
Represents a comment thread in Attio (read-only)
def self.list(**params)
def self.list(**params) # Query params should be part of the request, not opts query_params = params.slice(:record_id, :object, :entry_id, :list, :limit, :offset) opts = params.except(:record_id, :object, :entry_id, :list, :limit, :offset) response = execute_request(:GET, resource_path, query_params, opts) ListObject.new(response, self, params, opts) end
def self.resource_path
-
(String)
- The API path
def self.resource_path "threads" end
def comment_count
def comment_count comments&.length || 0 end
def destroy(**opts)
def destroy(**opts) raise InvalidRequestError, "Threads are read-only and cannot be deleted" end
def extract_thread_id
def extract_thread_id case id when Hash id[:thread_id] || id["thread_id"] else id end end
def first_comment
-
(Hash, nil)
- First comment or nil if empty
def first_comment comments&.first end
def has_comments?
def has_comments? comment_count > 0 end
def immutable?
def immutable? true end
def inspect
def inspect "#<#{self.class.name}:#{object_id} id=#{id.inspect} comments=#{comment_count}>" end
def last_comment
-
(Hash, nil)
- Last comment or nil if empty
def last_comment comments&.last end
def resource_path
def resource_path thread_id = extract_thread_id "#{self.class.resource_path}/#{thread_id}" end
def save(**opts)
def save(**opts) raise InvalidRequestError, "Threads are read-only and cannot be modified" end
def to_h
def to_h { id: id, comments: comments, created_at: created_at&.iso8601 }.compact end