Class: AtlasRb::Admin::Community

Inherits:
Object
  • Object
show all
Extended by:
FaradayHelper
Defined in:
lib/atlas_rb/admin/community.rb

Overview

Destructive lifecycle operations on a Community.

See AtlasRb::Admin for the rationale behind the namespace and the confirm: :i_understand friction marker.

Constant Summary collapse

ROUTE =

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

Atlas REST endpoint prefix.

"/communities/"

Class Method Summary collapse

Methods included from FaradayHelper

connection, multipart, system_connection

Class Method Details

.destroy(id, confirm:, nuid: nil, on_behalf_of: nil) ⇒ Faraday::Response

Hard-delete a Community.

Unrecoverable — prefer Community.tombstone for user-visible withdrawal. Operator-only.

Examples:

AtlasRb::Admin::Community.destroy("c-123", confirm: :i_understand)

Parameters:

  • id (String)

    the Community ID.

  • confirm (Symbol)

    must be :i_understand. Any other value raises ArgumentError.

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

    optional acting user's NUID.

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

    optional On-Behalf-Of NUID.

Returns:

  • (Faraday::Response)

    the raw delete response.

Raises:

  • (ArgumentError)

    if confirm: is missing or not the sentinel value.



32
33
34
35
36
37
38
# File 'lib/atlas_rb/admin/community.rb', line 32

def self.destroy(id, confirm:, nuid: nil, on_behalf_of: nil)
  unless confirm == :i_understand
    raise ArgumentError,
          "AtlasRb::Admin::Community.destroy requires confirm: :i_understand"
  end
  connection({}, nuid, on_behalf_of: on_behalf_of).delete(ROUTE + id)
end

.restore(id, nuid: nil, on_behalf_of: nil) ⇒ Faraday::Response

Restore a previously-tombstoned Community.

Examples:

AtlasRb::Admin::Community.restore("c-123")

Parameters:

  • id (String)

    the Community ID.

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

    optional acting user's NUID.

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

    optional On-Behalf-Of NUID.

Returns:

  • (Faraday::Response)

    the raw response.



49
50
51
# File 'lib/atlas_rb/admin/community.rb', line 49

def self.restore(id, nuid: nil, on_behalf_of: nil)
  connection({}, nuid, on_behalf_of: on_behalf_of).post(ROUTE + id + '/restore')
end