Class: SafetyKit::Resources::Data
- Inherits:
-
Object
- Object
- SafetyKit::Resources::Data
- Defined in:
- lib/safety_kit/resources/data.rb
Overview
Ingest data for fraud detection and risk analysis.
Instance Method Summary collapse
-
#add(namespace, data:, request_options: {}) ⇒ SafetyKit::Models::DataAddResponse
Some parameter documentations has been truncated, see Models::DataAddParams for more details.
-
#create_upload_url(namespace, schema: nil, request_options: {}) ⇒ SafetyKit::Models::DataCreateUploadURLResponse
Some parameter documentations has been truncated, see Models::DataCreateUploadURLParams for more details.
-
#get_download_url(request_id, namespace:, request_options: {}) ⇒ SafetyKit::Models::DataGetDownloadURLResponse
Retrieve the status of a data ingestion request and, once complete, a temporary S3 URL for the full result file.
-
#get_status(request_id, namespace:, request_options: {}) ⇒ SafetyKit::Models::DataGetStatusResponse
Retrieve the status of a data ingestion request and, once complete, return processed objects inline.
-
#initialize(client:) ⇒ Data
constructor
private
A new instance of Data.
-
#update_settings(namespace, schema:, request_options: {}) ⇒ SafetyKit::Models::DataUpdateSettingsResponse
Some parameter documentations has been truncated, see Models::DataUpdateSettingsParams for more details.
Constructor Details
#initialize(client:) ⇒ Data
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 Data.
154 155 156 |
# File 'lib/safety_kit/resources/data.rb', line 154 def initialize(client:) @client = client end |
Instance Method Details
#add(namespace, data:, request_options: {}) ⇒ SafetyKit::Models::DataAddResponse
Some parameter documentations has been truncated, see Models::DataAddParams for more details.
Add data to a namespace, returning immediately. Processing happens asynchronously in the background.
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/safety_kit/resources/data.rb', line 24 def add(namespace, params) parsed, = SafetyKit::DataAddParams.dump_request(params) @client.request( method: :post, path: ["v1/data/%1$s", namespace], body: parsed, model: SafetyKit::Models::DataAddResponse, options: ) end |
#create_upload_url(namespace, schema: nil, request_options: {}) ⇒ SafetyKit::Models::DataCreateUploadURLResponse
Some parameter documentations has been truncated, see Models::DataCreateUploadURLParams for more details.
Request a pre-signed upload URL for large JSONL batches into a namespace. After receiving ‘upload_url`, upload your JSONL file using `PUT upload_url` with header `Content-Type: application/json`; put each JSON object on a new line.
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/safety_kit/resources/data.rb', line 53 def create_upload_url(namespace, params = {}) parsed, = SafetyKit::DataCreateUploadURLParams.dump_request(params) @client.request( method: :post, path: ["v1/data/%1$s/requests/upload-url", namespace], body: parsed, model: SafetyKit::Models::DataCreateUploadURLResponse, options: ) end |
#get_download_url(request_id, namespace:, request_options: {}) ⇒ SafetyKit::Models::DataGetDownloadURLResponse
Retrieve the status of a data ingestion request and, once complete, a temporary S3 URL for the full result file. This endpoint always uses the URL-based response shape regardless of request size.
79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/safety_kit/resources/data.rb', line 79 def get_download_url(request_id, params) parsed, = SafetyKit::DataGetDownloadURLParams.dump_request(params) namespace = parsed.delete(:namespace) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["v1/data/%1$s/requests/%2$s/results/download-url", namespace, request_id], model: SafetyKit::Models::DataGetDownloadURLResponse, options: ) end |
#get_status(request_id, namespace:, request_options: {}) ⇒ SafetyKit::Models::DataGetStatusResponse
Retrieve the status of a data ingestion request and, once complete, return processed objects inline. If the processed output exceeds the 5 MiB inline response limit, this endpoint returns an error instructing you to use the download endpoint instead.
109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/safety_kit/resources/data.rb', line 109 def get_status(request_id, params) parsed, = SafetyKit::DataGetStatusParams.dump_request(params) namespace = parsed.delete(:namespace) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["v1/data/%1$s/requests/%2$s", namespace, request_id], model: SafetyKit::Models::DataGetStatusResponse, options: ) end |
#update_settings(namespace, schema:, request_options: {}) ⇒ SafetyKit::Models::DataUpdateSettingsResponse
Some parameter documentations has been truncated, see Models::DataUpdateSettingsParams for more details.
Create or replace settings for a namespace, primarily used to change the schema associated with the namespace.
140 141 142 143 144 145 146 147 148 149 |
# File 'lib/safety_kit/resources/data.rb', line 140 def update_settings(namespace, params) parsed, = SafetyKit::DataUpdateSettingsParams.dump_request(params) @client.request( method: :put, path: ["v1/data/%1$s/settings", namespace], body: parsed, model: SafetyKit::Models::DataUpdateSettingsResponse, options: ) end |