Class: Mediaflux::NamespaceDestroyRequest

Inherits:
Request
  • Object
show all
Defined in:
app/models/mediaflux/namespace_destroy_request.rb

Overview

Destroy a MediaFlux namespace and everything in it

Examples:

Mediaflux::NamespaceDestroyRequest.new(session_token: session_id, namespace: "/td-test-001/tigerdataNS/Banana1NS").destroy
=> true

Instance Attribute Summary collapse

Attributes inherited from Request

#session_token

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Request

build_post_request, default_xml_namespace, default_xml_namespace_uri, #error?, find_or_create_http_client, format_date_for_mediaflux, request_path, #resolve, #resolved?, #response_body, #response_error, #response_xml, uri, #xml_payload, #xtoshell_xml

Constructor Details

#initialize(session_token:, namespace:) ⇒ NamespaceDestroyRequest

Constructor

Parameters:

  • session_token (String)

    the API token for the authenticated session

  • namespace (String)

    name of namespace to be destroyed



13
14
15
16
# File 'app/models/mediaflux/namespace_destroy_request.rb', line 13

def initialize(session_token:, namespace:)
  super(session_token: session_token)
  @namespace = namespace
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



8
9
10
# File 'app/models/mediaflux/namespace_destroy_request.rb', line 8

def description
  @description
end

#namespaceObject (readonly)

Returns the value of attribute namespace.



8
9
10
# File 'app/models/mediaflux/namespace_destroy_request.rb', line 8

def namespace
  @namespace
end

#storeObject (readonly)

Returns the value of attribute store.



8
9
10
# File 'app/models/mediaflux/namespace_destroy_request.rb', line 8

def store
  @store
end

Class Method Details

.serviceString

Specifies the Mediaflux service to use when destroying namespaces

Returns:

  • (String)


28
29
30
# File 'app/models/mediaflux/namespace_destroy_request.rb', line 28

def self.service
  "asset.namespace.hard.destroy"
end

Instance Method Details

#destroyObject



18
19
20
21
22
23
24
# File 'app/models/mediaflux/namespace_destroy_request.rb', line 18

def destroy
  resolve
  if error?
    response_error
    raise(StandardError, "call to service 'asset.namespace.hard.destroy' failed: The namespace #{namespace} does not exist or is not accessible")
  end
end