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:



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

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)


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

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

#request_configObject



47
48
49
# File 'app/models/arclight/requests/aeon_web_ead.rb', line 47

def request_config
  document.repository_config.request_config_for_type('aeon_web_ead')
end

#request_urlObject

Url target for Aeon request params



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

def request_url
  request_config['request_url']
end

#urlObject

Constructed request URL



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

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