Class: Mediaflux::AssetMetadataRequest
- Defined in:
- app/models/mediaflux/asset_metadata_request.rb
Overview
Get metadata about an asset in mediaflux
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Attributes inherited from Request
Class Method Summary collapse
-
.service ⇒ String
Specifies the Mediaflux service to use when getting asset metadata.
Instance Method Summary collapse
-
#initialize(session_token:, id:) ⇒ AssetMetadataRequest
constructor
Constructor.
-
#metadata ⇒ Object
parse the returned XML into a hash about the asset that can be utilized.
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:, id:) ⇒ AssetMetadataRequest
Constructor
13 14 15 16 |
# File 'app/models/mediaflux/asset_metadata_request.rb', line 13 def initialize(session_token:, id:) super(session_token: session_token) @id = id end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'app/models/mediaflux/asset_metadata_request.rb', line 8 def id @id end |
Class Method Details
.service ⇒ String
Specifies the Mediaflux service to use when getting asset metadata
20 21 22 |
# File 'app/models/mediaflux/asset_metadata_request.rb', line 20 def self.service "asset.get" end |
Instance Method Details
#metadata ⇒ Object
parse the returned XML into a hash about the asset that can be utilized
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/models/mediaflux/asset_metadata_request.rb', line 25 def xml = response_xml asset = xml.xpath("/response/reply/result/asset") = parse(asset) if [:collection] [:total_file_count] = asset.xpath("./collection/accumulator/value/non-collections").text [:size] = asset.xpath("./collection/accumulator/value/total/@h").text [:accum_names] = asset.xpath("./collection/accumulator/@name") [:ctime] = asset.xpath("./ctime") end parse_image(asset.xpath("./meta/mf-image"), ) # this does not do anything because mf-image is not a part of the meta xpath parse_note(asset.xpath("./meta/mf-note"), ) # this does not do anything because mf-note is not a part of the meta xpath parse_quota(asset.xpath("./collection/quota"), ) end |