Class: Hydra::RemoteIdentifier::RemoteService

Inherits:
Object
  • Object
show all
Defined in:
lib/hydra/remote_identifier/remote_service.rb

Overview

The RemoteService is responsible for delivering a payload to a remote identification minting service and returning an identifier.

It is responsible for assisting the construction and validation of a remote payload.

Instance Method Summary collapse

Instance Method Details

#accessor_nameObject

When mapping a Target to a RemoteService, this is the name of the :attr_accessor that will be created on the Target; Helpful for form construction.



41
42
43
# File 'lib/hydra/remote_identifier/remote_service.rb', line 41

def accessor_name
  "mint_#{name}".to_sym
end

#call(payload) ⇒ Object

Returns - The remote identifier that was created.

Parameters:

  • payload (Hash)
    • A map with key/value pairs of valid attribute names

    and corresponding values that will be used to create the remote identifier

Returns:

    • The remote identifier that was created

Raises:

  • (NotImplementedError)

See Also:



60
61
62
63
# File 'lib/hydra/remote_identifier/remote_service.rb', line 60

def call(payload)
  raise NotImplementedError,
    "You must implement #{self.class}#call"
end

#mint(target) ⇒ Object



24
25
26
# File 'lib/hydra/remote_identifier/remote_service.rb', line 24

def mint(target)
  Hydra::RemoteIdentifier.mint(self, target)
end

#nameObject



12
13
14
# File 'lib/hydra/remote_identifier/remote_service.rb', line 12

def name
  self.class.to_s.demodulize.underscore.to_sym
end

#registered?(target) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/hydra/remote_identifier/remote_service.rb', line 20

def registered?(target)
  Hydra::RemoteIdentifier.registered?(self, target)
end

#remote_uri_for(identifier) ⇒ Object

Parameters:

  • identifier (#to_s)
    • An identifier that was created by this remote

    service

Raises:

  • (NotImplementedError)


31
32
33
34
# File 'lib/hydra/remote_identifier/remote_service.rb', line 31

def remote_uri_for(identifier)
  raise NotImplementedError,
    "You must implement #{self.class}#remote_uri_for(identifier)"
end

#to_sObject



16
17
18
# File 'lib/hydra/remote_identifier/remote_service.rb', line 16

def to_s
  name.to_s
end

#valid_attribute?(attribute_name) ⇒ Boolean

Parameters:

  • identifier (#to_s)
    • The name of an attribute that is

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


49
50
51
52
# File 'lib/hydra/remote_identifier/remote_service.rb', line 49

def valid_attribute?(attribute_name)
  raise NotImplementedError,
    "You must implement #{self.class}#valid_attribute?"
end