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

pulibrary / tigerdata-app / 88c82417-71e1-4f84-8337-7bf4bd1a5618

29 Jul 2025 08:15PM UTC coverage: 75.423% (-5.2%) from 80.666%
88c82417-71e1-4f84-8337-7bf4bd1a5618

Pull #1656

circleci

hectorcorrea
Marked a bunch of tests as integration since they create projects in Mediaflux
Pull Request #1656: Added error handling to the request to project workflow

12 of 17 new or added lines in 4 files covered. (70.59%)

157 existing lines in 19 files now uncovered.

2274 of 3015 relevant lines covered (75.42%)

344.11 hits per line

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

28.13
/app/models/mediaflux/asset_create_request.rb
1
# frozen_string_literal: true
2
module Mediaflux
1✔
3
  class AssetCreateRequest < Request
1✔
4
    attr_reader :namespace, :asset_name, :collection
1✔
5

6
    # Constructor
7
    # @param session_token [String] the API token for the authenticated session
8
    # @param name [String] Name of the Asset
9
    # @param namespace [String] Optional Parent namespace for the asset to be created in
10
    # @param pid [String] Optional Parent collection id (use this or a namespace not both)
11
    # @param xml_namespace [String]
12
    def initialize(session_token:, namespace: nil, name:, xml_namespace: nil, xml_namespace_uri: nil, pid: nil)
1✔
UNCOV
13
      super(session_token: session_token)
×
UNCOV
14
      @namespace = namespace
×
UNCOV
15
      @asset_name = name
×
UNCOV
16
      @xml_namespace = xml_namespace || self.class.default_xml_namespace
×
UNCOV
17
      @xml_namespace_uri = xml_namespace_uri || self.class.default_xml_namespace_uri
×
UNCOV
18
      @pid = pid
×
19
    end
20

21
    # Specifies the Mediaflux service to use when creating assets
22
    # @return [String]
23
    def self.service
1✔
UNCOV
24
      "asset.create"
×
25
    end
26

27
    def id
1✔
UNCOV
28
      @id ||= response_xml.xpath("/response/reply/result/id").text
×
UNCOV
29
      @id
×
30
    end
31

32
    private
1✔
33

34
      # The generated XML mimics what we get when we issue an Aterm command as follows:
35
      # > asset.set :id path=/sandbox_ns/rdss_collection
36
      #     :meta <
37
      #       :tigerdata:project <
38
      #         :title "RDSS test project"
39
      #         :description "The description of the project"
40
      #         ...the rest of the fields go here..
41
      #       >
42
      #     >
43
      #
44
      def build_http_request_body(name:)
1✔
UNCOV
45
        super do |xml|
×
UNCOV
46
          xml.args do
×
UNCOV
47
            xml.name asset_name
×
UNCOV
48
            xml.namespace namespace if namespace.present?
×
UNCOV
49
            yield xml if block_given?
×
UNCOV
50
            collection_xml(xml)
×
UNCOV
51
            if @pid.present?
×
UNCOV
52
              xml.pid @pid
×
53
            end
54
          end
55
        end
56
      end
57

58
      def collection_xml(xml)
1✔
UNCOV
59
        xml.collection do
×
UNCOV
60
          xml.parent.set_attribute("cascade-contained-asset-index", true)
×
UNCOV
61
          xml.parent.set_attribute("contained-asset-index", true)
×
UNCOV
62
          xml.parent.set_attribute("unique-name-index", true)
×
UNCOV
63
          xml.text(true)
×
64
        end
UNCOV
65
        xml.type "application/arc-asset-collection"
×
66
      end
67
  end
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