Class: Arclight::Requests::AeonExternalRequest
- Inherits:
-
Object
- Object
- Arclight::Requests::AeonExternalRequest
- Defined in:
- app/models/arclight/requests/aeon_external_request.rb
Overview
This class should be used to turn configuration into a URL and POST form specifically aimed at Aeon’s external request endpoint (support.atlas-sys.com/hc/en-us/articles/360011820054-External-Request-Endpoint)
Instance Method Summary collapse
- #config ⇒ Object
- #dynamic_mappings ⇒ Object
- #form_mapping ⇒ Object
-
#initialize(document, presenter) ⇒ AeonExternalRequest
constructor
A new instance of AeonExternalRequest.
- #static_mappings ⇒ Object
- #url ⇒ Object
- #url_params ⇒ Object
Constructor Details
#initialize(document, presenter) ⇒ AeonExternalRequest
Returns a new instance of AeonExternalRequest.
10 11 12 13 |
# File 'app/models/arclight/requests/aeon_external_request.rb', line 10 def initialize(document, presenter) @document = document @presenter = presenter end |
Instance Method Details
#config ⇒ Object
15 16 17 |
# File 'app/models/arclight/requests/aeon_external_request.rb', line 15 def config @config ||= @document.repository_config.request_config_for_type('aeon_external_request_endpoint') end |
#dynamic_mappings ⇒ Object
31 32 33 34 35 |
# File 'app/models/arclight/requests/aeon_external_request.rb', line 31 def dynamic_mappings config['request_mappings']['accessor'].transform_values do |v| @document.public_send(v.to_sym) end end |
#form_mapping ⇒ Object
23 24 25 |
# File 'app/models/arclight/requests/aeon_external_request.rb', line 23 def form_mapping static_mappings.merge(dynamic_mappings) end |
#static_mappings ⇒ Object
27 28 29 |
# File 'app/models/arclight/requests/aeon_external_request.rb', line 27 def static_mappings config['request_mappings']['static'] end |
#url ⇒ Object
19 20 21 |
# File 'app/models/arclight/requests/aeon_external_request.rb', line 19 def url "#{config['request_url']}?#{url_params}" end |
#url_params ⇒ Object
37 38 39 |
# File 'app/models/arclight/requests/aeon_external_request.rb', line 37 def url_params config['request_mappings']['url_params'].to_query end |