Class: Merge::Ats::CandidatesClient

Inherits:
Object
  • Object
show all
Defined in:
lib/merge_ruby_client/ats/candidates/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ Merge::Ats::CandidatesClient

Parameters:



24
25
26
# File 'lib/merge_ruby_client/ats/candidates/client.rb', line 24

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientMerge::RequestClient (readonly)



20
21
22
# File 'lib/merge_ruby_client/ats/candidates/client.rb', line 20

def request_client
  @request_client
end

Instance Method Details

#create(model:, remote_user_id:, is_debug_mode: nil, run_async: nil, request_options: nil) ⇒ Merge::Ats::CandidateResponse

Creates a ‘Candidate` object with the given values.

Examples:

api = Merge::Client.new(
  base_url: "https://api.example.com",
  environment: Merge::Environment::PRODUCTION,
  api_key: "YOUR_AUTH_TOKEN"
)
api.ats.candidates.create(model: {  }, remote_user_id: "remote_user_id")

Parameters:

  • is_debug_mode (Boolean) (defaults to: nil)

    Whether to include debug fields (such as log file links) in the response.

  • run_async (Boolean) (defaults to: nil)

    Whether or not third-party updates should be run asynchronously.

  • model (Hash)

    Request of type Merge::Ats::CandidateRequest, as a Hash

    • :first_name (String)

    • :last_name (String)

    • :company (String)

    • :title (String)

    • :last_interaction_at (DateTime)

    • :is_private (Boolean)

    • :can_email (Boolean)

    • :locations (Array<String>)

    • :phone_numbers (Array<Merge::Ats::PhoneNumberRequest>)

    • :email_addresses (Array<Merge::Ats::EmailAddressRequest>)

    • :urls (Array<Merge::Ats::UrlRequest>)

    • :tags (Array<String>)

    • :applications (Array<Merge::Ats::CandidateRequestApplicationsItem>)

    • :attachments (Array<Merge::Ats::CandidateRequestAttachmentsItem>)

    • :remote_template_id (String)

    • :integration_params (Hash=> Object)

    • :linked_account_params (Hash=> Object)

  • remote_user_id (String)
  • request_options (Merge::RequestOptions) (defaults to: nil)

Returns:



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/merge_ruby_client/ats/candidates/client.rb', line 126

def create(model:, remote_user_id:, is_debug_mode: nil, run_async: nil, request_options: nil)
  response = @request_client.conn.post do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
    req.headers["X-Account-Token"] = request_options. unless request_options&..nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    req.params = {
      **(request_options&.additional_query_parameters || {}),
      "is_debug_mode": is_debug_mode,
      "run_async": run_async
    }.compact
    req.body = {
      **(request_options&.additional_body_parameters || {}),
      model: model,
      remote_user_id: remote_user_id
    }.compact
    req.url "#{@request_client.get_url(request_options: request_options)}/ats/v1/candidates"
  end
  Merge::Ats::CandidateResponse.from_json(json_object: response.body)
end

#ignore_create(model_id:, reason:, message: nil, request_options: nil) ⇒ Void

Ignores a specific row based on the ‘model_id` in the url. These records will

have their properties set to null, and will not be updated in future syncs. The
"reason" and "message" fields in the request body will be stored for audit
purposes.

Examples:

api = Merge::Client.new(
  base_url: "https://api.example.com",
  environment: Merge::Environment::PRODUCTION,
  api_key: "YOUR_AUTH_TOKEN"
)
api.ats.candidates.ignore_create(model_id: "model_id", reason: GENERAL_CUSTOMER_REQUEST)

Parameters:

Returns:

  • (Void)


269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/merge_ruby_client/ats/candidates/client.rb', line 269

def ignore_create(model_id:, reason:, message: nil, request_options: nil)
  @request_client.conn.post do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
    req.headers["X-Account-Token"] = request_options. unless request_options&..nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    unless request_options.nil? || request_options&.additional_query_parameters.nil?
      req.params = { **(request_options&.additional_query_parameters || {}) }.compact
    end
    req.body = { **(request_options&.additional_body_parameters || {}), reason: reason, message: message }.compact
    req.url "#{@request_client.get_url(request_options: request_options)}/ats/v1/candidates/ignore/#{model_id}"
  end
end

#list(created_after: nil, created_before: nil, cursor: nil, email_addresses: nil, expand: nil, first_name: nil, include_deleted_data: nil, include_remote_data: nil, last_name: nil, modified_after: nil, modified_before: nil, page_size: nil, remote_id: nil, tags: nil, request_options: nil) ⇒ Merge::Ats::PaginatedCandidateList

