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

pulibrary / tigerdata-app / df5c5773-2d28-4ed4-a37f-15a25fbf5642

03 Nov 2025 07:09PM UTC coverage: 91.405% (+0.005%) from 91.4%
df5c5773-2d28-4ed4-a37f-15a25fbf5642

push

circleci

carolyncole
Remove the duplicate UID from the new project wizard screens
refs #2113

3 of 3 new or added lines in 1 file covered. (100.0%)

1026 existing lines in 51 files now uncovered.

2829 of 3095 relevant lines covered (91.41%)

489.18 hits per line

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

100.0
/app/models/mediaflux/project_list_request.rb
1
# frozen_string_literal: true
UNCOV
2
module Mediaflux
4✔
UNCOV
3
  class ProjectListRequest < Request
4✔
UNCOV
4
    attr_reader :aql_query, :collection, :action, :deep_search, :iterator, :size
4✔
5

6
    # Constructor
7
    # @param session_token [String] the API token for the authenticated session
8
    # @param aql_query [String] Optional AQL query string
9
    # @param collection [Integer] Optional collection id
10
    # @param action [String] Optional, by default it uses get-name but it could also be get-meta to get all
11
    #                        the fields for the assets or `get-values` to get a limited list of fields.
12
    # @param deep_search [Bool] Optional, false by default. When true queries the collection and it subcollections.
13
    # @param iterator [Bool] Optional, true by default. When true returns an iterator.  When false returns a list of results
UNCOV
14
    def initialize(session_token:, aql_query: nil, action: "get-meta", deep_search: true)
4✔
UNCOV
15
      super(session_token: session_token)
72✔
UNCOV
16
      @aql_query = aql_query
72✔
UNCOV
17
      @collection = collection
72✔
UNCOV
18
      @action = action
72✔
UNCOV
19
      @deep_search = deep_search
72✔
20
      # For now we hard-code the size to infinity since only Administrators will fetch a large
21
      # number of projects and they should get them all. At some point in the future we might
22
      # want to implement pagination for this list but not now..
UNCOV
23
      @size = "infinity"
72✔
UNCOV
24
    end
25

26
    # Specifies the Mediaflux service to use when running a query
27
    # @return [String]
UNCOV
28
    def self.service
4✔
UNCOV
29
      "asset.query"
144✔
UNCOV
30
    end
31

32
    # Returns the iterator that could be used to fetch the data
UNCOV
33
    def results
4✔
UNCOV
34
      xml = response_xml
72✔
UNCOV
35
      assets = xml.xpath("/response/reply/result/asset")
72✔
UNCOV
36
      assets.map do |asset|
72✔
UNCOV
37
        metadata = asset.xpath("./meta//tigerdata:project", "tigerdata" => "tigerdata")
3,544✔
UNCOV
38
        {
UNCOV
39
          mediaflux_id: asset.xpath("@id").first.value,
3,544✔
UNCOV
40
          title: metadata.xpath("./Title").text,
UNCOV
41
          description: metadata.xpath("./Description").text,
UNCOV
42
          project_purpose: metadata.xpath("./ProjectPurpose").text,
UNCOV
43
          data_sponsor: metadata.xpath("./DataSponsor").text,
UNCOV
44
          data_manager: metadata.xpath("./DataManager").text,
UNCOV
45
          data_users: data_users_from_string(metadata.xpath("./DataUser").text),
UNCOV
46
          directory: metadata.xpath("./ProjectDirectory").text
UNCOV
47
        }
UNCOV
48
      end
UNCOV
49
    end
50

UNCOV
51
    private
4✔
52

UNCOV
53
      def build_http_request_body(name:)
4✔
UNCOV
54
        super do |xml|
144✔
UNCOV
55
          xml.args do
144✔
UNCOV
56
            xml.where aql_query if aql_query.present?
144✔
UNCOV
57
            xml.action action if action.present?
144✔
UNCOV
58
            xml.size size if size.present?
144✔
UNCOV
59
          end
UNCOV
60
        end
UNCOV
61
      end
62

UNCOV
63
      def data_users_from_string(users)
4✔
UNCOV
64
        return [] if users.blank?
3,544✔
UNCOV
65
        users.split(",")
907✔
UNCOV
66
      end
UNCOV
67
  end
UNCOV
68
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