Class: FinchAPI::Resources::Jobs::Automated

Inherits:
Object
  • Object
show all
Defined in:
lib/finch-api/resources/jobs/automated.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Automated

Returns a new instance of Automated.

Parameters:



85
86
87
# File 'lib/finch-api/resources/jobs/automated.rb', line 85

def initialize(client:)
  @client = client
end

Instance Method Details

#create(params) ⇒ FinchAPI::Models::Jobs::AutomatedCreateResponse

Enqueue an automated job.

`data_sync_all`: Enqueue a job to re-sync all data for a connection.
`data_sync_all` has a concurrency limit of 1 job at a time per connection. This
means that if this endpoint is called while a job is already in progress for
this connection, Finch will return the `job_id` of the job that is currently in
progress. Finch allows a fixed window rate limit of 1 forced refresh per hour
per connection.

`w4_form_employee_sync`: Enqueues a job for sync W-4 data for a particular
individual, identified by `individual_id`. This feature is currently in beta.

This endpoint is available for _Scale_ tier customers as an add-on. To request
access to this endpoint, please contact your Finch account manager.

Parameters:

  • params (FinchAPI::Models::Jobs::AutomatedCreateParams, Hash{Symbol=>Object})

    .

    @option params [Symbol, FinchAPI::Models::Jobs::AutomatedCreateParams::Type] :type The type of job to start.

    @option params [FinchAPI::Models::Jobs::AutomatedCreateParams::Params] :params

    @option params [FinchAPI::RequestOptions, HashSymbol=>Object, nil] :request_options

Returns:



31
32
33
34
35
36
37
38
39
40
# File 'lib/finch-api/resources/jobs/automated.rb', line 31

def create(params)
  parsed, options = FinchAPI::Models::Jobs::AutomatedCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "jobs/automated",
    body: parsed,
    model: FinchAPI::Models::Jobs::AutomatedCreateResponse,
    options: options
  )
end

#list(params = {}) ⇒ FinchAPI::Models::Jobs::AutomatedListResponse

Get all automated jobs. Automated jobs are completed by a machine. By default,

jobs are sorted in descending order by submission time. For scheduled jobs such
as data syncs, only the next scheduled job is shown.

Parameters:

  • params (FinchAPI::Models::Jobs::AutomatedListParams, Hash{Symbol=>Object}) (defaults to: {})

    .

    @option params [Integer] :limit Number of items to return

    @option params [Integer] :offset Index to start from (defaults to 0)

    @option params [FinchAPI::RequestOptions, HashSymbol=>Object, nil] :request_options

Returns:



73
74
75
76
77
78
79
80
81
82
# File 'lib/finch-api/resources/jobs/automated.rb', line 73

def list(params = {})
  parsed, options = FinchAPI::Models::Jobs::AutomatedListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "jobs/automated",
    query: parsed,
    model: FinchAPI::Models::Jobs::AutomatedListResponse,
    options: options
  )
end

#retrieve(job_id, params = {}) ⇒ FinchAPI::Models::Jobs::AutomatedAsyncJob

Get an automated job by ‘job_id`.

Parameters:

Returns:



51
52
53
54
55
56
57
58
# File 'lib/finch-api/resources/jobs/automated.rb', line 51

def retrieve(job_id, params = {})
  @client.request(
    method: :get,
    path: ["jobs/automated/%0s", job_id],
    model: FinchAPI::Models::Jobs::AutomatedAsyncJob,
    options: params[:request_options]
  )
end