Class: Mediaflux::NamespaceExistRequest
- Defined in:
- app/models/mediaflux/namespace_exist_request.rb
Instance Attribute Summary
Attributes inherited from Request
Class Method Summary collapse
-
.service ⇒ String
Specifies the Mediaflux service to use.
Instance Method Summary collapse
-
#exist? ⇒ Boolean
Be aware that asset.namespace.exists does not return the ID of the asset validated so we cannot return it back to the user (Mediaflux returns the path that we validated but not the actual asset ID. Hence we return true/false for this kind of request..
-
#initialize(session_token:, namespace:) ⇒ NamespaceExistRequest
constructor
Constructor.
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:) ⇒ NamespaceExistRequest
Constructor
6 7 8 9 |
# File 'app/models/mediaflux/namespace_exist_request.rb', line 6 def initialize(session_token:, namespace:) super(session_token: session_token) @namespace = namespace end |
Class Method Details
.service ⇒ String
Specifies the Mediaflux service to use
13 14 15 |
# File 'app/models/mediaflux/namespace_exist_request.rb', line 13 def self.service "asset.namespace.exists" end |
Instance Method Details
#exist? ⇒ Boolean
Be aware that asset.namespace.exists does not return the ID of the asset validated so we cannot return it back to the user (Mediaflux returns the path that we validated but not the actual asset ID. Hence we return true/false for this kind of request.
21 22 23 |
# File 'app/models/mediaflux/namespace_exist_request.rb', line 21 def exist? response_xml.xpath("/response/reply/result/exists").text == "true" end |