Class: Mediaflux::QueryRequest
- Defined in:
- app/models/mediaflux/query_request.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#aql_query ⇒ Object
readonly
Returns the value of attribute aql_query.
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#deep_search ⇒ Object
readonly
Returns the value of attribute deep_search.
-
#iterator ⇒ Object
readonly
Returns the value of attribute iterator.
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:, aql_query: nil, collection: nil, action: "get-values", deep_search: false, iterator: true) ⇒ QueryRequest
constructor
Constructor.
-
#result ⇒ Object
Returns the iterator that could be used to fetch the data.
- #result_items ⇒ Object
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:, aql_query: nil, collection: nil, action: "get-values", deep_search: false, iterator: true) ⇒ QueryRequest
Constructor
14 15 16 17 18 19 20 21 |
# File 'app/models/mediaflux/query_request.rb', line 14 def initialize(session_token:, aql_query: nil, collection: nil, action: "get-values", deep_search: false, iterator: true) super(session_token: session_token) @aql_query = aql_query @collection = collection @action = action @deep_search = deep_search @iterator = iterator end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
4 5 6 |
# File 'app/models/mediaflux/query_request.rb', line 4 def action @action end |
#aql_query ⇒ Object (readonly)
Returns the value of attribute aql_query.
4 5 6 |
# File 'app/models/mediaflux/query_request.rb', line 4 def aql_query @aql_query end |
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
4 5 6 |
# File 'app/models/mediaflux/query_request.rb', line 4 def collection @collection end |
#deep_search ⇒ Object (readonly)
Returns the value of attribute deep_search.
4 5 6 |
# File 'app/models/mediaflux/query_request.rb', line 4 def deep_search @deep_search end |
#iterator ⇒ Object (readonly)
Returns the value of attribute iterator.
4 5 6 |
# File 'app/models/mediaflux/query_request.rb', line 4 def iterator @iterator end |
Class Method Details
.service ⇒ String
Specifies the Mediaflux service to use when running a query
25 26 27 |
# File 'app/models/mediaflux/query_request.rb', line 25 def self.service "asset.query" end |
Instance Method Details
#result ⇒ Object
Returns the iterator that could be used to fetch the data
30 31 32 33 |
# File 'app/models/mediaflux/query_request.rb', line 30 def result xml = response_xml xml.xpath("/response/reply/result/iterator").text.to_i end |
#result_items ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'app/models/mediaflux/query_request.rb', line 35 def result_items xml = response_xml xml.xpath("/response/reply/result").children.map do |node| { id: node.xpath("./@id").text, name: node.xpath("./name").text, path: node.xpath("./path").text } end end |