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

pulibrary / tigerdata-app / 0fa44f37-9401-471e-84d4-efbabcf424ab

22 Oct 2025 02:10PM UTC coverage: 91.212% (+0.2%) from 91.051%
0fa44f37-9401-471e-84d4-efbabcf424ab

push

circleci

web-flow
Getting rid of the New Project Wizard flipper (#2072)

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

794 existing lines in 41 files now uncovered.

2740 of 3004 relevant lines covered (91.21%)

751.91 hits per line

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

100.0
/app/models/mediaflux/asset_create_request.rb
1
# frozen_string_literal: true
2
module Mediaflux
4✔
3
  class AssetCreateRequest < Request
4✔
4
    attr_reader :namespace, :asset_name, :collection
4✔
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)
4✔
13
      super(session_token: session_token)
88✔
14
      @namespace = namespace
88✔
15
      @asset_name = name
88✔
16
      @xml_namespace = xml_namespace || self.class.default_xml_namespace
88✔
17
      @xml_namespace_uri = xml_namespace_uri || self.class.default_xml_namespace_uri
88✔
18
      @pid = pid
88✔
19
    end
20

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

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

32
    private
4✔
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:)
4✔
45
        super do |xml|
172✔
46
          xml.args do
172✔
47
            xml.name asset_name
172✔
48
            xml.namespace namespace if namespace.present?
172✔
49
            yield xml if block_given?
172✔
50
            collection_xml(xml)
172✔
51
            if @pid.present?
172✔
52
              xml.pid @pid
172✔
53
            end
54
          end
55
        end
56
      end
57

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