class Attio::Meta
Provides metadata about the current API token and workspace
def self.identify(**opts)
def self.identify(**opts) response = execute_request(:GET, resource_path, {}, opts) new(response["data"] || response, opts) end
def self.resource_path
def self.resource_path "self" end
def can_read?(resource)
def can_read?(resource) has_scope?("#{resource}:read") || has_scope?("#{resource}:read-write") end
def can_write?(resource)
def can_write?(resource) has_scope?("#{resource}:write") || has_scope?("#{resource}:read-write") end
def destroy(**opts)
def destroy(**opts) raise InvalidRequestError, "Meta information is read-only" end
def has_scope?(scope)
def has_scope?(scope) scope_str = scope.to_s.tr("_", ":") scopes.include?(scope_str) end
def immutable?
def immutable? true end
def inspect
def inspect "#<#{self.class.name}:#{object_id} workspace=#{workspace_slug.inspect} token=#{token_name.inspect}>" end
def save(**opts)
def save(**opts) raise InvalidRequestError, "Meta information is read-only" end
def scopes
-
(Array
- Array of scope strings)
def scopes token&.dig(:scopes) || [] end
def to_h
def to_h { workspace: workspace, token: token, actor: actor }.compact end
def token_id
def token_id token&.dig(:id) end
def token_name
-
(String, nil)
- The token name
def token_name token&.dig(:name) end
def token_type
-
(String, nil)
- The token type
def token_type token&.dig(:type) end
def workspace_id
def workspace_id workspace&.dig(:id) end
def workspace_name
-
(String, nil)
- The workspace name
def workspace_name workspace&.dig(:name) end
def workspace_slug
-
(String, nil)
- The workspace slug
def workspace_slug workspace&.dig(:slug) end