openSUSE/open-build-service

View on GitHub
src/api/app/models/package_file.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
# Backend::File model to represent files that belongs to the package in the backend
class PackageFile < Backend::File
  attr_accessor :project_name, :package_name

  validates :project_name, :package_name, presence: true

  # calculates the real url on the backend to search the file
  def full_path(query = {})
    Addressable::URI.encode("/source/#{project_name}/#{package_name}/#{name}") + "?#{query.to_query}"
  end
end