Sha256: 21e09cf6089f16392266680b97f513d2e9916a5184d3371d42ba1b77a3f6453c

Contents?: true

Size: 434 Bytes

Versions: 12

Compression:

Stored size: 434 Bytes

Contents

require "active_resource"

module Ddr::Models
  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::Models::NotFoundError, e
    end

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

    def to_s
      title
    end

  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ddr-models-2.11.0 lib/ddr/models/rights_statement.rb
ddr-models-2.10.2 lib/ddr/models/rights_statement.rb
ddr-models-2.10.1 lib/ddr/models/rights_statement.rb
ddr-models-2.10.0 lib/ddr/models/rights_statement.rb
ddr-models-2.10.0.rc2 lib/ddr/models/rights_statement.rb
ddr-models-2.10.0.rc1 lib/ddr/models/rights_statement.rb
ddr-models-2.9.2 lib/ddr/models/rights_statement.rb
ddr-models-2.9.1 lib/ddr/models/rights_statement.rb
ddr-models-2.9.0 lib/ddr/models/rights_statement.rb
ddr-models-2.9.0.rc1 lib/ddr/models/rights_statement.rb
ddr-models-2.8.0 lib/ddr/models/rights_statement.rb
ddr-models-2.8.0.rc1 lib/ddr/models/rights_statement.rb