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, new_project_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 23 24 25 26 27 |
# 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']}" @number_of_files = @project..number_of_files @hpc = @project..hpc @smb = @project..smb_request @globus = @project..globus_request @project_purpose = @project..project_purpose 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
31 32 33 |
# File 'app/models/mediaflux/project_create_service_request.rb', line 31 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.
38 39 40 41 42 43 44 |
# File 'app/models/mediaflux/project_create_service_request.rb', line 38 def debug_output if new_project_create? response_xml.xpath("response/reply/result/lineage").to_s else response_xml.xpath("response/reply/result/result").to_s end end |
#mediaflux_id ⇒ Object
Returns the id of the collection created in Mediaflux
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/models/mediaflux/project_create_service_request.rb', line 47 def mediaflux_id if new_project_create? # We have the value in the `id` node response_xml.xpath("response/reply/result/id").text.to_i else # 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 end |