Class: BulkAPI
- Inherits:
-
Object
- Object
- BulkAPI
- Defined in:
- lib/zoho_analytics_client.rb
Overview
BulkAPI contains data operations.
Instance Method Summary collapse
-
#export_bulk_data(job_id, file_path) ⇒ nil
Downloads the exported data for a given job ID.
-
#export_data(view_id, response_format, file_path, config = {}) ⇒ Object
Exports the specified view's data to a file.
-
#get_export_job_details(job_id) ⇒ Hash
Retrieves details of a specific export job.
-
#get_import_job_details(job_id) ⇒ Hash
Retrieves the details of an import job by its ID.
-
#import_bulk_data(view_id, import_type, file_type, auto_identify, file_path, config = {}) ⇒ String
Initiates asynchronous import of data into an existing view.
-
#import_bulk_data_in_new_table(table_name, file_type, auto_identify, file_path, config = {}) ⇒ String
Initiates asynchronous import of data into a new table.
-
#import_data(view_id, import_type, file_type, auto_identify, file_path, config = {}) ⇒ Hash
Imports data to an existing view from a file.
-
#import_data_as_batches(view_id, import_type, auto_identify, file_path, batch_size, config = {}, tool_config = {}) ⇒ String
Asynchronously imports data to an existing view in batches.
-
#import_data_in_new_table(table_name, file_type, auto_identify, file_path, config = {}) ⇒ Hash
Imports data from a file to a new table.
-
#import_data_in_new_table_as_batches(table_name, auto_identify, file_path, batch_size, config = {}, tool_config = {}) ⇒ String
Create a new table and import the data contained in the mentioned file into the created table.
-
#import_raw_data(view_id, import_type, file_type, auto_identify, data, config = {}) ⇒ Hash
Imports raw data to an existing view.
-
#import_raw_data_in_new_table(table_name, file_type, auto_identify, data, config = {}) ⇒ Hash
Imports raw data (as a string or byte array) to a new table.
-
#initialize(ac, org_id, workspace_id) ⇒ BulkAPI
constructor
Initializes the BulkAPI object.
-
#initiate_bulk_export(view_id, response_format, config = {}) ⇒ String
Initiates an asynchronous export for the given view.
-
#initiate_bulk_export_using_sql(sql_query, response_format, config = {}) ⇒ String
Initiates an asynchronous export using a SQL query.
Constructor Details
#initialize(ac, org_id, workspace_id) ⇒ BulkAPI
Initializes the BulkAPI object.
2218 2219 2220 2221 2222 2223 |
# File 'lib/zoho_analytics_client.rb', line 2218 def initialize(ac, org_id, workspace_id) @ac = ac @endpoint = "/restapi/v2/workspaces/#{workspace_id}" @bulk_endpoint = "/restapi/v2/bulk/workspaces/#{workspace_id}" @request_headers = { "ZANALYTICS-ORGID" => org_id } end |
Instance Method Details
#export_bulk_data(job_id, file_path) ⇒ nil
Downloads the exported data for a given job ID.
2455 2456 2457 2458 |
# File 'lib/zoho_analytics_client.rb', line 2455 def export_bulk_data(job_id, file_path) endpoint = "#{@bulk_endpoint}/exportjobs/#{job_id}/data" @ac.send_export_api_request(endpoint, nil, @request_headers, file_path) end |
#export_data(view_id, response_format, file_path, config = {}) ⇒ Object
Exports the specified view's data to a file.
2403 2404 2405 2406 2407 |
# File 'lib/zoho_analytics_client.rb', line 2403 def export_data(view_id, response_format, file_path, config = {}) endpoint = "#{@endpoint}/views/#{view_id}/data" config['responseFormat'] = response_format @ac.send_export_api_request(endpoint, config, @request_headers, file_path) end |
#get_export_job_details(job_id) ⇒ Hash
Retrieves details of a specific export job.
2443 2444 2445 2446 2447 |
# File 'lib/zoho_analytics_client.rb', line 2443 def get_export_job_details(job_id) endpoint = "#{@bulk_endpoint}/exportjobs/#{job_id}" response = @ac.send_api_request("GET", endpoint, nil, @request_headers) response end |
#get_import_job_details(job_id) ⇒ Hash
Retrieves the details of an import job by its ID.
2389 2390 2391 2392 2393 |
# File 'lib/zoho_analytics_client.rb', line 2389 def get_import_job_details(job_id) endpoint = "#{@bulk_endpoint}/importjobs/#{job_id}" response = @ac.send_api_request("GET", endpoint, nil, @request_headers) response end |
#import_bulk_data(view_id, import_type, file_type, auto_identify, file_path, config = {}) ⇒ String
Initiates asynchronous import of data into an existing view.
2338 2339 2340 2341 2342 2343 2344 2345 |
# File 'lib/zoho_analytics_client.rb', line 2338 def import_bulk_data(view_id, import_type, file_type, auto_identify, file_path, config = {}) endpoint = "#{@bulk_endpoint}/views/#{view_id}/data" config["fileType"] = file_type config["autoIdentify"] = auto_identify config["importType"] = import_type response = @ac.send_import_api_request(endpoint, config, @request_headers, file_path) response["jobId"] end |
#import_bulk_data_in_new_table(table_name, file_type, auto_identify, file_path, config = {}) ⇒ String
Initiates asynchronous import of data into a new table.
2320 2321 2322 2323 2324 2325 2326 2327 |
# File 'lib/zoho_analytics_client.rb', line 2320 def import_bulk_data_in_new_table(table_name, file_type, auto_identify, file_path, config = {}) endpoint = "#{@bulk_endpoint}/data" config["tableName"] = table_name config["fileType"] = file_type config["autoIdentify"] = auto_identify response = @ac.send_import_api_request(endpoint, config, @request_headers, file_path) response["jobId"] end |
#import_data(view_id, import_type, file_type, auto_identify, file_path, config = {}) ⇒ Hash
Imports data to an existing view from a file.
2285 2286 2287 2288 2289 2290 2291 2292 |
# File 'lib/zoho_analytics_client.rb', line 2285 def import_data(view_id, import_type, file_type, auto_identify, file_path, config = {}) endpoint = "#{@endpoint}/views/#{view_id}/data" config["fileType"] = file_type config["autoIdentify"] = auto_identify config["importType"] = import_type response = @ac.send_import_api_request(endpoint, config, @request_headers, file_path) response end |
#import_data_as_batches(view_id, import_type, auto_identify, file_path, batch_size, config = {}, tool_config = {}) ⇒ String
Asynchronously imports data to an existing view in batches.
2377 2378 2379 2380 2381 2382 2383 |
# File 'lib/zoho_analytics_client.rb', line 2377 def import_data_as_batches(view_id, import_type, auto_identify, file_path, batch_size, config = {}, tool_config = {}) endpoint = "#{@bulk_endpoint}/views/#{view_id}/data/batch" config["importType"] = import_type config["autoIdentify"] = auto_identify response = @ac.send_batch_import_api_request(endpoint, config, @request_headers, file_path, batch_size, tool_config) response["jobId"] end |
#import_data_in_new_table(table_name, file_type, auto_identify, file_path, config = {}) ⇒ Hash
Imports data from a file to a new table.
2233 2234 2235 2236 2237 2238 2239 2240 |
# File 'lib/zoho_analytics_client.rb', line 2233 def import_data_in_new_table(table_name, file_type, auto_identify, file_path, config = {}) endpoint = "#{@endpoint}/data" config["tableName"] = table_name config["fileType"] = file_type config["autoIdentify"] = auto_identify response = @ac.send_import_api_request(endpoint, config, @request_headers, file_path) response end |
#import_data_in_new_table_as_batches(table_name, auto_identify, file_path, batch_size, config = {}, tool_config = {}) ⇒ String
Create a new table and import the data contained in the mentioned file into the created table.
2251 2252 2253 2254 2255 2256 2257 |
# File 'lib/zoho_analytics_client.rb', line 2251 def import_data_in_new_table_as_batches(table_name, auto_identify, file_path, batch_size, config = {}, tool_config = {}) endpoint = "#{@bulk_endpoint}/data/batch" config["tableName"] = table_name config["autoIdentify"] = auto_identify response = @ac.send_batch_import_api_request(endpoint, config, @request_headers, file_path, batch_size, tool_config) response["jobId"] end |
#import_raw_data(view_id, import_type, file_type, auto_identify, data, config = {}) ⇒ Hash
Imports raw data to an existing view.
2303 2304 2305 2306 2307 2308 2309 2310 |
# File 'lib/zoho_analytics_client.rb', line 2303 def import_raw_data(view_id, import_type, file_type, auto_identify, data, config = {}) endpoint = "#{@endpoint}/views/#{view_id}/data" config["fileType"] = file_type config["autoIdentify"] = auto_identify config["importType"] = import_type response = @ac.send_import_api_request(endpoint, config, @request_headers, nil, data) response end |
#import_raw_data_in_new_table(table_name, file_type, auto_identify, data, config = {}) ⇒ Hash
Imports raw data (as a string or byte array) to a new table.
2267 2268 2269 2270 2271 2272 2273 2274 |
# File 'lib/zoho_analytics_client.rb', line 2267 def import_raw_data_in_new_table(table_name, file_type, auto_identify, data, config = {}) endpoint = "#{@endpoint}/data" config["tableName"] = table_name config["fileType"] = file_type config["autoIdentify"] = auto_identify response = @ac.send_import_api_request(endpoint, config, @request_headers, nil, data) response end |
#initiate_bulk_export(view_id, response_format, config = {}) ⇒ String
Initiates an asynchronous export for the given view.
2416 2417 2418 2419 2420 2421 |
# File 'lib/zoho_analytics_client.rb', line 2416 def initiate_bulk_export(view_id, response_format, config = {}) endpoint = "#{@bulk_endpoint}/views/#{view_id}/data" config["responseFormat"] = response_format response = @ac.send_api_request("GET", endpoint, config, @request_headers) response["jobId"] end |
#initiate_bulk_export_using_sql(sql_query, response_format, config = {}) ⇒ String
Initiates an asynchronous export using a SQL query.
2430 2431 2432 2433 2434 2435 2436 |
# File 'lib/zoho_analytics_client.rb', line 2430 def initiate_bulk_export_using_sql(sql_query, response_format, config = {}) endpoint = "#{@bulk_endpoint}/data" config["responseFormat"] = response_format config["sqlQuery"] = sql_query response = @ac.send_api_request("GET", endpoint, config, @request_headers) response["jobId"] end |