Class: Qa::LinkedData::AuthorityUrlService

Inherits:
Object
  • Object
show all
Defined in:
app/services/qa/linked_data/authority_url_service.rb

Class Method Summary collapse

Class Method Details

.build_url(action_config:, action:, action_request:, substitutions: {}, subauthority: nil) ⇒ Object

Build a url for an authority/subauthority for the specified action.

Parameters:

  • authority (Symbol)

    name of a registered authority

  • subauthority (String) (defaults to: nil)

    name of a subauthority

  • action (Symbol)

    action with valid values :search or :term

  • action_request (String)

    the request the user is making of the authority (e.g. query text or term id/uri)

  • substitutions (Hash) (defaults to: {})

    variable-value pairs to substitute into the URL template

Returns:

  • a valid URL the submits the action request to the external authority



13
14
15
16
17
18
# File 'app/services/qa/linked_data/authority_url_service.rb', line 13

def build_url(action_config:, action:, action_request:, substitutions: {}, subauthority: nil)
  action_validation(action)
  url_config = action_config.url_config
  selected_substitutions = url_config.extract_substitutions(combined_substitutions(action_config, action, action_request, substitutions, subauthority))
  Qa::IriTemplateService.build_url(url_config: url_config, substitutions: selected_substitutions)
end