Class: Hydra::RemoteIdentifier::RemoteServices::Doi
- Inherits:
-
Hydra::RemoteIdentifier::RemoteService
- Object
- Hydra::RemoteIdentifier::RemoteService
- Hydra::RemoteIdentifier::RemoteServices::Doi
- Defined in:
- lib/hydra/remote_identifier/remote_services/doi.rb
Constant Summary collapse
- REQUIRED_ATTRIBUTES =
['target', 'creator', 'title', 'publisher', 'publicationyear' ].freeze
Instance Attribute Summary collapse
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #call(payload) ⇒ Object
-
#initialize(configuration = {}) ⇒ Doi
constructor
A new instance of Doi.
- #valid_attribute?(attribute_name) ⇒ Boolean
Constructor Details
#initialize(configuration = {}) ⇒ Doi
Returns a new instance of Doi.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/hydra/remote_identifier/remote_services/doi.rb', line 11 def initialize(configuration = {}) username = configuration.fetch(:username) password = configuration.fetch(:password) shoulder = configuration.fetch(:shoulder) url = configuration.fetch(:url) # This is specific for the creation of DOIs @uri = URI.parse(File.join(url, 'shoulder', shoulder)) @uri.user = username @uri.password = password end |
Instance Attribute Details
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
10 11 12 |
# File 'lib/hydra/remote_identifier/remote_services/doi.rb', line 10 def uri @uri end |
Instance Method Details
#call(payload) ⇒ Object
28 29 30 |
# File 'lib/hydra/remote_identifier/remote_services/doi.rb', line 28 def call(payload) request(data_for_create(payload.with_indifferent_access)) end |
#valid_attribute?(attribute_name) ⇒ Boolean
24 25 26 |
# File 'lib/hydra/remote_identifier/remote_services/doi.rb', line 24 def valid_attribute?(attribute_name) REQUIRED_ATTRIBUTES.include?(attribute_name.to_s) end |