Class: Fountain::Api::Applicants

Inherits:
Object
  • Object
show all
Extended by:
RequestHelper
Defined in:
lib/fountain/api/applicants.rb

Overview

Fountain Applicant Management API

Constant Summary

Constants included from RequestHelper

RequestHelper::DEFAULT_REQUEST_OPTIONS

Class Method Summary collapse

Methods included from RequestHelper

request, request_json

Class Method Details

.advance_applicant(applicant_id, advance_options = {}) ⇒ Object

Advance an Applicant

Parameters:

  • applicant_id (String)

    ID of the Fountain applicant

  • advance_options (Hash) (defaults to: {})

    A hash of options to advance applicant skip_automated_actions - ‘true` if you want to skip automated

    actions when advancing the applicant
    

    stage_id - Destination stage’s ID. If not provided, the applicant

    will advance to the next stage by default.
    


127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/fountain/api/applicants.rb', line 127

def self.advance_applicant(applicant_id, advance_options = {})
  response = request(
    "/v2/applicants/#{applicant_id}/advance",
    method: :put,
    body: Util.slice_hash(
      advance_options,
      :skip_automated_actions, :stage_id, :funnel_id
    )
  )
  check_response response, Net::HTTPNoContent
  true
end

.advance_applicants(applicant_ids, stage_id, advanced_options = {}) ⇒ Object

Advance multiple Applicants

Parameters:

  • applicant_id (String)

    IDs of the Fountain applicants

  • Destination (String)

    stage’s ID

  • advance_options (Hash)

    A hash of options to advance applicant skip_automated_actions - ‘true` if you want to skip automated

    actions when advancing the applicant
    

    funnel_id - Used for bulk advancing applicants to a workflow-based funnel



148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/fountain/api/applicants.rb', line 148

def self.advance_applicants(applicant_ids, stage_id, advanced_options = {})
  response = request(
    "/v2/applicants/advance?stage_id=#{stage_id}",
    method: :post,
    body: Util.slice_hash(
      advanced_options,
      :skip_automated_actions, :funnel_id
    ).merge(ids: applicant_ids)
  )
  check_response response, Net::HTTPNoContent
  true
end

.create(name, email, phone_number, create_options = {}) ⇒ Fountain::Applicant

Create an Applicant

Parameters:

  • name (String)

    Full name of the applicant

  • email (String)

    Email address of the applicant

  • phone_number (String)

    Phone number (does not have to be USA)

  • create_options (Hash) (defaults to: {})

    A hash of optional parameters data - must be passed in a data object/array secure_data - See ‘Secure Fields’ section of

    https://developer.fountain.com/docs/post-apiv2applicants
    

    funnel_id - Create applicant under a certain opening (funnel) stage_id - Create applicant under a certain stage skip_automated_actions - ‘true` if you want to skip automated

    actions when advancing the applicant
    

Returns:



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/fountain/api/applicants.rb', line 45

def self.create(name, email, phone_number, create_options = {})
  filtered_params = Util.slice_hash(
    create_options,
    :data, :secure_data, :funnel_id, :stage_id, :skip_automated_actions
  )
  response = request_json(
    '/v2/applicants',
    method: :post,
    expected_response: [Net::HTTPCreated, Net::HTTPOK],
    body: {
      name: name, email: email, phone_number: phone_number
    }.merge(filtered_params)
  )
  Fountain::Applicant.new response
end

.delete(applicant_id) ⇒ Boolean

Delete an Applicant

Parameters:

  • applicant_id (String)

    ID of the Fountain applicant

Returns:

  • (Boolean)


65
66
67
68
69
70
71
72
# File 'lib/fountain/api/applicants.rb', line 65

def self.delete(applicant_id)
  response = request(
    "/v2/applicants/#{applicant_id}",
    method: :delete
  )
  check_response response
  true
end

.get(applicant_id) ⇒ Fountain::Applicant

Get Applicant Info

Parameters:

  • applicant_id (String)

    ID of the Fountain applicant

Returns:



78
79
80
81
# File 'lib/fountain/api/applicants.rb', line 78

def self.get(applicant_id)
  response = request_json("/v2/applicants/#{applicant_id}")
  Fountain::Applicant.new response
end

.get_interview_sessions(applicant_id) ⇒ [Fountain::Slot]

Get Interview Sessions

Parameters:

  • applicant_id (String)

    ID of the Fountain applicant

Returns:



165
166
167
168
# File 'lib/fountain/api/applicants.rb', line 165

def self.get_interview_sessions(applicant_id)
  response = request_json("/v2/applicants/#{applicant_id}/booked_slots")
  response['booked_slots'].map { |hash| Fountain::Slot.new hash }
end

.get_secure_documents(applicant_id) ⇒ [Fountain::SecureDocument]

Get Applicant Documents

Parameters:

  • applicant_id (String)

    ID of the Fountain applicant

Returns:



114
115
116
117
# File 'lib/fountain/api/applicants.rb', line 114

def self.get_secure_documents(applicant_id)
  response = request_json("/v2/applicants/#{applicant_id}/secure_documents")
  response['secure_documents'].map { |hash| Fountain::SecureDocument.new hash }
end

.get_transition_history(applicant_id) ⇒ [Fountain::Transition]

Get Transition History

Parameters:

  • applicant_id (String)

    ID of the Fountain applicant

Returns:



174
175
176
177
# File 'lib/fountain/api/applicants.rb', line 174

def self.get_transition_history(applicant_id)
  response = request_json("/v2/applicants/#{applicant_id}/transitions")
  response['transitions'].map { |hash| Fountain::Transition.new hash }
end

.list(filter_options = {}) ⇒ Fountain::Applicants

List applicants

Parameters:

  • filter_options (Hash) (defaults to: {})

    A hash of options to send to Fountain. funnel_id - Unique identifier of the position/funnel stage_id - Unique identifier of the stage stage - Filter applicants by stage type labels - MUST be URL-encoded cursor - Cursor parameter for cursor-based pagination

Returns:



20
21
22
23
24
25
26
27
28
29
# File 'lib/fountain/api/applicants.rb', line 20

def self.list(filter_options = {})
  response = request_json(
    '/v2/applicants',
    body: Util.slice_hash(
      filter_options,
      :funnel_id, :stage_id, :stage, :labels, :cursor
    )
  )
  Fountain::Applicants.new response
end

.update(applicant_id, update_options = {}) ⇒ Fountain::Applicant

Update Applicant Info

Parameters:

  • applicant_id (String)

    ID of the Fountain applicant

  • update_options (Hash) (defaults to: {})

    A hash of options to update applicant name email phone_number data - must be passed in a data object/array secure_data - See ‘Secure Fields’ section of

    https://developer.fountain.com/docs/update-applicant-info
    

    rejection_reason on_hold_reason

Returns:



97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/fountain/api/applicants.rb', line 97

def self.update(applicant_id, update_options = {})
  response = request_json(
    "/v2/applicants/#{applicant_id}",
    method: :put,
    body: Util.slice_hash(
      update_options,
      :name, :email, :phone_number, :data, :secure_data,
      :rejection_reason, :on_hold_reason
    )
  )
  Fountain::Applicant.new response
end