-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into 97128-improve-accessibility-of-generated-pdf
- Loading branch information
Showing
82 changed files
with
18,692 additions
and
1,397 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
lib/disability_compensation/providers/brd/lighthouse_staging_brd_provider.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'disability_compensation/providers/brd/lighthouse_brd_provider' | ||
require 'lighthouse/benefits_reference_data_staging/service' | ||
|
||
class LighthouseStagingBRDProvider < LighthouseBRDProvider | ||
def initialize(_current_user) | ||
super | ||
@service = BenefitsReferenceData::Staging::Service.new | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'simple_forms_api/form_remediation/configuration/vff_config' | ||
|
||
module Forms | ||
module SubmissionStatuses | ||
class PdfUrls | ||
VFF_FORMS = %w[20-10206 20-10207 21-0845 21-0966 21-0972 21-10210 21-4138 21-4142 21P-0847 26-4555 40-0247 | ||
40-10007].freeze | ||
|
||
def initialize(form_id:, submission_guid:) | ||
@form_id = form_id | ||
@submission_guid = submission_guid | ||
end | ||
|
||
def fetch_url | ||
config = determine_config | ||
SimpleFormsApi::FormRemediation::S3Client.fetch_presigned_url(@submission_guid, config:) | ||
end | ||
|
||
def supported? | ||
determine_config | ||
rescue Common::Exceptions::Forbidden | ||
false | ||
else | ||
true | ||
end | ||
|
||
private | ||
|
||
def determine_config | ||
return SimpleFormsApi::FormRemediation::Configuration::VffConfig.new if VFF_FORMS.include?(@form_id) | ||
|
||
raise Common::Exceptions::Forbidden, detail: "Form '#{@form_id}' does not support pdf downloads" | ||
end | ||
end | ||
end | ||
end |
68 changes: 68 additions & 0 deletions
68
lib/lighthouse/benefits_reference_data_staging/configuration.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'common/client/configuration/rest' | ||
require 'faraday/multipart' | ||
|
||
module BenefitsReferenceData | ||
## | ||
# HTTP client configuration for the {BenefitsReferenceData::Service}, | ||
# sets the base path, the base request headers, and a service name for breakers and metrics. | ||
|
||
module Staging | ||
class Configuration < Common::Client::Configuration::REST | ||
self.read_timeout = Settings.lighthouse.benefits_reference_data.timeout || 20 | ||
|
||
## | ||
# @return [String] Base path for benefits_reference_data URLs. | ||
# | ||
def base_path | ||
settings = Settings.lighthouse.benefits_reference_data | ||
url = settings.staging_url | ||
path = settings.path | ||
version = settings.version | ||
safe_slash_merge(url, path, version) | ||
end | ||
|
||
## | ||
# @return [String] Service name to use in breakers and metrics. | ||
# | ||
def service_name | ||
'BenefitsReferenceDataStaging' | ||
end | ||
|
||
## | ||
# @return [Hash] The basic headers required for any benefits_reference_data API call. | ||
# | ||
def self.base_request_headers | ||
key = Settings.lighthouse.staging_api_key | ||
message = "No api_key set for LH benefits_reference_data_staging. Please set 'lighthouse.staging_api_key'" | ||
raise message if key.nil? | ||
|
||
super.merge('apiKey' => key) | ||
end | ||
|
||
## | ||
# Creates the a connection with parsing json and adding breakers functionality. | ||
# | ||
# @return [Faraday::Connection] a Faraday connection instance. | ||
# | ||
def connection | ||
@conn ||= Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday| | ||
faraday.use :breakers | ||
faraday.use Faraday::Response::RaiseError | ||
|
||
faraday.request :multipart | ||
faraday.request :json | ||
faraday.response :json | ||
faraday.adapter Faraday.default_adapter | ||
end | ||
end | ||
|
||
private | ||
|
||
def safe_slash_merge(*url_segments) | ||
url_segments.map { |segment| segment.sub(%r{^/}, '').chomp('/') }.join('/') | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.