Returns a list of ‘Candidate` objects.

Examples:

api = Merge::Client.new(
  base_url: "https://api.example.com",
  environment: Merge::Environment::PRODUCTION,
  api_key: "YOUR_AUTH_TOKEN"
)
api.ats.candidates.list

Parameters:

  • created_after (DateTime) (defaults to: nil)

    If provided, will only return objects created after this datetime.

  • created_before (DateTime) (defaults to: nil)

    If provided, will only return objects created before this datetime.

  • cursor (String) (defaults to: nil)

    The pagination cursor value.

  • email_addresses (String) (defaults to: nil)

    If provided, will only return candidates with these email addresses; multiple addresses can be separated by commas.

  • expand (Merge::Ats::Candidates::CandidatesListRequestExpand) (defaults to: nil)

    Which relations should be returned in expanded form. Multiple relation names should be comma separated without spaces.

  • first_name (String) (defaults to: nil)

    If provided, will only return candidates with this first name.

  • include_deleted_data (Boolean) (defaults to: nil)

    Whether to include data that was marked as deleted by third party webhooks.

  • include_remote_data (Boolean) (defaults to: nil)

    Whether to include the original data Merge fetched from the third-party to produce these models.

  • last_name (String) (defaults to: nil)

    If provided, will only return candidates with this last name.

  • modified_after (DateTime) (defaults to: nil)

    If provided, only objects synced by Merge after this date time will be returned.

  • modified_before (DateTime) (defaults to: nil)

    If provided, only objects synced by Merge before this date time will be returned.

  • page_size (Integer) (defaults to: nil)

    Number of results to return per page.

  • remote_id (String) (defaults to: nil)

    The API provider’s ID for the given object.

  • tags (String) (defaults to: nil)

    If provided, will only return candidates with these tags; multiple tags can be separated by commas.

  • request_options (Merge::RequestOptions) (defaults to: nil)

Returns:



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/merge_ruby_client/ats/candidates/client.rb', line 58

def list(created_after: nil, created_before: nil, cursor: nil, email_addresses: nil, expand: nil,
         first_name: nil, include_deleted_data: nil, include_remote_data: nil, last_name: nil, modified_after: nil, modified_before: nil, page_size: nil, remote_id: nil, tags: nil, request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
    req.headers["X-Account-Token"] = request_options. unless request_options&..nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    req.params = {
      **(request_options&.additional_query_parameters || {}),
      "created_after": created_after,
      "created_before": created_before,
      "cursor": cursor,
      "email_addresses": email_addresses,
      "expand": expand,
      "first_name": first_name,
      "include_deleted_data": include_deleted_data,
      "include_remote_data": include_remote_data,
      "last_name": last_name,
      "modified_after": modified_after,
      "modified_before": modified_before,
      "page_size": page_size,
      "remote_id": remote_id,
      "tags": tags
    }.compact
    unless request_options.nil? || request_options&.additional_body_parameters.nil?
      req.body = { **(request_options&.additional_body_parameters || {}) }.compact
    end
    req.url "#{@request_client.get_url(request_options: request_options)}/ats/v1/candidates"
  end
  Merge::Ats::PaginatedCandidateList.from_json(json_object: response.body)
end

#meta_patch_retrieve(id:, request_options: nil) ⇒ Merge::Ats::MetaResponse

Returns metadata for ‘Candidate` PATCHs.

Examples:

api = Merge::Client.new(
  base_url: "https://api.example.com",
  environment: Merge::Environment::PRODUCTION,
  api_key: "YOUR_AUTH_TOKEN"
)
api.ats.candidates.meta_patch_retrieve(id: "id")

Parameters:

Returns:



299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/merge_ruby_client/ats/candidates/client.rb', line 299

