Class: Mediaflux::CollectionCountRequest

Inherits:
Request
  • Object
show all
Defined in:
app/models/mediaflux/collection_count_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:, namespace:, data_sponsor: nil, department: nil) ⇒ CollectionCountRequest

Constructor

Parameters:

  • session_token (String)

    the API token for the authenticated session

  • namespace (String)

    Namespace to limit the search

  • data_sponsor (String) (defaults to: nil)

    Datasponsor for the collection

  • data_sponsor (String) (defaults to: nil)

    Department assigned to the collection



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

def initialize(session_token:, namespace:, data_sponsor: nil, department: nil)
  super(session_token: session_token)
  @namespace = namespace
  @data_sponsor = data_sponsor
  @department = department
end

Class Method Details

.serviceString

Specifies the Mediaflux service to use

Returns:

  • (String)


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

def self.service
  "asset.count"
end

Instance Method Details

#countObject



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

def count
  @count ||= response_xml.xpath("/response/reply/result/total").text
  @count
end