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:



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

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)


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

def form_mapping
  Rack::Utils.parse_nested_query(
    document.repository_config&.request_mappings_for_type('google_form')
  )
end

#titleObject



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

def title
  presenter.heading
end

#urlObject

Url of form to fill



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

def url
  document.repository_config&.request_url_for_type('google_form')
end