def meta_patch_retrieve(id:, request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
    req.headers["X-Account-Token"] = request_options. unless request_options&..nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    unless request_options.nil? || request_options&.additional_query_parameters.nil?
      req.params = { **(request_options&.additional_query_parameters || {}) }.compact
    end
    unless request_options.nil? || request_options&.additional_body_parameters.nil?
      req.body = { **(request_options&.additional_body_parameters || {}) }.compact
    end
    req.url "#{@request_client.get_url(request_options: request_options)}/ats/v1/candidates/meta/patch/#{id}"
  end
  Merge::Ats::MetaResponse.from_json(json_object: response.body)
end

#meta_post_retrieve(request_options: nil) ⇒ Merge::Ats::MetaResponse

Returns metadata for ‘Candidate` POSTs.

Examples:

api = Merge::Client.new(
  base_url: "https://api.example.com",
  environment: Merge::Environment::PRODUCTION,
  api_key: "YOUR_AUTH_TOKEN"
)
api.ats.candidates.meta_post_retrieve

Parameters:

Returns:



331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
# File 'lib/merge_ruby_client/ats/candidates/client.rb', line 331

def meta_post_retrieve(request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
    req.headers["X-Account-Token"] = request_options. unless request_options&..nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    unless request_options.nil? || request_options&.additional_query_parameters.nil?
      req.params = { **(request_options&.additional_query_parameters || {}) }.compact
    end
    unless request_options.nil? || request_options&.additional_body_parameters.nil?
      req.body = { **(request_options&.additional_body_parameters || {}) }.compact
    end
    req.url "#{@request_client.get_url(request_options: request_options)}/ats/v1/candidates/meta/post"
  end
  Merge::Ats::MetaResponse.from_json(json_object: response.body)
end

#partial_update(id:, model:, remote_user_id:, is_debug_mode: nil, run_async: nil, request_options: nil) ⇒ Merge::Ats::CandidateResponse

Updates a ‘Candidate` object with the given `id`.

Examples:

api = Merge::Client.new(
  base_url: "https://api.example.com",
  environment: Merge::Environment::PRODUCTION,
  api_key: "YOUR_AUTH_TOKEN"
)
api.ats.candidates.partial_update(
  id: "id",
  model: {  },
  remote_user_id: "remote_user_id"
)

Parameters:

  • id (String)
  • is_debug_mode (Boolean) (defaults to: nil)

    Whether to include debug fields (such as log file links) in the response.

  • run_async (Boolean) (defaults to: nil)

    Whether or not third-party updates should be run asynchronously.

  • model (Hash)

    Request of type Merge::Ats::PatchedCandidateRequest, as a Hash

    • :first_name (String)

    • :last_name (String)

    • :company (String)

    • :title (String)

    • :last_interaction_at (DateTime)

    • :is_private (Boolean)

    • :can_email (Boolean)

    • :locations (Array<String>)

    • :phone_numbers (Array<Merge::Ats::PhoneNumberRequest>)

    • :email_addresses (Array<Merge::Ats::EmailAddressRequest>)

    • :urls (Array<Merge::Ats::UrlRequest>)

    • :tags (Array<String>)

    • :applications (Array<String>)

    • :attachments (Array<String>)

    • :remote_template_id (String)

    • :integration_params (Hash=> Object)

    • :linked_account_params (Hash=> Object)

  • remote_user_id (String)
  • request_options (Merge::RequestOptions) (defaults to: nil)

Returns:



227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/merge_ruby_client/ats/candidates/client.rb', line 227

def partial_update(id:, model:, remote_user_id:, is_debug_mode: nil, run_async: nil, request_options: nil)
  response = @request_client.conn.patch do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
    req.headers["X-Account-Token"] = request_options. unless request_options&..nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    req.params = {
      **(request_options&.additional_query_parameters || {}),
      "is_debug_mode": is_debug_mode,
      "run_async": run_async
    }.compact
    req.body = {
      **(request_options&.additional_body_parameters || {}),
      model: model,
      remote_user_id: remote_user_id
    }.compact
    req.url "#{@request_client.get_url(request_options: request_options)}/ats/v1/candidates/#{id}"
  end
  Merge::Ats::CandidateResponse.from_json(json_object: response.body)
end

#retrieve(id:, expand: nil, include_remote_data: nil, request_options: nil) ⇒ Merge::Ats::Candidate

Returns a ‘Candidate` object with the given `id`.

Examples:

api = Merge::Client.new(
  base_url: "https://api.example.com",
  environment: Merge::Environment::PRODUCTION,
  api_key: "YOUR_AUTH_TOKEN"
)
api.ats.candidates.retrieve(id: "id")

Parameters:

  • id (String)
  • expand (Merge::Ats::Candidates::CandidatesRetrieveRequestExpand) (defaults to: nil)

    Which relations should be returned in expanded form. Multiple relation names should be comma separated without spaces.

  • include_remote_data (Boolean) (defaults to: nil)

    Whether to include the original data Merge fetched from the third-party to produce these models.

  • request_options (Merge::RequestOptions) (defaults to: nil)

Returns:



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/merge_ruby_client/ats/candidates/client.rb', line 167

def retrieve(id:, expand: nil, include_remote_data: nil, request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
    req.headers["X-Account-Token"] = request_options. unless request_options&..nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    req.params = {
      **(request_options&.additional_query_parameters || {}),
      "expand": expand,
      "include_remote_data": include_remote_data
    }.compact
    unless request_options.nil? || request_options&.additional_body_parameters.nil?
      req.body = { **(request_options&.additional_body_parameters || {}) }.compact
    end
    req.url "#{@request_client.get_url(request_options: request_options)}/ats/v1/candidates/#{id}"
  end
  Merge::Ats::Candidate.from_json(json_object: response.body)
end