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

pulibrary / tigerdata-app / a25a9344-105b-44fa-8cbb-8294c0216121

30 Oct 2025 08:44PM UTC coverage: 64.982% (-22.7%) from 87.65%
a25a9344-105b-44fa-8cbb-8294c0216121

Pull #2128

circleci

hectorcorrea
Started updating the project show page to display metadata from Mediaflux
Pull Request #2128: Project Show page now displays metadata straight from Mediaflux

0 of 37 new or added lines in 3 files covered. (0.0%)

757 existing lines in 36 files now uncovered.

2134 of 3284 relevant lines covered (64.98%)

168.86 hits per line

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

0.0
/app/models/mediaflux/project_list_request.rb
1
# frozen_string_literal: true
UNCOV
2
module Mediaflux
×
UNCOV
3
  class ProjectListRequest < Request
×
UNCOV
4
    attr_reader :aql_query, :collection, :action, :deep_search, :iterator
×
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)
×
UNCOV
15
      super(session_token: session_token)
×
UNCOV
16
      @aql_query = aql_query
×
UNCOV
17
      @collection = collection
×
UNCOV
18
      @action = action
×
UNCOV
19
      @deep_search = deep_search
×
UNCOV
20
    end
×
21

22
    # Specifies the Mediaflux service to use when running a query
23
    # @return [String]
UNCOV
24
    def self.service
×
UNCOV
25
      "asset.query"
×
UNCOV
26
    end
×
27

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

UNCOV
47
    private
×
48

UNCOV
49
      def build_http_request_body(name:)
×
UNCOV
50
        super do |xml|
×
UNCOV
51
          xml.args do
×
UNCOV
52
            xml.where aql_query if aql_query.present?
×
UNCOV
53
            xml.action action if action.present?
×
UNCOV
54
          end
×
UNCOV
55
        end
×
UNCOV
56
      end
×
57

UNCOV
58
      def data_users_from_string(users)
×
UNCOV
59
        return [] if users.blank?
×
UNCOV
60
        users.split(",")
×
UNCOV
61
      end
×
UNCOV
62
  end
×
UNCOV
63
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