Class: Mediaflux::ScriptFileListInitRequest

Inherits:
Request
  • Object
show all
Defined in:
app/models/mediaflux/script_file_list_init_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:, path:, session_user: nil) ⇒ ScriptFileListInitRequest

Constructor

Parameters:

  • session_token (String)

    the API token for the authenticated session

  • path (String)

    path to the collection we want the list of files for



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

def initialize(session_token:, path:, session_user: nil)
  super(session_token: session_token, session_user: session_user)
  @path = path
end

Class Method Details

.serviceString

Specifies the Mediaflux service to use

Returns:

  • (String)


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

def self.service
  "asset.script.execute"
end

Instance Method Details

#resultObject

Returns the iterator that would be use to fetch the file list



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

def result
  # Weird: the result comes as an XML inside the typical /response/reply/result
  nested_response = response_xml.xpath("/response/reply/result").text
  nested_xml = Nokogiri::XML.parse(nested_response)
  nested_xml.xpath("/result/iterator").text.to_i
end