Class: Mediaflux::IteratorDestroyRequest

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

Instance Attribute Summary

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:, iterator:) ⇒ IteratorDestroyRequest

Constructor

Parameters:

  • session_token (String)

    the API token for the authenticated session



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

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

Class Method Details

.serviceString

Specifies the Mediaflux service to use when running a query

Returns:

  • (String)


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

def self.service
  "asset.query.iterator.destroy"
end

Instance Method Details

#resultObject

Returns empty string if iterator was destroyed, error message otherwise. Notice that once have run through an iterator Mediaflux destroys it automatically so it is possible to get an error indicating that an iterator does not exist if Mediaflux deleted it on its own.



22
23
24
25
# File 'app/models/mediaflux/iterator_destroy_request.rb', line 22

def result
  xml = response_xml
  xml.xpath("/response/reply['error']").text
end