Class: V1::SubjectsController
- Inherits:
-
ApiController
- Object
- ApiController
- V1::SubjectsController
- Defined in:
- api/app/api/v1/subjects_controller.rb
Overview
Manage Subjects
Constant Summary collapse
- SUBJECT_PARAMS =
%i[head_of_household code preferred_language contact_exclusion_until_date first_name last_name middle_initial email date_of_birth phone mobile_phone work_phone notes onboarding_completed_at minor_entry_completed_at archived_at cid].freeze
- FILTER_PARAMS =
[:recruiting_campaign_id, :slice, :only_quota_qualified, :search_term, :page, :per, :order_by, :order_dir, :include_archived, :interaction_rating_threshold, :call_eligible, :blast_eligible, :opt_outs, :recruiting_blast_id, :participated, :participated_after, :participated_before, :date_part, :min_age, :max_age, :adult_with_minor_date_part, :adult_with_minor_min_age, :adult_with_minor_max_age, :created_after, :created_before, :has_account, :consented, :can_call, :can_email, { selected_subjects: [], languages: [], location_ids: [], demographic_ids: [], selected_outcomes: [], adult_with_minor_demographic_ids: [] }].freeze
Instance Method Summary collapse
-
#create ⇒ Hash<string, V1::SubjectSerializer>
Create a subject This endpoint allows creation of a subject.
-
#destroy ⇒ Hash<string, V1::SubjectSerializer>
Destroy a subject.
-
#export ⇒ Hash<String, Document>
Export subjects into an excel document.
- #export_params ⇒ Object
- #filter_params ⇒ Object
-
#search ⇒ Hash<String, Array<V1::SubjectSqlSerializer>>
Search subjects.
- #send_email_params ⇒ Object
-
#show ⇒ Hash<string, V1::SubjectSerializer>
Get one subject
bash curl --request GET \ --header "authorization: Bearer $bearer_token" \ https://app.redjade.net/api/v1/subjects/1
. -
#update ⇒ Hash<string, V1::SubjectSerializer>
Update a subject.
Instance Method Details
#create ⇒ Hash<string, V1::SubjectSerializer>
Create a subject This endpoint allows creation of a subject.
Households
All subjects must have a household, but households can be completely blank. Households with a subject must be provided for children.
Example: Create a subject
curl --request POST \
--header "authorization: Bearer $bearer_token" \
--header "Content-Type: application/json" \
--data '{
"code": "P5PG",
"date_of_birth": "19800101",
"demographic_ids": [5505, 17837],
"email": "pan@hotmail.com",
"first_name": "Pan",
"head_of_household": true,
"household": {
"address": "751 Hope St.",
"city": "Nederland",
"country": "US",
"state": "CO",
"address": "751 Hope St.",
"zip": "80466"
},
"last_name": "Gillicutty",
"location_ids": [],
"middle_initial": "Mc",
"phone": "4901021011"
}' \
https://app.redjade.net/api/v1/subjects/
#destroy ⇒ Hash<string, V1::SubjectSerializer>
Destroy a subject
#export_params ⇒ Object
#filter_params ⇒ Object
#search ⇒ Hash<String, Array<V1::SubjectSqlSerializer>>
Search subjects. Unfortunately this one is still a POST because of constraints of a clientside library we used at the time of writing this end point.
Options
- [Integer]
recruiting_campaign_id
limits the scope of the query to a specific campaign- [String]
slice
(optional)rank
or null - anything in ranked for a given campaign- [Integer]
recruiting_blast_id
modifier - apply a particular recruiting blast's filter
- [Integer]
scheduled
- All subjects that were scheduledqualified
- have subject interactions ofalternate
,qualified_accepted
,schedule_conflict
- [Boolean]
only_quota_qualified
ensures at least one subject demographic matching a quota
- [Boolean]
terminated
- failed the screenerunconfirmed
- returns subjects who have been unscheduled. When a session moves, people get assigned anunscheduled
subject interaction for participants scheduled to that session. So they were once scheduled, but are now tentatively "unconfirmed" until someone contacts them and schedules them again.contacted
- anyone interacted with for this campaignineligible
- notqualified
, notscheduled
not in ranking
- [String]
- [Array
] selected_subjects
a list of subjectid
Example: Search for all subjects scheduled to a recruiting campaign
recruiting_campaign_id=123
slice=rank
curl --request POST \
--header "authorization: Bearer $bearer_token" \
--header "Content-Type: application/json" \
--data "{\"recruiting_campaign_id\": $recruiting_campaign_id, \"slice\": $slice }" \
http://localhost:8083/v1/subjects/search
#send_email_params ⇒ Object
#show ⇒ Hash<string, V1::SubjectSerializer>
Get one subject
curl --request GET \
--header "authorization: Bearer $bearer_token" \
https://app.redjade.net/api/v1/subjects/1
#update ⇒ Hash<string, V1::SubjectSerializer>
Update a subject