Class: Mediaflux::ProjectCreateServiceRequest
- Defined in:
- app/models/mediaflux/project_create_service_request.rb
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#service_name ⇒ Object
readonly
Returns the value of attribute service_name.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Attributes inherited from Request
Class Method Summary collapse
-
.service ⇒ String
Specifies the Mediaflux service to use when creating project.
Instance Method Summary collapse
-
#debug_output ⇒ Object
Returns the entire response returned by the project create service.
-
#initialize(session_token:, project:, token: nil) ⇒ ProjectCreateServiceRequest
constructor
Constructor.
-
#mediaflux_id ⇒ Object
Returns the id of the collection created in Mediaflux.
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:, project:, token: nil) ⇒ ProjectCreateServiceRequest
Constructor
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/models/mediaflux/project_create_service_request.rb', line 10 def initialize(session_token:, project:, token: nil) super(session_token: session_token) @token = token @project = project @data_manager = @project..data_manager @data_sponsor = @project..data_sponsor @title = @project..title @description = @project..description @directory = @project..project_directory @project_id = @project..project_id @department = departments_string(@project..departments) @quota = "#{@project..storage_capacity['size']['approved']} #{@project..storage_capacity['unit']['approved']}" end |
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
4 5 6 |
# File 'app/models/mediaflux/project_create_service_request.rb', line 4 def document @document end |
#service_name ⇒ Object (readonly)
Returns the value of attribute service_name.
4 5 6 |
# File 'app/models/mediaflux/project_create_service_request.rb', line 4 def service_name @service_name end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
4 5 6 |
# File 'app/models/mediaflux/project_create_service_request.rb', line 4 def token @token end |
Class Method Details
.service ⇒ String
Specifies the Mediaflux service to use when creating project
26 27 28 |
# File 'app/models/mediaflux/project_create_service_request.rb', line 26 def self.service "tigerdata.project.create" end |
Instance Method Details
#debug_output ⇒ Object
Returns the entire response returned by the project create service. This includes debug information that is useful to troubleshoot issues if the request fails.
33 34 35 |
# File 'app/models/mediaflux/project_create_service_request.rb', line 33 def debug_output response_xml.xpath("response/reply/result/result").to_s end |
#mediaflux_id ⇒ Object
Returns the id of the collection created in Mediaflux
38 39 40 41 42 43 44 |
# File 'app/models/mediaflux/project_create_service_request.rb', line 38 def mediaflux_id # Extract the <id>nnnn</id> value from the output and then extract the # numeric value inside of it. decoded_string = CGI.unescapeHTML(debug_output) xml_doc = Nokogiri::XML(decoded_string) (xml_doc.xpath("result/result/id/text()").to_s).to_i end |