Class: Stripe::Privacy::RedactionJobService

Inherits:
StripeService show all
Defined in:
lib/stripe/services/privacy/redaction_job_service.rb

Defined Under Namespace

Classes: CancelParams, CreateParams, ListParams, RetrieveParams, RunParams, UpdateParams, ValidateParams

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from StripeService

#request, #request_stream

Constructor Details

#initialize(requestor) ⇒ RedactionJobService

Returns a new instance of RedactionJobService.



9
10
11
12
# File 'lib/stripe/services/privacy/redaction_job_service.rb', line 9

def initialize(requestor)
  super
  @validation_errors = Stripe::Privacy::RedactionJobValidationErrorService.new(@requestor)
end

Instance Attribute Details

#validation_errorsObject (readonly)

Returns the value of attribute validation_errors.



7
8
9
# File 'lib/stripe/services/privacy/redaction_job_service.rb', line 7

def validation_errors
  @validation_errors
end

Instance Method Details

#cancel(job, params = {}, opts = {}) ⇒ Object

You can cancel a redaction job when it’s in one of these statuses: ready, failed.

Canceling the redaction job will abandon its attempt to redact the configured objects. A canceled job cannot be used again.



153
154
155
156
157
158
159
160
161
# File 'lib/stripe/services/privacy/redaction_job_service.rb', line 153

def cancel(job, params = {}, opts = {})
  request(
    method: :post,
    path: format("/v1/privacy/redaction_jobs/%<job>s/cancel", { job: CGI.escape(job) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

#create(params = {}, opts = {}) ⇒ Object

Creates a redaction job. When a job is created, it will start to validate.



164
165
166
167
168
169
170
171
172
# File 'lib/stripe/services/privacy/redaction_job_service.rb', line 164

def create(params = {}, opts = {})
  request(
    method: :post,
    path: "/v1/privacy/redaction_jobs",
    params: params,
    opts: opts,
    base_address: :api
  )
end

#list(params = {}, opts = {}) ⇒ Object

Returns a list of redaction jobs.



175
176
177
178
179
180
181
182
183
# File 'lib/stripe/services/privacy/redaction_job_service.rb', line 175

def list(params = {}, opts = {})
  request(
    method: :get,
    path: "/v1/privacy/redaction_jobs",
    params: params,
    opts: opts,
    base_address: :api
  )
end

#retrieve(job, params = {}, opts = {}) ⇒ Object

Retrieves the details of a previously created redaction job.



186
187
188
189
190
191
192
193
194
# File 'lib/stripe/services/privacy/redaction_job_service.rb', line 186

def retrieve(job, params = {}, opts = {})
  request(
    method: :get,
    path: format("/v1/privacy/redaction_jobs/%<job>s", { job: CGI.escape(job) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

#run(job, params = {}, opts = {}) ⇒ Object

Run a redaction job in a ready status.

When you run a job, the configured objects will be redacted asynchronously. This action is irreversible and cannot be canceled once started.

The status of the job will move to redacting. Once all of the objects are redacted, the status will become succeeded. If the job’s validation_behavior is set to fix, the automatic fixes will be applied to objects at this step.



201
202
203
204
205
206
207
208
209
# File 'lib/stripe/services/privacy/redaction_job_service.rb', line 201

def run(job, params = {}, opts = {})
  request(
    method: :post,
    path: format("/v1/privacy/redaction_jobs/%<job>s/run", { job: CGI.escape(job) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

#update(job, params = {}, opts = {}) ⇒ Object

Updates the properties of a redaction job without running or canceling the job.

If the job to update is in a failed status, it will not automatically start to validate. Once you applied all of the changes, use the validate API to start validation again.



214
215
216
217
218
219
220
221
222
# File 'lib/stripe/services/privacy/redaction_job_service.rb', line 214

def update(job, params = {}, opts = {})
  request(
    method: :post,
    path: format("/v1/privacy/redaction_jobs/%<job>s", { job: CGI.escape(job) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

#validate(job, params = {}, opts = {}) ⇒ Object

Validate a redaction job when it is in a failed status.

When a job is created, it automatically begins to validate on the configured objects’ eligibility for redaction. Use this to validate the job again after its validation errors are resolved or the job’s validation_behavior is changed.

The status of the job will move to validating. Once all of the objects are validated, the status of the job will become ready. If there are any validation errors preventing the job from running, the status will become failed.



229
230
231
232
233
234
235
236
237
# File 'lib/stripe/services/privacy/redaction_job_service.rb', line 229

def validate(job, params = {}, opts = {})
  request(
    method: :post,
    path: format("/v1/privacy/redaction_jobs/%<job>s/validate", { job: CGI.escape(job) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end