Class: Merge::Ats::AsyncCandidatesClient

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::AsyncCandidatesClient

Parameters:



359
360
361
# File 'lib/merge_ruby_client/ats/candidates/client.rb', line 359

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientMerge::AsyncRequestClient (readonly)



355
356
357
# File 'lib/merge_ruby_client/ats/candidates/client.rb', line 355

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:



463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
# File 'lib/merge_ruby_client/ats/candidates/client.rb', line 463

def create(model:, remote_user_id:, is_debug_mode: nil, run_async: nil, request_options: nil)
  Async do
    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
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)


612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
# File 'lib/merge_ruby_client/ats/candidates/client.rb', line 612

def ignore_create(model_id:, reason:, message: nil, request_options: nil)
  Async do
    @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
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:



393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
# File 'lib/merge_ruby_client/ats/candidates/client.rb', line 393

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)
  Async do
    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
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:



648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
# File 'lib/merge_ruby_client/ats/candidates/client.rb', line 648

def meta_patch_retrieve(id:, request_options: nil)
  Async do
    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
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:



682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
# File 'lib/merge_ruby_client/ats/candidates/client.rb', line 682

def meta_post_retrieve(request_options: nil)
  Async do
    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
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:



568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
# File 'lib/merge_ruby_client/ats/candidates/client.rb', line 568

def partial_update(id:, model:, remote_user_id:, is_debug_mode: nil, run_async: nil, request_options: nil)
  Async do
    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
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:



506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
# File 'lib/merge_ruby_client/ats/candidates/client.rb', line 506

def retrieve(id:, expand: nil, include_remote_data: nil, request_options: nil)
  Async do
    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
end