Sha256: e7fe20c4c01fc5dc14133c3ad2b8a6aa58f9b20781204ad741c70e197f548796

Contents?: true

Size: 1.15 KB

Versions: 11

Compression:

Stored size: 1.15 KB

Contents

# Register and configure remote identifiers for persisted objects
Hydra::RemoteIdentifier.configure do |config|
  doi_credentials = Psych.load_file(Rails.root.join("config/doi.yml"))
  config.remote_service(:doi, doi_credentials) do |doi|
    doi.register(GenericWork, Dataset, Article, Etd, Image, Document) do |map|
      map.target {|obj| Curate.permanent_url_for(obj) }
      map.creator :creator
      map.title :title
      map.publisher {|o| Array(o.publisher).join("; ")}
      map.publicationyear {|o| o.date_uploaded.year }
      # Make sure that this method both sets the identifier and persists the change!
      map.set_identifier {|o,value| o.identifier = value; o.save }
    end
  end

  # doi_credentials = Psych.load_file("/path/to/doi_credentials.yml")
  # config.remote_service(:doi, doi_credentials) do |doi|
  #   doi.register(PersistedObject) do |map|
  #     map.target :url
  #     map.creator {|obj| obj.person_name }
  #     map.title :title
  #     map.publisher :publisher
  #     map.publicationyear :publicationyear
  #
  #     # Make sure that this method persists the value
  #     map.set_identifier :set_doi_identifier=
  #   end
  # end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
curate-0.6.6 spec/internal/config/initializers/hydra-remote_identifier_config.rb
curate-0.6.4 spec/internal/config/initializers/hydra-remote_identifier_config.rb
curate-0.6.3 spec/internal/config/initializers/hydra-remote_identifier_config.rb
curate-0.6.1 spec/internal/config/initializers/hydra-remote_identifier_config.rb
curate-0.6.0 spec/internal/config/initializers/hydra-remote_identifier_config.rb
curate-0.5.6 spec/internal/config/initializers/hydra-remote_identifier_config.rb
curate-0.5.5 spec/internal/config/initializers/hydra-remote_identifier_config.rb
curate-0.5.4 spec/internal/config/initializers/hydra-remote_identifier_config.rb
curate-0.5.2 spec/internal/config/initializers/hydra-remote_identifier_config.rb
curate-0.5.1 spec/internal/config/initializers/hydra-remote_identifier_config.rb
curate-0.5.0 spec/internal/config/initializers/hydra-remote_identifier_config.rb