Class: Mediaflux::IteratorRequest
- Defined in:
- app/models/mediaflux/iterator_request.rb
Instance Attribute Summary
Attributes inherited from Request
Class Method Summary collapse
-
.service ⇒ String
Specifies the Mediaflux service to use when running a query.
Instance Method Summary collapse
-
#initialize(session_token:, iterator:, action: "get-values", size: nil) ⇒ IteratorRequest
constructor
Constructor.
-
#result ⇒ Object
Returns hash with the files fetched in this iteration as well as a flag on whether we are done iterating (complete=true) or if we need to keep iterating.
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:, action: "get-values", size: nil) ⇒ IteratorRequest
Constructor
7 8 9 10 11 12 |
# File 'app/models/mediaflux/iterator_request.rb', line 7 def initialize(session_token:, iterator:, action: "get-values", size: nil) super(session_token: session_token) @iterator = iterator @size = size @action = action end |
Class Method Details
.service ⇒ String
Specifies the Mediaflux service to use when running a query
16 17 18 |
# File 'app/models/mediaflux/iterator_request.rb', line 16 def self.service "asset.query.iterate" end |
Instance Method Details
#result ⇒ Object
Returns hash with the files fetched in this iteration as well as a flag on whether we are done iterating (complete=true) or if we need to keep iterating
22 23 24 25 26 27 28 29 |
# File 'app/models/mediaflux/iterator_request.rb', line 22 def result xml = response_xml { files: parse_files(xml), complete: xml.xpath("/response/reply/result/iterated/@complete").text == "true", count: xml.xpath("/response/reply/result/iterated").text.to_i } end |