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

pulibrary / tigerdata-app / c4214121-fbbb-4bc6-b44a-565342302937

30 Jul 2025 08:03PM UTC coverage: 75.796% (+0.2%) from 75.625%
c4214121-fbbb-4bc6-b44a-565342302937

Pull #1666

circleci

hectorcorrea
Rubocop made me do it
Pull Request #1666: Refactor project creation in Mediaflux

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

28 existing lines in 2 files now uncovered.

2239 of 2954 relevant lines covered (75.8%)

317.46 hits per line

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

55.0
/app/models/project_mediaflux.rb
1
# frozen_string_literal: true
2

3
# A custom exception class for when a namespace path is already taken
4
class MediafluxDuplicateNamespaceError < StandardError
1✔
5
end
6

7
# Take an instance of Project and adds it to MediaFlux
8
class ProjectMediaflux
1✔
9
  # If the project hasn't yet been created in mediaflux, create it.
10
  # If it already exists, update it.
11
  # @return [String] the mediaflux id of the project
12
  def self.save(project:, user:, xml_namespace: nil)
1✔
UNCOV
13
    session_id = user.mediaflux_session
×
UNCOV
14
    if project.mediaflux_id.nil?
×
NEW
UNCOV
15
      mediaflux_id = project.approve!(current_user: user)
×
UNCOV
16
      Rails.logger.debug "Project #{project.id} has been created in MediaFlux (asset id #{mediaflux_id})"
×
17
    else
UNCOV
18
      ProjectMediaflux.update(project: project, user: user)
×
UNCOV
19
      Rails.logger.debug "Project #{project.id} has been updated in MediaFlux (asset id #{project.mediaflux_id})"
×
20
    end
UNCOV
21
    project.reload
×
UNCOV
22
    project.mediaflux_id
×
23
  end
24

25
  # # Create a project in MediaFlux
26
  # #
27
  # # @param project [Project] the project that needs to be added to MediaFlux
28
  # # @param session_id [] the session id for the user who is currently authenticated to MediaFlux
29
  # # @param xml_namespace []
30
  # # @return [String] The id of the project that got created
31
  # def self.create!(project:, user:, xml_namespace: nil)
32
  #   project.approve!(current_user: user)
33
  #   project.mediaflux_id
34
  # end
35

36
  def self.update(project:, user:)
1✔
NEW
UNCOV
37
    raise "Update in Mediaflux has not been implemented"
×
38
  end
39

40
  # Returns the XML string with the mediaflux metadata
41
  def self.xml_payload(project:, user:, xml_namespace: nil)
1✔
42
    request = Mediaflux::AssetMetadataRequest.new(session_token: user.mediaflux_session, id: project.mediaflux_id)
1✔
43
    request.resolve
1✔
44
    request.response_body
1✔
45
  end
46

47
  # Returns an XML document with the mediaflux metadata
48
  def self.document(project:, user:, xml_namespace: nil)
1✔
49
    xml_body = xml_payload(project:, user:, xml_namespace:)
1✔
50
    Nokogiri::XML.parse(xml_body)
1✔
51
  end
52
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