Class: Stripe::Privacy::RedactionJobService

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

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.



17
18
19
20
21
22
23
24
25
# File 'lib/stripe/services/privacy/redaction_job_service.rb', line 17

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.



28
29
30
31
32
33
34
35
36
# File 'lib/stripe/services/privacy/redaction_job_service.rb', line 28

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.



39
40
41
42
43
44
45
46
47
# File 'lib/stripe/services/privacy/redaction_job_service.rb', line 39

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.



50
51
52
53
54
55
56
57
58
# File 'lib/stripe/services/privacy/redaction_job_service.rb', line 50

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.



65
66
67
68
69
70
71
72
73
# File 'lib/stripe/services/privacy/redaction_job_service.rb', line 65

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.



78
79
80
81
82
83
84
85
86
# File 'lib/stripe/services/privacy/redaction_job_service.rb', line 78

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.



93
94
95
96
97
98
99
100
101
# File 'lib/stripe/services/privacy/redaction_job_service.rb', line 93

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