Class: SimpleFormsApi::FormRemediation::Configuration::Base
- Inherits:
-
Object
- Object
- SimpleFormsApi::FormRemediation::Configuration::Base
- Defined in:
- lib/simple_forms_api/form_remediation/configuration/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#id_type ⇒ Object
readonly
Returns the value of attribute id_type.
-
#include_manifest ⇒ Object
readonly
Returns the value of attribute include_manifest.
-
#include_metadata ⇒ Object
readonly
Returns the value of attribute include_metadata.
-
#parent_dir ⇒ Object
readonly
Returns the value of attribute parent_dir.
-
#presign_s3_url ⇒ Object
readonly
Returns the value of attribute presign_s3_url.
Instance Method Summary collapse
-
#attachment_type ⇒ Object
The attachment model to query for form submission attachments.
-
#handle_error(message, error, **details) ⇒ Object
Utility method, override to add your own team’s preferred error handling approach.
-
#initialize ⇒ Base
constructor
A new instance of Base.
-
#log_error(message, error, **details) ⇒ Object
Utility method, override to add your own team’s preferred error logging approach.
-
#log_info(message, **details) ⇒ Object
Utility method, override to add your own team’s preferred logging approach.
-
#remediation_data_class ⇒ Object
Override to inject your team’s own submission data builder.
-
#s3_client ⇒ Object
Override to inject your team’s own s3 client.
-
#s3_settings ⇒ Object
Used in the SimpleFormsApi::FormRemediation::Uploader S3 uploader.
-
#submission_archive_class ⇒ Object
Override to inject your team’s own submission archive.
-
#submission_type ⇒ Object
The FormSubmission model to query against.
-
#temp_directory_path ⇒ Object
The temporary directory where form submissions will be hydrated and stored.
-
#uploader_class ⇒ Object
Override to inject your team’s own file uploader If overriding this, s3_settings method doesn’t have to be set.
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
11 12 13 14 15 16 17 |
# File 'lib/simple_forms_api/form_remediation/configuration/base.rb', line 11 def initialize @id_type = :benefits_intake_uuid # The field to query the FormSubmission by @include_manifest = true # Include a CSV file containing manifest data @include_metadata = false # Include a JSON file containing form submission metadata @parent_dir = '' # The base directory in the S3 bucket where the archive will be stored @presign_s3_url = true # Once archived to S3, the service should generate & return a presigned_url end |
Instance Attribute Details
#id_type ⇒ Object (readonly)
Returns the value of attribute id_type.
9 10 11 |
# File 'lib/simple_forms_api/form_remediation/configuration/base.rb', line 9 def id_type @id_type end |
#include_manifest ⇒ Object (readonly)
Returns the value of attribute include_manifest.
9 10 11 |
# File 'lib/simple_forms_api/form_remediation/configuration/base.rb', line 9 def include_manifest @include_manifest end |
#include_metadata ⇒ Object (readonly)
Returns the value of attribute include_metadata.
9 10 11 |
# File 'lib/simple_forms_api/form_remediation/configuration/base.rb', line 9 def @include_metadata end |
#parent_dir ⇒ Object (readonly)
Returns the value of attribute parent_dir.
9 10 11 |
# File 'lib/simple_forms_api/form_remediation/configuration/base.rb', line 9 def parent_dir @parent_dir end |
#presign_s3_url ⇒ Object (readonly)
Returns the value of attribute presign_s3_url.
9 10 11 |
# File 'lib/simple_forms_api/form_remediation/configuration/base.rb', line 9 def presign_s3_url @presign_s3_url end |
Instance Method Details
#attachment_type ⇒ Object
The attachment model to query for form submission attachments
46 47 48 |
# File 'lib/simple_forms_api/form_remediation/configuration/base.rb', line 46 def PersistentAttachment end |
#handle_error(message, error, **details) ⇒ Object
Utility method, override to add your own team’s preferred error handling approach
73 74 75 76 |
# File 'lib/simple_forms_api/form_remediation/configuration/base.rb', line 73 def handle_error(, error, **details) log_error(, error, **details) raise SimpleFormsApi::FormRemediation::Error.new(message:, error:) end |
#log_error(message, error, **details) ⇒ Object
Utility method, override to add your own team’s preferred error logging approach
68 69 70 |
# File 'lib/simple_forms_api/form_remediation/configuration/base.rb', line 68 def log_error(, error, **details) Rails.logger.error({ message:, error: error., backtrace: error.backtrace.first(5) }.merge(details)) end |
#log_info(message, **details) ⇒ Object
Utility method, override to add your own team’s preferred logging approach
63 64 65 |
# File 'lib/simple_forms_api/form_remediation/configuration/base.rb', line 63 def log_info(, **details) Rails.logger.info({ message: }.merge(details)) end |
#remediation_data_class ⇒ Object
Override to inject your team’s own submission data builder
30 31 32 |
# File 'lib/simple_forms_api/form_remediation/configuration/base.rb', line 30 def remediation_data_class SimpleFormsApi::FormRemediation::SubmissionRemediationData end |
#s3_client ⇒ Object
Override to inject your team’s own s3 client
25 26 27 |
# File 'lib/simple_forms_api/form_remediation/configuration/base.rb', line 25 def s3_client SimpleFormsApi::FormRemediation::S3Client end |
#s3_settings ⇒ Object
Used in the SimpleFormsApi::FormRemediation::Uploader S3 uploader
58 59 60 |
# File 'lib/simple_forms_api/form_remediation/configuration/base.rb', line 58 def s3_settings raise NotImplementedError, 'Class must implement s3_settings method' end |
#submission_archive_class ⇒ Object
Override to inject your team’s own submission archive
20 21 22 |
# File 'lib/simple_forms_api/form_remediation/configuration/base.rb', line 20 def submission_archive_class SimpleFormsApi::FormRemediation::SubmissionArchive end |
#submission_type ⇒ Object
The FormSubmission model to query against
41 42 43 |
# File 'lib/simple_forms_api/form_remediation/configuration/base.rb', line 41 def submission_type FormSubmission end |
#temp_directory_path ⇒ Object
The temporary directory where form submissions will be hydrated and stored. This directory will automatically be deleted once the archive process completes
53 54 55 |
# File 'lib/simple_forms_api/form_remediation/configuration/base.rb', line 53 def temp_directory_path Rails.root.join("tmp/#{SecureRandom.hex}-archive/").to_s end |
#uploader_class ⇒ Object
Override to inject your team’s own file uploader If overriding this, s3_settings method doesn’t have to be set
36 37 38 |
# File 'lib/simple_forms_api/form_remediation/configuration/base.rb', line 36 def uploader_class SimpleFormsApi::FormRemediation::Uploader end |