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.
1960 1961 1962 1963 1964 1965 |
# File 'lib/zoho_analytics_client.rb', line 1960 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.
2197 2198 2199 2200 |
# File 'lib/zoho_analytics_client.rb', line 2197 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.
2145 2146 2147 2148 2149 |
# File 'lib/zoho_analytics_client.rb', line 2145 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.
2185 2186 2187 2188 2189 |
# File 'lib/zoho_analytics_client.rb', line 2185 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.
2131 2132 2133 2134 2135 |
# File 'lib/zoho_analytics_client.rb', line 2131 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.
2080 2081 2082 2083 2084 2085 2086 2087 |
# File 'lib/zoho_analytics_client.rb', line 2080 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.
2062 2063 2064 2065 2066 2067 2068 2069 |
# File 'lib/zoho_analytics_client.rb', line 2062 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.
2027 2028 2029 2030 2031 2032 2033 2034 |
# File 'lib/zoho_analytics_client.rb', line 2027 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.
2119 2120 2121 2122 2123 2124 2125 |
# File 'lib/zoho_analytics_client.rb', line 2119 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.
1975 1976 1977 1978 1979 1980 1981 1982 |
# File 'lib/zoho_analytics_client.rb', line 1975 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.
1993 1994 1995 1996 1997 1998 1999 |
# File 'lib/zoho_analytics_client.rb', line 1993 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.
2045 2046 2047 2048 2049 2050 2051 2052 |
# File 'lib/zoho_analytics_client.rb', line 2045 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.
2009 2010 2011 2012 2013 2014 2015 2016 |
# File 'lib/zoho_analytics_client.rb', line 2009 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.
2158 2159 2160 2161 2162 2163 |
# File 'lib/zoho_analytics_client.rb', line 2158 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.
2172 2173 2174 2175 2176 2177 2178 |
# File 'lib/zoho_analytics_client.rb', line 2172 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 |