Class: V1::RecruitingCampaignsController

Inherits:
ApiController
  • Object
show all
Defined in:
api/app/api/v1/recruiting_campaigns_controller.rb

Overview

Manage and retrieve recruiting campaigns

Constant Summary collapse

CREATE_PARAMS =
:event_id, :participation_frequency, :name, :description, :subjects_can_screen, :token, :allow_anonymous_access, :disable_scheduling, :exclude_panelists, :exclude_anonymous_dependents, :blast_frequency, :call_frequency,
:interaction_factor, :quota_factor, :engagement_factor, :date_format, :time_format,
recruiting_campaign_filters_attributes: [:id, :recruiting_campaign_id, :filter_type, :polarity, :minimum, :maximum, :time_unit, :target_type, { location_ids: [] }, { panel_ids: [] }, { event_ids: [] }, { campaign_to_qualify_for_ids: [] }, { outcome_ids: [] }, { demographic_ids: [] }, { onboarding_configuration_ids: [] }, { onboarding_configuration_demographic_category_ids: [] }, { languages: [] }],
linked_recruiting_campaigns_attributes: %i[id parent_recruiting_campaign_id]].freeze
UPDATE_PARAMS =
:id, :event_id, :participation_frequency, :name, :description, :call_frequency,
:blast_frequency, :launched_at, :archived_at, :using_screener, :subjects_can_screen, :allow_anonymous_access, :token, :disable_scheduling, :exclude_panelists, :exclude_anonymous_dependents,
:interaction_factor, :quota_factor, :engagement_factor, :date_format, :time_format,
recruiting_campaign_filters_attributes: [:id, :recruiting_campaign_id, :filter_type, :polarity, :minimum, :maximum, :time_unit, :target_type, :_destroy, { location_ids: [] }, { panel_ids: [] }, { event_ids: [] }, { campaign_to_qualify_for_ids: [] }, { outcome_ids: [] }, { demographic_ids: [] }, { onboarding_configuration_ids: [] }, { onboarding_configuration_demographic_category_ids: [] }, { languages: [] }],
linked_recruiting_campaigns_attributes: %i[id parent_recruiting_campaign_id _destroy]].freeze

Instance Method Summary collapse

Instance Method Details

#createHash<String, RecruitingCampaign>

Create a campaign

Returns:

See Also:

#destroyHash<String, RecruitingCampaign>

Delete a campaign

  curl --request DELETE \
    --header "authorization: Bearer $bearer_token" \
    https://app.redjade.net/api/v1/recruiting_campaigns/3

Returns:

#indexHash<String, Array<RecruitingCampaign>>

Search campaigns for multiple use cases

Options

  • [Integer] subject_id - what campaigns can a particular subject participate in?

    Returns relevant campaigns by subject:

    • if a subject is not already scheduled for another campaign with a conflicting schedule
    • if a subject has not had a final outcome for this campaign, e.g. rejected
    • if a subject is already scheduled for a particular campaign then that campaign is included
    • if the campaign is launched
    • if the campaign has an anonymous URL set (token, also set on the campaign details page)
    • one of the following is true:

      • the campaign has disable_scheduling set true
      • the campaign's event that has available session seats left
      • the campaign's event that is location_type of online
        • [Boolean] ignore_subjects_can_screen

      If this option is not true, one of the following must be true for a campaign to be included

      • the subject already has it scheduled
      • subjects_can_screen is true (checkbox on the campaign details page)
      • the campaign has an anonymous URL set (token, also set on the campaign details page)
  • [Integer] event_id - all campaigns for an event

  • [Boolean] include_archived (default FALSE)

  • [DateTime] start_date, end_date - uses the provided range to check for overlap with the a campaign's event schedule (event.start_time -> end_time)

Example: Fetch campaigns for a subject

  subject_id=139
  curl --request GET \
    --header "authorization: Bearer $bearer_token" \
    --header "Content-Type: application/json" \
    --data "{\"subject_id\": $subject_id}" \
    https://app.redjade.net/api/v1/recruiting_campaigns/ | \
    jq '.response | first'

Returns:

#lookupHash<String, Array<RecruitingCampaign>>

Get one or more campaigns

Options

  • [Array] ids - inclusive list of ids
  curl --request GET \
    --header "authorization: Bearer $bearer_token" \
    https://app.redjade.net/api/v1/recruiting_campaigns/?ids[]=11&ids[]=10

Returns:

#showHash<String, RecruitingCampaign>

Get one campaign

  curl --request GET \
    --header "authorization: Bearer $bearer_token" \
    https://app.redjade.net/api/v1/recruiting_campaigns/11

Returns:

#sync_demographicsBoolean

POST to sync demographics from the campaign (isolated participant demographics) to the subject database (global subject demographics)

  curl --request POST \
    --header "authorization: Bearer $bearer_token" \
    https://app.redjade.net/api/v1/recruiting_campaigns/11/sync_demographics

Returns:

  • (Boolean)

    true

#updateHash<String, RecruitingCampaign>

Update a campaign

Returns:

See Also: