Sha256: 94450871bf70be4378a2d15085560d3491f976a517afefa2d96452674ba59ee2

Contents?: true

Size: 417 Bytes

Versions: 3

Compression:

Stored size: 417 Bytes

Contents

require "active_resource"

module Ddr
  class RightsStatement < ActiveResource::Base

    self.site = ENV["DDR_AUX_API_URL"]

    def self.call(obj)
      if obj.rights.present?
        new get(:find, url: obj.rights.first)
      end
    rescue ActiveResource::ResourceNotFound => e
      raise Ddr::NotFoundError, e
    end

    def self.keys
      all.map(&:url)
    end

    def to_s
      title
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ddr-core-0.3.0 app/models/ddr/rights_statement.rb
ddr-core-0.2.2 app/models/ddr/rights_statement.rb
ddr-core-0.2.1 app/models/ddr/rights_statement.rb