-
Notifications
You must be signed in to change notification settings - Fork 166
LG-13355: filter piv upsell #10976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LG-13355: filter piv upsell #10976
Changes from all commits
2ea9387
0a2080e
d17d324
254c34a
d6cb9b8
62df787
c112136
fbdceda
006df88
7f0f986
81f881b
788eb83
86a789b
9c9d636
7ace915
3287200
423fd19
936d934
7cdbb5b
29bc68b
a5c90fa
e8f0833
279b31c
2e09681
f4909de
26faf64
1c8b180
75fd8d7
53d8294
b842baf
9074684
738308d
5f8e510
026a15d
11552b0
e946f2b
f6d7b8a
1b3e04e
f5e6d5f
20bf08d
5f002a9
819b6f7
71eadc5
24a7714
ce69370
8430b3c
790b615
29fb273
49bf127
8753d51
42055fb
d32b774
9077fa1
06e4152
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| class FederalEmailDomain < ApplicationRecord | ||
| def self.fed_domain?(domain) | ||
| exists?(name: domain) | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| class CreateFederalEmailDomain < ActiveRecord::Migration[7.1] | ||
| def change | ||
| create_table :federal_email_domains do |t| | ||
| t.citext :name, null: false | ||
| end | ||
|
|
||
| add_index :federal_email_domains, :name, unique: true | ||
| end | ||
| end |
|
aduth marked this conversation as resolved.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require 'faraday' | ||
| require 'csv' | ||
|
|
||
| DOT_GOV_DOWNLOAD_PATH = 'https://raw.githubusercontent.com/cisagov/dotgov-data/main/current-federal.csv' | ||
| namespace :federal_email_domains do | ||
| task load_to_db: :environment do |_task, _args| | ||
| response = Faraday.get(DOT_GOV_DOWNLOAD_PATH) | ||
|
|
||
| csv = CSV.parse(response.body, col_sep: ',', headers: true) | ||
| csv.each do |row| | ||
| FederalEmailDomain.find_or_create_by(name: row['Domain name']) | ||
| end | ||
|
Comment on lines
+11
to
+14
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is probably fine since we're only dealing with about 1400 entries, but I'd wonder if this should work a little more like the disposable emails task using If this was a bigger file, I'd also suggest using |
||
| end | ||
| end | ||
| # rake "federal_email_domains:load_to_db" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| FactoryBot.define do | ||
| factory :federal_email_domain do | ||
| end | ||
| end |
Uh oh!
There was an error while loading. Please reload this page.