Skip to content

Commit

Permalink
Update site scanner url
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanwoldatwork authored Apr 12, 2023
2 parents 4392cc5 + e463498 commit 25477fd
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 25 deletions.
2 changes: 1 addition & 1 deletion app/models/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def self.to_csv
services = Service.order('organizations.name').includes(:organization)

example_service_attributes = Service.new.attributes
attributes = example_service_attributes.keys
attributes = example_service_attributes.keys + [:organization_name]

CSV.generate(headers: true) do |csv|
csv << attributes
Expand Down
2 changes: 1 addition & 1 deletion app/models/website.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def validate_domain_suffix
end

def site_scanner_json_request
url = "https://api.gsa.gov/technology/site-scanning/v1/websites/#{domain}?api_key=#{ENV.fetch('API_DATA_GOV_KEY')}&limit=10"
url = "https://api.gsa.gov/technology/site-scanning/v1/websites?target_url_domain=#{domain}&api_key=GTanZOFHw4ilAiAXtnPkHOLyfEcnmww9GabQwinn&limit=10"
text = URI.open(url).read
rescue StandardError => e
"Error during Site Scanner API request for #{domain}.\n\n#{e}"
Expand Down
19 changes: 14 additions & 5 deletions app/views/admin/omb_cx_reporting_collections/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,22 @@
</div>
<div class="field">
<%= form.label :service_provided, class: "usa-label" %>
<p class="font-sans-2xs text-muted">
Describe the service that is being measured.
</p>
<%= form.text_field :service_provided, class: "usa-input", placeholder: "Description of the service provided", required: true %>
</div>
<div class="field">
<%= form.label :transaction_point, class: "usa-label" %>
<%= form.text_field :transaction_point, class: "usa-input", placeholder: "Transaction point at which survey is provided" %>
</div>
<div class="field">
<%= form.label :channel, class: "usa-label" %>
<%= form.select :channel, Service.channels, { prompt: "What type of response channel?" }, class: "usa-select" %>
</div>
<div class="field">
<%= form.label :transaction_point, class: "usa-label" %>
<p class="font-sans-2xs">
Describe at what point in the user journey is the user prompted to complete the survey.
</p>
<%= form.text_field :transaction_point, class: "usa-input" %>
</div>
<div class="field">
<%= form.label :volume_of_customers, class: "usa-label" %>
<%= form.number_field :volume_of_customers, class: "usa-input", placeholder: "# of customers (total volume)" %>
Expand All @@ -58,7 +64,10 @@
</div>
<div class="field">
<%= form.label :federal_register_url, class: "usa-label" %>
<%= form.text_field :federal_register_url, class: "usa-input", placeholder: "https://federalregister.gov/..." %>
<p class="font-sans-2xs text-muted">
Enter the <a href="https://www.reginfo.gov/" target="_blank">reginfo.gov</a> URL for the survey form.
</p>
<%= form.text_field :federal_register_url, class: "usa-input", placeholder: "https://www.reginfo.gov/...", required: true %>
</div>
<div class="field">
<%= form.label :operational_metrics, class: "usa-label" %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/websites/statuscard.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Website Status card for <%= @website.domain %>
<br>

<div>
<%= render 'components/site_scanner_results' %>
<%= render 'components/site_scanner_results', website: @website %>
</div>

<br>
Expand Down
31 changes: 14 additions & 17 deletions app/views/components/_site_scanner_results.html.erb
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
<% begin %>
<% text = @website.site_scanner_json_request %>
<% hash = JSON.parse(text) %>
<% hash = JSON.parse(text)["items"].select { |item| item["final_url"] == "https://#{website.domain}/" }.first %>

<h2>
Site Scanner results
</h2>

<div class="grid-row">
<div class="grid-col-6">
</div>
<div class="grid-col-6">
</div>
</div>

<div class="grid-row">
<div class="grid-col-6">

</div>
<div class="grid-col-6">
</div>
</div>

<div class="well">
<div class="grid-row">
<div class="grid-col-6">
<div class="text-uppercase font-body-3xs">
Target URL Domain
</div>
<%= hash["target_url_domain"] %>
<br>
<br>
<div class="text-uppercase font-body-3xs">
Scan date
</div>
<%= hash["scan_date"] %>
<br>
<br>
<div class="text-uppercase font-body-3xs">
Web Domain
</div>
Expand Down Expand Up @@ -121,7 +118,7 @@
Latest Version
</div>
<!-- TODO: Automate. For now: Update by hand -->
2.11.2
3.4.1
</div>
</div>
</div>
Expand Down

0 comments on commit 25477fd

Please sign in to comment.