Class: Trycourier::Resources::Bulk

Inherits:
Object
  • Object
show all
Defined in:
lib/trycourier/resources/bulk.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Bulk

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Bulk.

Parameters:



121
122
123
# File 'lib/trycourier/resources/bulk.rb', line 121

def initialize(client:)
  @client = client
end

Instance Method Details

#add_users(job_id, users: , request_options: {}) ⇒ nil

Ingest user data into a Bulk Job

Parameters:

Returns:

  • (nil)

See Also:



19
20
21
22
23
24
25
26
27
28
# File 'lib/trycourier/resources/bulk.rb', line 19

def add_users(job_id, params)
  parsed, options = Trycourier::BulkAddUsersParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["bulk/%1$s", job_id],
    body: parsed,
    model: NilClass,
    options: options
  )
end

#create_job(message: , request_options: {}) ⇒ Trycourier::Models::BulkCreateJobResponse

Create a bulk job



40
41
42
43
44
45
46
47
48
49
# File 'lib/trycourier/resources/bulk.rb', line 40

def create_job(params)
  parsed, options = Trycourier::BulkCreateJobParams.dump_request(params)
  @client.request(
    method: :post,
    path: "bulk",
    body: parsed,
    model: Trycourier::Models::BulkCreateJobResponse,
    options: options
  )
end

#list_users(job_id, cursor: nil, request_options: {}) ⇒ Trycourier::Models::BulkListUsersResponse

Some parameter documentations has been truncated, see Models::BulkListUsersParams for more details.

Get Bulk Job Users

Parameters:

  • job_id (String)

    A unique identifier representing the bulk job

  • cursor (String, nil)

    A unique identifier that allows for fetching the next set of users added to the

  • request_options (Trycourier::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



67
68
69
70
71
72
73
74
75
76
# File 'lib/trycourier/resources/bulk.rb', line 67

def list_users(job_id, params = {})
  parsed, options = Trycourier::BulkListUsersParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["bulk/%1$s/users", job_id],
    query: parsed,
    model: Trycourier::Models::BulkListUsersResponse,
    options: options
  )
end

#retrieve_job(job_id, request_options: {}) ⇒ Trycourier::Models::BulkRetrieveJobResponse

Get a bulk job

Parameters:

  • job_id (String)

    A unique identifier representing the bulk job

  • request_options (Trycourier::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



89
90
91
92
93
94
95
96
# File 'lib/trycourier/resources/bulk.rb', line 89

def retrieve_job(job_id, params = {})
  @client.request(
    method: :get,
    path: ["bulk/%1$s", job_id],
    model: Trycourier::Models::BulkRetrieveJobResponse,
    options: params[:request_options]
  )
end

#run_job(job_id, request_options: {}) ⇒ nil

Run a bulk job

Parameters:

  • job_id (String)

    A unique identifier representing the bulk job

  • request_options (Trycourier::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



109
110
111
112
113
114
115
116
# File 'lib/trycourier/resources/bulk.rb', line 109

def run_job(job_id, params = {})
  @client.request(
    method: :post,
    path: ["bulk/%1$s/run", job_id],
    model: NilClass,
    options: params[:request_options]
  )
end