-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #211 from Ches-ctrl/2024-07-04-ai-and-form-fields
2024 07 04 ai and form fields
- Loading branch information
Showing
16 changed files
with
473 additions
and
492 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module Importer | ||
class GetApiFieldsJob < ApplicationJob | ||
include Sidekiq::Status::Worker | ||
|
||
queue_as :importers | ||
sidekiq_options retry: false | ||
|
||
def perform(job) | ||
Importer::GetApiFields.call(job) | ||
end | ||
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
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,56 @@ | ||
module Importer | ||
# Core class for getting form fields directly from the API | ||
# Splits based on category of fields - main, custom, demographic, eeoc | ||
# Known Issues - Building the checkbox logic for the data_compliance section | ||
# Allowable file types (Greenhouse): (File types: pdf, doc, docx, txt, rtf) | ||
# NB. Must include all params to get additional fields from the API | ||
class GetApiFields < ApplicationTask | ||
include FaradayHelpers | ||
|
||
def initialize | ||
# @job = job | ||
# @url = @job.api_url | ||
@url = "https://boards-api.greenhouse.io/v1/boards/cleoai/jobs/4628944002" | ||
# @url = "https://boards-api.greenhouse.io/v1/boards/cleoai/jobs/7301308002" | ||
# @url = "https://boards-api.greenhouse.io/v1/boards/monzo/jobs/6076740" | ||
# @url = "https://boards-api.greenhouse.io/v1/boards/axios/jobs/6009256" | ||
# @url = "https://boards-api.greenhouse.io/v1/boards/11fs/jobs/4060453101" | ||
# @url = "https://boards-api.greenhouse.io/v1/boards/forter/jobs/7259821002" | ||
# @url = "https://boards-api.greenhouse.io/v1/boards/cleoai/jobs/4628944002" | ||
@url += "?questions=true&location_questions=true&demographic_questions=true&&compliance=true&pay_transparency=true" | ||
# @ats_sections = %w[main_fields custom_fields demographic_questions eeoc_fields data_compliance security_code_fields] | ||
@fields = {} | ||
@errors = false | ||
end | ||
|
||
def call | ||
return unless processable | ||
|
||
process | ||
rescue StandardError => e | ||
Rails.logger.error "Error running GetFormFields: #{e.message}" | ||
nil | ||
end | ||
|
||
private | ||
|
||
def processable | ||
@url # && @job | ||
end | ||
|
||
def process | ||
p "Hello from GetApiFields!" | ||
|
||
json = fetch_json(@url) | ||
return unless json | ||
|
||
@fields['main_fields'] = json['questions'] | ||
@fields['demographic_questions'] = json['demographic_questions'] | ||
@fields['location_questions'] = json['location_questions'] | ||
@fields['data_compliance'] = json['data_compliance'] | ||
|
||
puts pretty_generate(@fields) | ||
@fields | ||
end | ||
end | ||
end |
Oops, something went wrong.