• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / tigerdata-app / ae92dc00-e0b3-4dab-b9c2-66e829d6d3e6

08 Jul 2025 06:28PM UTC coverage: 71.631% (-0.9%) from 72.487%
ae92dc00-e0b3-4dab-b9c2-66e829d6d3e6

Pull #1581

circleci

web-flow
Merge branch 'main' into 114-mflux-sync
Pull Request #1581: Remove schema create and update functionality from tigerdata-app

4 of 18 branches covered (22.22%)

27 of 28 new or added lines in 4 files covered. (96.43%)

14 existing lines in 2 files now uncovered.

2934 of 4096 relevant lines covered (71.63%)

503.55 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

97.5
/app/models/mediaflux/project_update_request.rb
1
# frozen_string_literal: true
2
module Mediaflux
1✔
3
  class ProjectUpdateRequest < Request
1✔
4
    attr_reader :project, :project_metadata
1✔
5

6
    # Constructor
7
    # @param session_token [String] the API token for the authenticated session
8
    # @param project [Project] project to be created in Mediaflux
9
    def initialize(session_token:, project:)
1✔
10
      super(session_token: session_token)
8✔
11
      @project = project
8✔
12
      @id = @project.mediaflux_id
8✔
13
      @xml_namespace = self.class.default_xml_namespace
8✔
14
      @xml_namespace_uri = self.class.default_xml_namespace_uri
8✔
15
      @project_metadata = project.metadata_model
8✔
16
    end
17

18
    # Specifies the Mediaflux service to use when updating assets
19
    # @return [String]
20
    def self.service
1✔
21
      "asset.set"
15✔
22
    end
23

24
    private
1✔
25

26
      # The generated XML mimics what we get when we issue an Aterm command as follows:
27
      # > asset.set :id 1234
28
      #     :meta <
29
      #       :tigerdata:project <
30
      #         :title "RDSS test project"
31
      #         :description "The description of the project"
32
      #         ...the rest of the fields go here..
33
      #       >
34
      #     >
35
      #
36
      # rubocop:disable Metrics/MethodLength
37
      # rubocop:disable Metrics/AbcSize
38
      # rubocop:disable Metrics/BlockLength
39
      def build_http_request_body(name:)
1✔
40
        super do |xml|
15✔
41
          xml.args do
15✔
42
            xml.id @id
15✔
43
            xml.meta do
15✔
44
              doc = xml.doc
15✔
45
              root = doc.root
15✔
46
              root.add_namespace_definition(@xml_namespace, @xml_namespace_uri)
15✔
47

48
              element_name = "#{@xml_namespace}:project"
15✔
49
              xml.send(element_name) do
15✔
50
                xml.ProjectDirectory project.project_directory
15✔
51
                xml.Title project_metadata.title
15✔
52
                if project_metadata.description.blank?
15✔
NEW
53
                  xml.Description "description not provided"
×
54
                else
55
                  xml.Description project_metadata.description
15✔
56
                end
57
                # xml.Status project_metadata.status
58
                # xml.SchemaVersion TigerdataSchema::SCHEMA_VERSION
59
                xml.DataSponsor project_metadata.data_sponsor
15✔
60
                xml.DataManager project_metadata.data_manager
15✔
61
                departments = project_metadata.departments || []
15✔
62
                departments.each do |department|
15✔
63
                  xml.Department department
26✔
64
                end
65
                # xml.CreatedBy project_metadata.created_by
66
                ro_users = project_metadata.ro_users || []
15✔
67
                rw_users = project_metadata.rw_users || []
15✔
68
                all_users = ro_users + rw_users
15✔
69
                data_users = all_users.join(",")
15✔
70
                if data_users.blank?
15✔
71
                  xml.DataUser "n/a"
9✔
72
                else
73
                  xml.DataUser data_users
6✔
74
                end
75
                # created_on = Mediaflux::Time.format_date_for_mediaflux(project_metadata.created_on)
76
                # xml.CreatedOn created_on
77
                # xml.UpdatedBy project_metadata.updated_by
78
                # updated_on = Mediaflux::Time.format_date_for_mediaflux(project_metadata.updated_on)
79
                # xml.UpdatedOn updated_on
80
                # xml.ProjectID project_metadata.project_id
81
                # capacity = project_metadata.storage_capacity
82
                # xml.StorageCapacity do
83
                #   xml.Size capacity["size"]["requested"]
84
                #   xml.Unit capacity["unit"]["requested"]
85
                # end
86
                # performance = project_metadata.storage_performance_expectations
87
                # xml.Performance do
88
                #   xml.parent.set_attribute("Requested", performance["requested"])
89
                #   xml.text(performance["requested"])
90
                # end
91
                # xml.Submission do
92
                #   xml.RequestedBy project_metadata.created_by
93
                #   xml.RequestDateTime created_on
94
                # end
95
                # xml.ProjectPurpose project_metadata.project_purpose
96
              end
97
            end
98
          end
99
        end
100
      end
101
    # rubocop:enable Metrics/AbcSize
102
    # rubocop:enable Metrics/MethodLength
103
    # rubocop:enable Metrics/BlockLength
104
  end
105
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc