Class: ProjectMediaflux
- Inherits:
-
Object
- Object
- ProjectMediaflux
- Defined in:
- app/models/project_mediaflux.rb
Overview
Take an instance of Project and adds it to MediaFlux
Class Method Summary collapse
-
.document(project:, user:, xml_namespace: nil) ⇒ Object
Returns an XML document with the mediaflux metadata.
-
.xml_payload(project:, user:, xml_namespace: nil) ⇒ Object
Returns the XML string with the mediaflux metadata.
Class Method Details
.document(project:, user:, xml_namespace: nil) ⇒ Object
Returns an XML document with the mediaflux metadata
20 21 22 23 |
# File 'app/models/project_mediaflux.rb', line 20 def self.document(project:, user:, xml_namespace: nil) xml_body = xml_payload(project:, user:, xml_namespace:) Nokogiri::XML.parse(xml_body) end |
.xml_payload(project:, user:, xml_namespace: nil) ⇒ Object
Returns the XML string with the mediaflux metadata
10 11 12 13 14 15 16 17 |
# File 'app/models/project_mediaflux.rb', line 10 def self.xml_payload(project:, user:, xml_namespace: nil) request = Mediaflux::AssetMetadataRequest.new(session_token: user.mediaflux_session, id: project.mediaflux_id) request.resolve if request.error? raise request.response_error[:message] end request.response_body end |