Class: Arclight::Requests::GoogleForm

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

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(document, presenter, document_url) ⇒ GoogleForm

Returns a new instance of GoogleForm.

Parameters:



17
18
19
20
21
# File 'app/models/arclight/requests/google_form.rb', line 17

def initialize(document, presenter, document_url)
  @document = document
  @presenter = presenter
  @document_url = document_url
end

Instance Attribute Details

#documentObject (readonly)

Returns the value of attribute document.



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

def document
  @document
end

#document_urlObject (readonly)

Returns the value of attribute document_url.



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

def document_url
  @document_url
end

#presenterObject (readonly)

Returns the value of attribute presenter.



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

def presenter
  @presenter
end

Instance Method Details

#form_mappingHash

Converts mappings as a query url param into a Hash used for sending messages and providing pre-filled form fields “collection_name=entry.123” => { “collection_name” => “entry.123” }

Returns:

  • (Hash)


34
35
36
37
38
# File 'app/models/arclight/requests/google_form.rb', line 34

def form_mapping
  Rack::Utils.parse_nested_query(
    request_config['request_mappings']
  )
end

#request_configObject



44
45
46
# File 'app/models/arclight/requests/google_form.rb', line 44

def request_config
  document.repository_config&.request_config_for_type('google_form')
end

#titleObject



40
41
42
# File 'app/models/arclight/requests/google_form.rb', line 40

def title
  presenter.heading
end

#urlObject

Url of form to fill



25
26
27
# File 'app/models/arclight/requests/google_form.rb', line 25

def url
  request_config['request_url']
end