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

pulibrary / tigerdata-app / 8d70f2ab-acc5-4aab-b64b-743d66ddd2eb

29 Aug 2025 06:22PM UTC coverage: 87.983% (-0.1%) from 88.118%
8d70f2ab-acc5-4aab-b64b-743d66ddd2eb

Pull #1801

circleci

JaymeeH
Merge branch '1586-request-mailer' of https://github.com/pulibrary/tiger-data-app into 1586-request-mailer
Pull Request #1801: 1586 request mailer

10 of 10 new or added lines in 2 files covered. (100.0%)

1173 existing lines in 56 files now uncovered.

2482 of 2821 relevant lines covered (87.98%)

317.98 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
UNCOV
2
module Mediaflux
1✔
UNCOV
3
  class AssetCreateRequest < Request
1✔
UNCOV
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]
UNCOV
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)
44✔
UNCOV
14
      @namespace = namespace
44✔
UNCOV
15
      @asset_name = name
44✔
UNCOV
16
      @xml_namespace = xml_namespace || self.class.default_xml_namespace
44✔
UNCOV
17
      @xml_namespace_uri = xml_namespace_uri || self.class.default_xml_namespace_uri
44✔
UNCOV
18
      @pid = pid
44✔
UNCOV
19
    end
20

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

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

UNCOV
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
      #
UNCOV
44
      def build_http_request_body(name:)
1✔
UNCOV
45
        super do |xml|
86✔
UNCOV
46
          xml.args do
86✔
UNCOV
47
            xml.name asset_name
86✔
UNCOV
48
            xml.namespace namespace if namespace.present?
86✔
UNCOV
49
            yield xml if block_given?
86✔
UNCOV
50
            collection_xml(xml)
86✔
UNCOV
51
            if @pid.present?
86✔
UNCOV
52
              xml.pid @pid
86✔
UNCOV
53
            end
UNCOV
54
          end
UNCOV
55
        end
UNCOV
56
      end
57

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