Class: Arclight::Requests::AeonWebEad

Inherits:
Object
  • Object
show all
Defined in:
app/models/arclight/requests/aeon_web_ead.rb

Overview

This object relies on the ability to respond to attributes passed in as query parameters from the form mapping configuration

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(document, ead_url) ⇒ AeonWebEad

Returns a new instance of AeonWebEad.

Parameters:

  • document (Blacklight::SolrDocument)
  • ead_url (String)


13
14
15
16
# File 'app/models/arclight/requests/aeon_web_ead.rb', line 13

def initialize(document, ead_url)
  @document = document
  @ead_url = ead_url
end

Instance Attribute Details

#documentObject (readonly)

Returns the value of attribute document.



9
10
11
# File 'app/models/arclight/requests/aeon_web_ead.rb', line 9

def document
  @document
end

#ead_urlObject (readonly)

Returns the value of attribute ead_url.



9
10
11
# File 'app/models/arclight/requests/aeon_web_ead.rb', line 9

def ead_url
  @ead_url
end

Instance Method Details

#form_mappingHash

Converts mappings as a query url param into a Hash used for sending messages If a defined method is provided as a value, that method will be invoked “collection_name=entry.123” => { “collection_name” => “entry.123” }

Returns:

  • (Hash)


36
37
38
39
40
41
42
43
44
# File 'app/models/arclight/requests/aeon_web_ead.rb', line 36

def form_mapping
  form_hash = Rack::Utils.parse_nested_query(
    document.repository_config.request_mappings_for_type('aeon_web_ead')
  )
  form_hash.each do |key, value|
    respond_to?(value) && form_hash[key] = send(value)
  end
  form_hash
end

#request_urlObject

Url target for Aeon request params



20
21
22
# File 'app/models/arclight/requests/aeon_web_ead.rb', line 20

def request_url
  document.repository_config.request_url_for_type('aeon_web_ead')
end

#urlObject

Constructed request URL



26
27
28
# File 'app/models/arclight/requests/aeon_web_ead.rb', line 26

def url
  "#{request_url}?#{form_mapping.to_query}"
end