Class: ViewAPI
- Inherits:
-
Object
- Object
- ViewAPI
- Defined in:
- lib/zoho_analytics_client.rb
Overview
ViewAPI contains view level operations.
Instance Method Summary collapse
-
#add_aggregate_formula(formula_name, expression, config = {}) ⇒ String
Adds an aggregate formula to the table.
-
#add_column(column_name, data_type, config = {}) ⇒ Integer
Add a column to the view.
-
#add_favorite ⇒ Object
Adds a specified view as favorite.
-
#add_formula_column(formula_name, expression, config = {}) ⇒ String
Adds a formula column to the table.
-
#add_lookup(column_id, ref_view_id, ref_column_id, config = {}) ⇒ Object
Adds a lookup in the specified child table.
-
#add_row(column_values, config = {}) ⇒ Hash
Adds a single row in the specified table.
-
#auto_analyse(config = {}) ⇒ Object
Auto generate reports.
-
#auto_analyse_column(column_id, config = {}) ⇒ Object
Auto generates reports for the specified column.
-
#copy_formulas(formula_names, dest_workspace_id, config = {}, dest_org_id = nil) ⇒ Object
Copy formulas to another workspace or view.
-
#create_private_url(config = {}) ⇒ String
Create private URL for the view.
-
#create_similar_views(ref_view_id, folder_id, config = {}) ⇒ Object
Create similar reports based on a reference view.
-
#delete(config = {}) ⇒ Object
Delete a specified view in the workspace.
-
#delete_aggregate_formula(formula_id, config = {}) ⇒ Object
Deletes an aggregate formula.
-
#delete_column(column_id, config = {}) ⇒ Object
Deletes a specified column in the table.
-
#delete_formula_column(formula_id, config = {}) ⇒ Object
Deletes a formula column.
-
#delete_row(criteria, config = {}) ⇒ String
Deletes rows in the specified table.
-
#edit_aggregate_formula(formula_id, expression, config = {}) ⇒ Object
Edits an aggregate formula.
-
#edit_formula_column(formula_id, expression, config = {}) ⇒ Object
Edits a formula column.
-
#get_aggregate_formulas ⇒ Array<Hash>
Returns list of all aggregate formulas for the table.
-
#get_column_dependents(column_id) ⇒ Hash
Returns list of dependent views and formulas for the specified column.
-
#get_embed_url(config = {}) ⇒ String
Get embed URL of the view.
-
#get_formula_columns ⇒ Array<Hash>
Returns list of all formula columns for the table.
-
#get_last_import_details ⇒ Hash
Returns last import details of the view.
-
#get_my_permissions ⇒ Hash
Get user permissions for the view.
-
#get_private_url(config = {}) ⇒ String
Get private URL of the view.
-
#get_publish_configurations ⇒ Hash
Get publish configurations of the view.
-
#get_view_dependents ⇒ Array<Hash>
Returns the dependent views of this view.
-
#get_view_url(config = {}) ⇒ String
Get the URL to access the view.
-
#hide_columns(column_ids) ⇒ Object
Hide columns in the view.
-
#initialize(ac, org_id, workspace_id, view_id) ⇒ ViewAPI
constructor
A new instance of ViewAPI.
-
#make_view_public(config = {}) ⇒ String
Make the view publicly accessible.
-
#refetch_data(config = {}) ⇒ Object
Syncs data from the available data source for the view.
-
#remove_favorite ⇒ Object
Removes a specified view from favorites.
-
#remove_lookup(column_id, config = {}) ⇒ Object
Removes the lookup for the specified column in the table.
-
#remove_private_access ⇒ Object
Remove private access for the view.
-
#remove_public_access ⇒ Object
Remove public access for the view.
-
#rename(view_name, config = {}) ⇒ Object
Rename a specified view in the workspace.
-
#rename_column(column_id, column_name, config = {}) ⇒ Object
Renames a specified column in the table.
-
#save_as(new_view_name, config = {}) ⇒ Integer
Copy a specified view within the workspace.
-
#show_columns(column_ids) ⇒ Object
Show hidden columns in the view.
-
#update_publish_configurations(config = {}) ⇒ Object
Update publish configurations of the view.
-
#update_row(column_values, criteria, config = {}) ⇒ Hash
Updates rows in the specified table.
-
#update_shared_details(config = {}) ⇒ Object
Updates the shared details of the specified view.
Constructor Details
#initialize(ac, org_id, workspace_id, view_id) ⇒ ViewAPI
Returns a new instance of ViewAPI.
1566 1567 1568 1569 1570 |
# File 'lib/zoho_analytics_client.rb', line 1566 def initialize(ac, org_id, workspace_id, view_id) @ac = ac @endpoint = "/restapi/v2/workspaces/#{workspace_id}/views/#{view_id}" @request_headers = { "ZANALYTICS-ORGID" => org_id } end |
Instance Method Details
#add_aggregate_formula(formula_name, expression, config = {}) ⇒ String
Adds an aggregate formula to the table.
1898 1899 1900 1901 1902 1903 1904 |
# File 'lib/zoho_analytics_client.rb', line 1898 def add_aggregate_formula(formula_name, expression, config = {}) config["formulaName"] = formula_name config["expression"] = expression endpoint = "#{@endpoint}/aggregateformulas" response = @ac.send_api_request("POST", endpoint, config, @request_headers) response["formulaId"] end |
#add_column(column_name, data_type, config = {}) ⇒ Integer
Add a column to the view.
1726 1727 1728 1729 1730 1731 1732 |
# File 'lib/zoho_analytics_client.rb', line 1726 def add_column(column_name, data_type, config = {}) config["columnName"] = column_name config["dataType"] = data_type endpoint = "#{@endpoint}/columns" response = @ac.send_api_request("POST", endpoint, config, @request_headers) response["columnId"].to_i end |
#add_favorite ⇒ Object
Adds a specified view as favorite.
1612 1613 1614 1615 |
# File 'lib/zoho_analytics_client.rb', line 1612 def add_favorite endpoint = "#{@endpoint}/favorite" @ac.send_api_request("POST", endpoint, nil, @request_headers) end |
#add_formula_column(formula_name, expression, config = {}) ⇒ String
Adds a formula column to the table.
1859 1860 1861 1862 1863 1864 1865 |
# File 'lib/zoho_analytics_client.rb', line 1859 def add_formula_column(formula_name, expression, config = {}) config["formulaName"] = formula_name config["expression"] = expression endpoint = "#{@endpoint}/formulacolumns" response = @ac.send_api_request("POST", endpoint, config, @request_headers) response["formulaId"] end |
#add_lookup(column_id, ref_view_id, ref_column_id, config = {}) ⇒ Object
Adds a lookup in the specified child table.
1808 1809 1810 1811 1812 1813 |
# File 'lib/zoho_analytics_client.rb', line 1808 def add_lookup(column_id, ref_view_id, ref_column_id, config = {}) config["referenceViewId"] = ref_view_id config["referenceColumnId"] = ref_column_id endpoint = "#{@endpoint}/columns/#{column_id}/lookup" @ac.send_api_request("POST", endpoint, config, @request_headers) end |
#add_row(column_values, config = {}) ⇒ Hash
Adds a single row in the specified table.
1754 1755 1756 1757 1758 1759 |
# File 'lib/zoho_analytics_client.rb', line 1754 def add_row(column_values, config = {}) config["columns"] = column_values endpoint = "#{@endpoint}/rows" response = @ac.send_api_request("POST", endpoint, config, @request_headers) response end |
#auto_analyse(config = {}) ⇒ Object
Auto generate reports.
1636 1637 1638 1639 |
# File 'lib/zoho_analytics_client.rb', line 1636 def auto_analyse(config = {}) endpoint = "#{@endpoint}/autoanalyse" @ac.send_api_request("POST", endpoint, config, @request_headers) end |
#auto_analyse_column(column_id, config = {}) ⇒ Object
Auto generates reports for the specified column.
1826 1827 1828 1829 |
# File 'lib/zoho_analytics_client.rb', line 1826 def auto_analyse_column(column_id, config = {}) endpoint = "#{@endpoint}/columns/#{column_id}/autoanalyse" @ac.send_api_request("POST", endpoint, config, @request_headers) end |
#copy_formulas(formula_names, dest_workspace_id, config = {}, dest_org_id = nil) ⇒ Object
Copy formulas to another workspace or view.
1602 1603 1604 1605 1606 1607 1608 1609 |
# File 'lib/zoho_analytics_client.rb', line 1602 def copy_formulas(formula_names, dest_workspace_id, config = {}, dest_org_id = nil) config["formulaColumnNames"] = formula_names config["destWorkspaceId"] = dest_workspace_id endpoint = "#{@endpoint}/formulas/copy" headers = @request_headers.dup headers["ZANALYTICS-DEST-ORGID"] = dest_org_id if dest_org_id @ac.send_api_request("POST", endpoint, config, headers) end |
#create_private_url(config = {}) ⇒ String
Create private URL for the view.
1679 1680 1681 1682 1683 |
# File 'lib/zoho_analytics_client.rb', line 1679 def create_private_url(config = {}) endpoint = "#{@endpoint}/publish/privatelink" response = @ac.send_api_request("POST", endpoint, config, @request_headers) response["privateUrl"] end |
#create_similar_views(ref_view_id, folder_id, config = {}) ⇒ Object
Create similar reports based on a reference view.
1627 1628 1629 1630 1631 1632 |
# File 'lib/zoho_analytics_client.rb', line 1627 def create_similar_views(ref_view_id, folder_id, config = {}) config["referenceViewId"] = ref_view_id config["folderId"] = folder_id endpoint = "#{@endpoint}/similarviews" @ac.send_api_request("POST", endpoint, config, @request_headers) end |
#delete(config = {}) ⇒ Object
Delete a specified view in the workspace.
1582 1583 1584 |
# File 'lib/zoho_analytics_client.rb', line 1582 def delete(config = {}) @ac.send_api_request("DELETE", @endpoint, config, @request_headers) end |
#delete_aggregate_formula(formula_id, config = {}) ⇒ Object
Deletes an aggregate formula.
1919 1920 1921 1922 |
# File 'lib/zoho_analytics_client.rb', line 1919 def delete_aggregate_formula(formula_id, config = {}) endpoint = "#{@endpoint}/aggregateformulas/#{formula_id}" @ac.send_api_request("DELETE", endpoint, config, @request_headers) end |
#delete_column(column_id, config = {}) ⇒ Object
Deletes a specified column in the table.
1798 1799 1800 1801 |
# File 'lib/zoho_analytics_client.rb', line 1798 def delete_column(column_id, config = {}) endpoint = "#{@endpoint}/columns/#{column_id}" @ac.send_api_request("DELETE", endpoint, config, @request_headers) end |
#delete_formula_column(formula_id, config = {}) ⇒ Object
Deletes a formula column.
1880 1881 1882 1883 |
# File 'lib/zoho_analytics_client.rb', line 1880 def delete_formula_column(formula_id, config = {}) endpoint = "#{@endpoint}/formulacolumns/#{formula_id}" @ac.send_api_request("DELETE", endpoint, config, @request_headers) end |
#delete_row(criteria, config = {}) ⇒ String
Deletes rows in the specified table.
1778 1779 1780 1781 1782 1783 |
# File 'lib/zoho_analytics_client.rb', line 1778 def delete_row(criteria, config = {}) config["criteria"] = criteria unless criteria.nil? endpoint = "#{@endpoint}/rows" response = @ac.send_api_request("DELETE", endpoint, config, @request_headers) response["deletedRows"] end |
#edit_aggregate_formula(formula_id, expression, config = {}) ⇒ Object
Edits an aggregate formula.
1910 1911 1912 1913 1914 |
# File 'lib/zoho_analytics_client.rb', line 1910 def edit_aggregate_formula(formula_id, expression, config = {}) config["expression"] = expression endpoint = "#{@endpoint}/aggregateformulas/#{formula_id}" @ac.send_api_request("PUT", endpoint, config, @request_headers) end |
#edit_formula_column(formula_id, expression, config = {}) ⇒ Object
Edits a formula column.
1871 1872 1873 1874 1875 |
# File 'lib/zoho_analytics_client.rb', line 1871 def edit_formula_column(formula_id, expression, config = {}) config["expression"] = expression endpoint = "#{@endpoint}/formulacolumns/#{formula_id}" @ac.send_api_request("PUT", endpoint, config, @request_headers) end |
#get_aggregate_formulas ⇒ Array<Hash>
Returns list of all aggregate formulas for the table.
1887 1888 1889 1890 1891 |
# File 'lib/zoho_analytics_client.rb', line 1887 def get_aggregate_formulas endpoint = "#{@endpoint}/aggregateformulas" response = @ac.send_api_request("GET", endpoint, nil, @request_headers) response["aggregateFormulas"] end |
#get_column_dependents(column_id) ⇒ Hash
Returns list of dependent views and formulas for the specified column.
1937 1938 1939 1940 1941 |
# File 'lib/zoho_analytics_client.rb', line 1937 def get_column_dependents(column_id) endpoint = "#{@endpoint}/columns/#{column_id}/dependents" response = @ac.send_api_request("GET", endpoint, nil, @request_headers) response end |
#get_embed_url(config = {}) ⇒ String
Get embed URL of the view.
1661 1662 1663 1664 1665 |
# File 'lib/zoho_analytics_client.rb', line 1661 def (config = {}) endpoint = "#{@endpoint}/publish/embed" response = @ac.send_api_request("GET", endpoint, config, @request_headers) response["embedUrl"] end |
#get_formula_columns ⇒ Array<Hash>
Returns list of all formula columns for the table.
1848 1849 1850 1851 1852 |
# File 'lib/zoho_analytics_client.rb', line 1848 def get_formula_columns endpoint = "#{@endpoint}/formulacolumns" response = @ac.send_api_request("GET", endpoint, nil, @request_headers) response["formulaColumns"] end |
#get_last_import_details ⇒ Hash
Returns last import details of the view.
1840 1841 1842 1843 1844 |
# File 'lib/zoho_analytics_client.rb', line 1840 def get_last_import_details endpoint = "#{@endpoint}/importdetails" response = @ac.send_api_request("GET", endpoint, nil, @request_headers) response end |
#get_my_permissions ⇒ Hash
Get user permissions for the view.
1643 1644 1645 1646 1647 |
# File 'lib/zoho_analytics_client.rb', line 1643 def endpoint = "#{@endpoint}/share/userpermissions" response = @ac.send_api_request("GET", endpoint, nil, @request_headers) response["permissions"] end |
#get_private_url(config = {}) ⇒ String
Get private URL of the view.
1670 1671 1672 1673 1674 |
# File 'lib/zoho_analytics_client.rb', line 1670 def get_private_url(config = {}) endpoint = "#{@endpoint}/publish/privatelink" response = @ac.send_api_request("GET", endpoint, config, @request_headers) response["privateUrl"] end |
#get_publish_configurations ⇒ Hash
Get publish configurations of the view.
1708 1709 1710 1711 1712 |
# File 'lib/zoho_analytics_client.rb', line 1708 def get_publish_configurations endpoint = "#{@endpoint}/publish/config" response = @ac.send_api_request("GET", endpoint, nil, @request_headers) response end |
#get_view_dependents ⇒ Array<Hash>
Returns the dependent views of this view.
1926 1927 1928 1929 1930 |
# File 'lib/zoho_analytics_client.rb', line 1926 def get_view_dependents endpoint = "#{@endpoint}/dependents" response = @ac.send_api_request("GET", endpoint, nil, @request_headers) response["dependents"] end |
#get_view_url(config = {}) ⇒ String
Get the URL to access the view.
1652 1653 1654 1655 1656 |
# File 'lib/zoho_analytics_client.rb', line 1652 def get_view_url(config = {}) endpoint = "#{@endpoint}/publish" response = @ac.send_api_request("GET", endpoint, config, @request_headers) response["viewUrl"] end |
#hide_columns(column_ids) ⇒ Object
Hide columns in the view.
1736 1737 1738 1739 1740 |
# File 'lib/zoho_analytics_client.rb', line 1736 def hide_columns(column_ids) config = { "columnIds" => column_ids } endpoint = "#{@endpoint}/columns/hide" @ac.send_api_request("PUT", endpoint, config, @request_headers) end |
#make_view_public(config = {}) ⇒ String
Make the view publicly accessible.
1694 1695 1696 1697 1698 |
# File 'lib/zoho_analytics_client.rb', line 1694 def make_view_public(config = {}) endpoint = "#{@endpoint}/publish/public" response = @ac.send_api_request("POST", endpoint, config, @request_headers) response["publicUrl"] end |
#refetch_data(config = {}) ⇒ Object
Syncs data from the available data source for the view.
1833 1834 1835 1836 |
# File 'lib/zoho_analytics_client.rb', line 1833 def refetch_data(config = {}) endpoint = "#{@endpoint}/sync" @ac.send_api_request("POST", endpoint, config, @request_headers) end |
#remove_favorite ⇒ Object
Removes a specified view from favorites.
1618 1619 1620 1621 |
# File 'lib/zoho_analytics_client.rb', line 1618 def remove_favorite endpoint = "#{@endpoint}/favorite" @ac.send_api_request("DELETE", endpoint, nil, @request_headers) end |
#remove_lookup(column_id, config = {}) ⇒ Object
Removes the lookup for the specified column in the table.
1818 1819 1820 1821 |
# File 'lib/zoho_analytics_client.rb', line 1818 def remove_lookup(column_id, config = {}) endpoint = "#{@endpoint}/columns/#{column_id}/lookup" @ac.send_api_request("DELETE", endpoint, config, @request_headers) end |
#remove_private_access ⇒ Object
Remove private access for the view.
1686 1687 1688 1689 |
# File 'lib/zoho_analytics_client.rb', line 1686 def remove_private_access endpoint = "#{@endpoint}/publish/privatelink" @ac.send_api_request("DELETE", endpoint, nil, @request_headers) end |
#remove_public_access ⇒ Object
Remove public access for the view.
1701 1702 1703 1704 |
# File 'lib/zoho_analytics_client.rb', line 1701 def remove_public_access endpoint = "#{@endpoint}/publish/public" @ac.send_api_request("DELETE", endpoint, nil, @request_headers) end |
#rename(view_name, config = {}) ⇒ Object
Rename a specified view in the workspace.
1575 1576 1577 1578 |
# File 'lib/zoho_analytics_client.rb', line 1575 def rename(view_name, config = {}) config["viewName"] = view_name @ac.send_api_request("PUT", @endpoint, config, @request_headers) end |
#rename_column(column_id, column_name, config = {}) ⇒ Object
Renames a specified column in the table.
1789 1790 1791 1792 1793 |
# File 'lib/zoho_analytics_client.rb', line 1789 def rename_column(column_id, column_name, config = {}) config["columnName"] = column_name endpoint = "#{@endpoint}/columns/#{column_id}" @ac.send_api_request("PUT", endpoint, config, @request_headers) end |
#save_as(new_view_name, config = {}) ⇒ Integer
Copy a specified view within the workspace.
1590 1591 1592 1593 1594 1595 |
# File 'lib/zoho_analytics_client.rb', line 1590 def save_as(new_view_name, config = {}) config["viewName"] = new_view_name endpoint = "#{@endpoint}/saveas" response = @ac.send_api_request("POST", endpoint, config, @request_headers) response["viewId"].to_i end |
#show_columns(column_ids) ⇒ Object
Show hidden columns in the view.
1744 1745 1746 1747 1748 |
# File 'lib/zoho_analytics_client.rb', line 1744 def show_columns(column_ids) config = { "columnIds" => column_ids } endpoint = "#{@endpoint}/columns/show" @ac.send_api_request("PUT", endpoint, config, @request_headers) end |
#update_publish_configurations(config = {}) ⇒ Object
Update publish configurations of the view.
1716 1717 1718 1719 |
# File 'lib/zoho_analytics_client.rb', line 1716 def update_publish_configurations(config = {}) endpoint = "#{@endpoint}/publish/config" @ac.send_api_request("PUT", endpoint, config, @request_headers) end |
#update_row(column_values, criteria, config = {}) ⇒ Hash
Updates rows in the specified table.
1766 1767 1768 1769 1770 1771 1772 |
# File 'lib/zoho_analytics_client.rb', line 1766 def update_row(column_values, criteria, config = {}) config["columns"] = column_values config["criteria"] = criteria unless criteria.nil? endpoint = "#{@endpoint}/rows" response = @ac.send_api_request("PUT", endpoint, config, @request_headers) response end |
#update_shared_details(config = {}) ⇒ Object
Updates the shared details of the specified view.
1947 1948 1949 1950 |
# File 'lib/zoho_analytics_client.rb', line 1947 def update_shared_details(config = {}) endpoint = "#{@endpoint}/share" @ac.send_api_request("PUT", endpoint, config, @request_headers) end |