Sha256: 2c474138aa4b8ed9ef787a645c66b77c8149fd6097c285fbb943f3fdc3b3723a

Contents?: true

Size: 1.02 KB

Versions: 13

Compression:

Stored size: 1.02 KB

Contents

module RightsService
  extend Deprecation
  mattr_accessor :authority
  begin
    self.authority = Qa::Authorities::Local.subauthority_for('rights')
  rescue Qa::InvalidSubAuthority
    Deprecation.warn(RightsService, "You are using the deprecated RightsService module, but you do not have 'rights.yml'. Switch to CurationConcerns::LicenseService instead")
    self.authority = Qa::Authorities::Local.subauthority_for('licenses')
  end

  def self.select_all_options
    Deprecation.warn(RightsService, "RightsService is deprecated. Use CurationConcerns.config.license_service_class instead. This will be removed in curation_concerns 2.0")
    authority.all.map do |element|
      [element[:label], element[:id]]
    end
  end

  def self.select_active_options
    active_elements.map { |e| [e[:label], e[:id]] }
  end

  def self.active?(id)
    authority.find(id).fetch('active')
  end

  def self.label(id)
    authority.find(id).fetch('term')
  end

  def self.active_elements
    authority.all.select { |e| active?(e[:id]) }
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
curation_concerns-1.7.8 app/services/rights_service.rb
curation_concerns-1.7.7 app/services/rights_service.rb
curation_concerns-2.0.0 app/services/rights_service.rb
curation_concerns-2.0.0.rc2 app/services/rights_service.rb
curation_concerns-1.7.6 app/services/rights_service.rb
curation_concerns-1.7.5 app/services/rights_service.rb
curation_concerns-1.7.4 app/services/rights_service.rb
curation_concerns-1.7.3 app/services/rights_service.rb
curation_concerns-1.7.2 app/services/rights_service.rb
curation_concerns-2.0.0.rc1 app/services/rights_service.rb
curation_concerns-1.7.1 app/services/rights_service.rb
curation_concerns-1.7.0 app/services/rights_service.rb
curation_concerns-1.7.0.beta1 app/services/rights_service.rb