Class: Mediaflux::RangeQueryRequest

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

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:, collection: nil, xpath: nil) ⇒ RangeQueryRequest

Constructor

Parameters:

  • session_token (String)

    the API token for the authenticated session

  • collection (Integer) (defaults to: nil)

    collection id

  • xpath (String) (defaults to: nil)

    xpath expression for item to calculate the range against



10
11
12
13
14
# File 'app/models/mediaflux/range_query_request.rb', line 10

def initialize(session_token:, collection: nil, xpath: nil)
  super(session_token: session_token)
  @collection = collection
  @xpath = xpath
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



4
5
6
# File 'app/models/mediaflux/range_query_request.rb', line 4

def action
  @action
end

#aql_queryObject (readonly)

Returns the value of attribute aql_query.



4
5
6
# File 'app/models/mediaflux/range_query_request.rb', line 4

def aql_query
  @aql_query
end

#collectionObject (readonly)

Returns the value of attribute collection.



4
5
6
# File 'app/models/mediaflux/range_query_request.rb', line 4

def collection
  @collection
end

#idxObject (readonly)

Returns the value of attribute idx.



4
5
6
# File 'app/models/mediaflux/range_query_request.rb', line 4

def idx
  @idx
end

#namespaceObject (readonly)

Returns the value of attribute namespace.



4
5
6
# File 'app/models/mediaflux/range_query_request.rb', line 4

def namespace
  @namespace
end

#sizeObject (readonly)

Returns the value of attribute size.



4
5
6
# File 'app/models/mediaflux/range_query_request.rb', line 4

def size
  @size
end

Class Method Details

.serviceString

Specifies the Mediaflux service to use when running a query

Returns:

  • (String)


18
19
20
# File 'app/models/mediaflux/range_query_request.rb', line 18

def self.service
  "asset.query"
end

Instance Method Details

#maximumObject

maximum value for xpath



29
30
31
32
# File 'app/models/mediaflux/range_query_request.rb', line 29

def maximum
  max_str = response_xml.xpath("/response/reply/result/value/max").text
  max_str.to_i
end

#minimumObject

minimum value for xpath



23
24
25
26
# File 'app/models/mediaflux/range_query_request.rb', line 23

def minimum
  min_str = response_xml.xpath("/response/reply/result/value/min").text
  min_str.to_i
end