Class: WorkspaceAPI

Inherits:
Object
  • Object
show all
Defined in:
lib/zoho_analytics_client.rb

Overview

WorkspaceAPI contains workspace-level operations.

Instance Method Summary collapse

Constructor Details

#initialize(ac, org_id, workspace_id) ⇒ WorkspaceAPI

Initializes a new instance of WorkspaceAPI.

Parameters:

  • ac (AnalyticsClient)

    The analytics client instance

  • org_id (String)

    The organization ID

  • workspace_id (String)

    The workspace ID



892
893
894
895
896
# File 'lib/zoho_analytics_client.rb', line 892

def initialize(ac, org_id, workspace_id)
  @ac = ac
  @endpoint = "/restapi/v2/workspaces/#{workspace_id}"
  @request_headers = { 'ZANALYTICS-ORGID' => org_id }
end

Instance Method Details

#add_admins(email_ids, config = {}) ⇒ Object

Add admins to the workspace.

Parameters:

  • email_ids (Array<String>)

    Email addresses

  • config (Hash) (defaults to: {})

    Optional config



973
974
975
976
977
# File 'lib/zoho_analytics_client.rb', line 973

def add_admins(email_ids, config = {})
  config['emailIds'] = email_ids
  endpoint = "#{@endpoint}/admins"
  @ac.send_api_request('POST', endpoint, config, @request_headers)
end

#add_defaultObject

Set the workspace as default.



949
950
951
952
# File 'lib/zoho_analytics_client.rb', line 949

def add_default
  endpoint = "#{@endpoint}/default"
  @ac.send_api_request('POST', endpoint, nil, @request_headers)
end

#add_favoriteObject

Mark the workspace as favorite.



937
938
939
940
# File 'lib/zoho_analytics_client.rb', line 937

def add_favorite
  endpoint = "#{@endpoint}/favorite"
  @ac.send_api_request('POST', endpoint, nil, @request_headers)
end

#add_group_members(group_id, email_ids, config = {}) ⇒ Object

Add users to a group.

Parameters:

  • group_id (String)

    Group ID

  • email_ids (Array<String>)

    Email list

  • config (Hash) (defaults to: {})

    Optional config



1207
1208
1209
1210
1211
# File 'lib/zoho_analytics_client.rb', line 1207

def add_group_members(group_id, email_ids, config = {})
  config['emailIds'] = email_ids
  endpoint = "#{@endpoint}/groups/#{group_id}/members"
  @ac.send_api_request('POST', endpoint, config, @request_headers)
end

#add_workspace_users(email_ids, role, config = {}) ⇒ Object

Add users to the workspace.



1426
1427
1428
1429
1430
1431
# File 'lib/zoho_analytics_client.rb', line 1426

def add_workspace_users(email_ids, role, config = {})
  config['emailIds'] = email_ids
  config['role'] = role
  endpoint = "#{@endpoint}/users"
  @ac.send_api_request('POST', endpoint, config, @request_headers)
end

#change_email_schedule_status(schedule_id, operation) ⇒ Object

Update email schedule status (activate or deactivate).

Parameters:

  • schedule_id (String)

    ID of the email schedule

  • operation (String)

    operation to perform (“activate” or “deactivate”)



1506
1507
1508
1509
1510
# File 'lib/zoho_analytics_client.rb', line 1506

def change_email_schedule_status(schedule_id, operation)
  endpoint = "#{@endpoint}/emailschedules/#{schedule_id}/status"
  config = { "operation" => operation }
  @ac.send_api_request("PUT", endpoint, config, @request_headers)
end

#change_folder_hierarchy(folder_id, hierarchy, config = {}) ⇒ Object

Change folder hierarchy (parent/child).



1384
1385
1386
1387
1388
# File 'lib/zoho_analytics_client.rb', line 1384

def change_folder_hierarchy(folder_id, hierarchy, config = {})
  endpoint = "#{@endpoint}/folders/#{folder_id}/move"
  config['hierarchy'] = hierarchy
  @ac.send_api_request('PUT', endpoint, config, @request_headers)
end

#change_folder_position(folder_id, reference_folder_id, config = {}) ⇒ Object

Reorder folder relative to another folder.



1391
1392
1393
1394
1395
# File 'lib/zoho_analytics_client.rb', line 1391

def change_folder_position(folder_id, reference_folder_id, config = {})
  endpoint = "#{@endpoint}/folders/#{folder_id}/reorder"
  config['referenceFolderId'] = reference_folder_id
  @ac.send_api_request('PUT', endpoint, config, @request_headers)
end

#change_workspace_user_role(email_ids, role, config = {}) ⇒ Object

Change role of workspace users.



1449
1450
1451
1452
1453
1454
# File 'lib/zoho_analytics_client.rb', line 1449

def change_workspace_user_role(email_ids, role, config = {})
  config['emailIds'] = email_ids
  config['role'] = role
  endpoint = "#{@endpoint}/users/role"
  @ac.send_api_request('PUT', endpoint, config, @request_headers)
end

#change_workspace_user_status(email_ids, operation, config = {}) ⇒ Object

Change status (activate/deactivate) of workspace users.



1441
1442
1443
1444
1445
1446
# File 'lib/zoho_analytics_client.rb', line 1441

def change_workspace_user_status(email_ids, operation, config = {})
  config['emailIds'] = email_ids
  config['operation'] = operation
  endpoint = "#{@endpoint}/users/status"
  @ac.send_api_request('PUT', endpoint, config, @request_headers)
end

#copy(new_workspace_name, config = {}, dest_org_id = nil) ⇒ Integer

Copy the specified workspace to a new one.

Parameters:

  • new_workspace_name (String)

    New workspace name

  • config (Hash) (defaults to: {})

    Optional config

  • dest_org_id (String, nil) (defaults to: nil)

    Destination org ID (optional)

Returns:

  • (Integer)

    Copied workspace ID



904
905
906
907
908
909
910
# File 'lib/zoho_analytics_client.rb', line 904

def copy(new_workspace_name, config = {}, dest_org_id = nil)
  config['newWorkspaceName'] = new_workspace_name
  headers = @request_headers.dup
  headers['ZANALYTICS-DEST-ORGID'] = dest_org_id if dest_org_id
  response = @ac.send_api_request('POST', @endpoint, config, headers)
  response['workspaceId'].to_i
end

#copy_views(view_ids, dest_workspace_id, config = {}, dest_org_id = nil) ⇒ Array<Hash>

Copy views to another workspace.

Parameters:

  • view_ids (Array<String>)

    IDs to copy

  • dest_workspace_id (String)

    Destination workspace ID

  • config (Hash) (defaults to: {})

    Optional config

  • dest_org_id (String, nil) (defaults to: nil)

    Destination org ID

Returns:

  • (Array<Hash>)

    Copied views



1109
1110
1111
1112
1113
1114
1115
1116
1117
# File 'lib/zoho_analytics_client.rb', line 1109

def copy_views(view_ids, dest_workspace_id, config = {}, dest_org_id = nil)
  config['viewIds'] = view_ids
  config['destWorkspaceId'] = dest_workspace_id
  endpoint = "#{@endpoint}/views/copy"
  headers = @request_headers.dup
  headers['ZANALYTICS-DEST-ORGID'] = dest_org_id if dest_org_id
  response = @ac.send_api_request('POST', endpoint, config, headers)
  response['views']
end

#create_email_schedule(schedule_name, view_ids, format, email_ids, schedule_details, config = {}) ⇒ String

Create an email schedule in the specified workspace.

Parameters:

  • schedule_name (String)

    name of the email schedule

  • view_ids (Array)

    list of view IDs to be mailed

  • format (String)

    format in which data will be mailed

  • email_ids (Array)

    list of recipient email addresses

  • schedule_details (Hash)

    frequency, date, and time details

  • config (Hash) (defaults to: {})

    additional optional parameters (default: {})

Returns:

  • (String)

    created email schedule ID



1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
# File 'lib/zoho_analytics_client.rb', line 1474

def create_email_schedule(schedule_name, view_ids, format, email_ids, schedule_details, config = {})
  config["scheduleName"] = schedule_name
  config["viewIds"] = view_ids
  config["exportType"] = format
  config["emailIds"] = email_ids
  config["scheduleDetails"] = schedule_details

  endpoint = "#{@endpoint}/emailschedules"
  response = @ac.send_api_request("POST", endpoint, config, @request_headers)
  response["scheduleId"].to_s
end

#create_folder(folder_name, config = {}) ⇒ Integer

Create a new folder in the workspace.

Parameters:

  • folder_name (String)

    Folder name

  • config (Hash) (defaults to: {})

    Optional config

Returns:

  • (Integer)

    Created folder ID



1049
1050
1051
1052
1053
1054
# File 'lib/zoho_analytics_client.rb', line 1049

def create_folder(folder_name, config = {})
  config['folderName'] = folder_name
  endpoint = "#{@endpoint}/folders"
  response = @ac.send_api_request('POST', endpoint, config, @request_headers)
  response['folderId'].to_i
end

#create_group(group_name, email_ids, config = {}) ⇒ Integer

Create a group.

Parameters:

  • group_name (String)

    Name of group

  • email_ids (Array<String>)

    Emails of members

  • config (Hash) (defaults to: {})

    Optional config

Returns:

  • (Integer)

    Group ID



1165
1166
1167
1168
1169
1170
1171
# File 'lib/zoho_analytics_client.rb', line 1165

def create_group(group_name, email_ids, config = {})
  config['groupName'] = group_name
  config['emailIds'] = email_ids
  endpoint = "#{@endpoint}/groups"
  response = @ac.send_api_request('POST', endpoint, config, @request_headers)
  response['groupId'].to_i
end

#create_query_table(sql_query, query_table_name, config = {}) ⇒ Integer

Create a new query table in the workspace.

Parameters:

  • sql_query (String)

    SQL definition

  • query_table_name (String)

    Name of query table

  • config (Hash) (defaults to: {})

    Optional config

Returns:

  • (Integer)

    Created view ID



1083
1084
1085
1086
1087
1088
1089
# File 'lib/zoho_analytics_client.rb', line 1083

def create_query_table(sql_query, query_table_name, config = {})
  config['sqlQuery'] = sql_query
  config['queryTableName'] = query_table_name
  endpoint = "#{@endpoint}/querytables"
  response = @ac.send_api_request('POST', endpoint, config, @request_headers)
  response['viewId'].to_i
end

#create_report(config = {}) ⇒ Integer

Create a report in the specified workspace.

Parameters:

  • config (Hash) (defaults to: {})

    report parameters

Returns:

  • (Integer)

    created view ID



1549
1550
1551
1552
1553
# File 'lib/zoho_analytics_client.rb', line 1549

def create_report(config = {})
  endpoint = "#{@endpoint}/reports"
  response = @ac.send_api_request("POST", endpoint, config, @request_headers)
  response["viewId"].to_i
end

#create_slideshow(slide_name, view_ids, config = {}) ⇒ Integer

Create a slideshow in the workspace.

Parameters:

  • slide_name (String)

    Name of slideshow

  • view_ids (Array<String>)

    View IDs

  • config (Hash) (defaults to: {})

    Optional config

Returns:

  • (Integer)

    Slideshow ID



1230
1231
1232
1233
1234
1235
1236
# File 'lib/zoho_analytics_client.rb', line 1230

def create_slideshow(slide_name, view_ids, config = {})
  config['slideName'] = slide_name
  config['viewIds'] = view_ids
  endpoint = "#{@endpoint}/slides"
  response = @ac.send_api_request('POST', endpoint, config, @request_headers)
  response['slideId'].to_i
end

#create_table(table_design) ⇒ Integer

Create a new table in the workspace.

Parameters:

  • table_design (Hash)

    Table definition

Returns:

  • (Integer)

    Created view ID



1070
1071
1072
1073
1074
1075
# File 'lib/zoho_analytics_client.rb', line 1070

def create_table(table_design)
  config = { 'tableDesign' => table_design }
  endpoint = "#{@endpoint}/tables"
  response = @ac.send_api_request('POST', endpoint, config, @request_headers)
  response['viewId'].to_i
end

#create_variable(variable_name, variable_datatype, variable_type, config = {}) ⇒ Integer

Create a variable in the workspace.

Parameters:

  • variable_name (String)

    Name of the variable

  • variable_datatype (String)

    Datatype of the variable

  • variable_type (String)

    Type of the variable

  • config (Hash) (defaults to: {})

    Additional config

Returns:

  • (Integer)

    Variable ID



1292
1293
1294
1295
1296
1297
1298
1299
# File 'lib/zoho_analytics_client.rb', line 1292

def create_variable(variable_name, variable_datatype, variable_type, config = {})
  endpoint = "#{@endpoint}/variables"
  config['variableName'] = variable_name
  config['variableDataType'] = variable_datatype
  config['variableType'] = variable_type
  response = @ac.send_api_request('POST', endpoint, config, @request_headers)
  response['variableId'].to_i
end

#deleteObject

Delete the specified workspace.



922
923
924
# File 'lib/zoho_analytics_client.rb', line 922

def delete
  @ac.send_api_request('DELETE', @endpoint, nil, @request_headers)
end

#delete_email_schedule(schedule_id) ⇒ Object

Delete the specified email schedule.

Parameters:

  • schedule_id (String)

    ID of the email schedule to delete



1514
1515
1516
1517
# File 'lib/zoho_analytics_client.rb', line 1514

def delete_email_schedule(schedule_id)
  endpoint = "#{@endpoint}/emailschedules/#{schedule_id}"
  @ac.send_api_request("DELETE", endpoint, nil, @request_headers)
end

#delete_folder(folder_id) ⇒ Object

Delete a folder.

Parameters:

  • folder_id (String)

    Folder ID



1145
1146
1147
1148
# File 'lib/zoho_analytics_client.rb', line 1145

def delete_folder(folder_id)
  endpoint = "#{@endpoint}/folders/#{folder_id}"
  @ac.send_api_request('DELETE', endpoint, nil, @request_headers)
end

#delete_group(group_id) ⇒ Object

Delete a group.

Parameters:

  • group_id (String)

    Group ID



1197
1198
1199
1200
# File 'lib/zoho_analytics_client.rb', line 1197

def delete_group(group_id)
  endpoint = "#{@endpoint}/groups/#{group_id}"
  @ac.send_api_request('DELETE', endpoint, nil, @request_headers)
end

#delete_slideshow(slide_id) ⇒ Object

Delete a slideshow.

Parameters:

  • slide_id (String)

    Slideshow ID



1250
1251
1252
1253
# File 'lib/zoho_analytics_client.rb', line 1250

def delete_slideshow(slide_id)
  endpoint = "#{@endpoint}/slides/#{slide_id}"
  @ac.send_api_request('DELETE', endpoint, nil, @request_headers)
end

#delete_trash_views(view_id, config = {}) ⇒ Object

Permanently delete a view from trash.



1378
1379
1380
1381
# File 'lib/zoho_analytics_client.rb', line 1378

def delete_trash_views(view_id, config = {})
  endpoint = "#{@endpoint}/trash/#{view_id}"
  @ac.send_api_request('DELETE', endpoint, config, @request_headers)
end

#delete_variable(variable_id) ⇒ Object

Delete a variable from the workspace.



1311
1312
1313
1314
# File 'lib/zoho_analytics_client.rb', line 1311

def delete_variable(variable_id)
  endpoint = "#{@endpoint}/variables/#{variable_id}"
  @ac.send_api_request('DELETE', endpoint, nil, @request_headers)
end

#disable_domain_accessObject

Disable white-label domain access for the workspace.



1126
1127
1128
1129
# File 'lib/zoho_analytics_client.rb', line 1126

def disable_domain_access
  endpoint = "#{@endpoint}/wlaccess"
  @ac.send_api_request('DELETE', endpoint, nil, @request_headers)
end

#edit_query_table(view_id, sql_query, config = {}) ⇒ Object

Update an existing query table.

Parameters:

  • view_id (String)

    View ID

  • sql_query (String)

    New SQL query

  • config (Hash) (defaults to: {})

    Optional config



1096
1097
1098
1099
1100
# File 'lib/zoho_analytics_client.rb', line 1096

def edit_query_table(view_id, sql_query, config = {})
  config['sqlQuery'] = sql_query
  endpoint = "#{@endpoint}/querytables/#{view_id}"
  @ac.send_api_request('PUT', endpoint, config, @request_headers)
end

#enable_domain_accessObject

Enable the workspace for white-label domain access.



1120
1121
1122
1123
# File 'lib/zoho_analytics_client.rb', line 1120

def enable_domain_access
  endpoint = "#{@endpoint}/wlaccess"
  @ac.send_api_request('POST', endpoint, nil, @request_headers)
end

#export_as_template(view_ids, file_path, config = {}) ⇒ Object

Export views as a template file.

Parameters:

  • view_ids (Array<String>)

    View IDs

  • file_path (String)

    Path to save the file

  • config (Hash) (defaults to: {})

    Optional config



1410
1411
1412
1413
1414
# File 'lib/zoho_analytics_client.rb', line 1410

def export_as_template(view_ids, file_path, config = {})
  endpoint = "#{@endpoint}/template/data"
  config['viewIds'] = view_ids
  @ac.send_export_api_request(endpoint, config, @request_headers, file_path)
end

#get_adminsArray<Hash>

Get list of admins for the workspace.

Returns:

  • (Array<Hash>)

    Admin details



963
964
965
966
967
# File 'lib/zoho_analytics_client.rb', line 963

def get_admins
  endpoint = "#{@endpoint}/admins"
  response = @ac.send_api_request('GET', endpoint, nil, @request_headers)
  response['workspaceAdmins']
end

#get_aggregate_formula_dependents(formula_id) ⇒ Hash

Returns dependents for a specified aggregate formula.

Parameters:

  • formula_id (String)

    aggregate formula ID

Returns:

  • (Hash)

    dependent views and formulas



1531
1532
1533
1534
1535
# File 'lib/zoho_analytics_client.rb', line 1531

def get_aggregate_formula_dependents(formula_id)
  endpoint = "#{@endpoint}/aggregateformulas/#{formula_id}/dependents"
  response = @ac.send_api_request("GET", endpoint, nil, @request_headers)
  response
end

#get_aggregate_formula_value(formula_id) ⇒ String

Returns the value of the aggregate formula.

Parameters:

  • formula_id (String)

    aggregate formula ID

Returns:

  • (String)

    formula value



1540
1541
1542
1543
1544
# File 'lib/zoho_analytics_client.rb', line 1540

def get_aggregate_formula_value(formula_id)
  endpoint = "#{@endpoint}/aggregateformulas/#{formula_id}/value"
  response = @ac.send_api_request("GET", endpoint, nil, @request_headers)
  response["formulaValue"]
end

#get_aggregate_formulas(config = {}) ⇒ Array

Returns list of all aggregate formulas for the specified workspace.

Parameters:

  • config (Hash) (defaults to: {})

    optional parameters (default: {})

Returns:

  • (Array)

    list of aggregate formulas



1522
1523
1524
1525
1526
# File 'lib/zoho_analytics_client.rb', line 1522

def get_aggregate_formulas(config = {})
  endpoint = "#{@endpoint}/aggregateformulas"
  response = @ac.send_api_request("GET", endpoint, config, @request_headers)
  response["aggregateFormulas"]
end

#get_datasourcesArray<Hash>

Get list of data sources.

Returns:

  • (Array<Hash>)

    List of data sources



1344
1345
1346
1347
1348
# File 'lib/zoho_analytics_client.rb', line 1344

def get_datasources
  endpoint = "#{@endpoint}/datasources"
  response = @ac.send_api_request('GET', endpoint, nil, @request_headers)
  response['dataSources']
end

#get_email_schedulesArray

Returns list of email schedules available in the specified workspace.

Returns:

  • (Array)

    list of email schedules

Raises:

  • (ServerError)

    if the server fails to process the request

  • (ParseError)

    if the response can't be parsed



1460
1461
1462
1463
1464
# File 'lib/zoho_analytics_client.rb', line 1460

def get_email_schedules
  endpoint = "#{@endpoint}/emailschedules"
  response = @ac.send_api_request("GET", endpoint, nil, @request_headers)
  response["emailSchedules"]
end

#get_foldersArray<Hash>

Returns a list of all accessible folders in the workspace.

Returns:

  • (Array<Hash>)

    Folder list



1038
1039
1040
1041
1042
# File 'lib/zoho_analytics_client.rb', line 1038

def get_folders
  endpoint = "#{@endpoint}/folders"
  response = @ac.send_api_request('GET', endpoint, nil, @request_headers)
  response['folders']
end

#get_group_details(group_id) ⇒ Hash

Get details for a group.

Parameters:

  • group_id (String)

    Group ID

Returns:

  • (Hash)

    Group details



1177
1178
1179
1180
1181
# File 'lib/zoho_analytics_client.rb', line 1177

def get_group_details(group_id)
  endpoint = "#{@endpoint}/groups/#{group_id}"
  response = @ac.send_api_request('GET', endpoint, nil, @request_headers)
  response['groups']
end

#get_groupsArray<Hash>

Get groups in the workspace.

Returns:

  • (Array<Hash>)

    Group list



1153
1154
1155
1156
1157
# File 'lib/zoho_analytics_client.rb', line 1153

def get_groups
  endpoint = "#{@endpoint}/groups"
  response = @ac.send_api_request('GET', endpoint, nil, @request_headers)
  response['groups']
end

#get_secret_key(config = {}) ⇒ String

Get the secret key for the workspace.

Parameters:

  • config (Hash) (defaults to: {})

    Optional config

Returns:

  • (String)

    Secret key



930
931
932
933
934
# File 'lib/zoho_analytics_client.rb', line 930

def get_secret_key(config = {})
  endpoint = "#{@endpoint}/secretkey"
  response = @ac.send_api_request('GET', endpoint, config, @request_headers)
  response['workspaceKey']
end

#get_share_infoHash

Get workspace share info.

Returns:

  • (Hash)

    Share information



992
993
994
995
996
# File 'lib/zoho_analytics_client.rb', line 992

def get_share_info
  endpoint = "#{@endpoint}/share"
  response = @ac.send_api_request('GET', endpoint, nil, @request_headers)
  response
end

#get_shared_details_for_views(view_ids) ⇒ Array<Hash>

Get shared details for the given views.

Parameters:

  • view_ids (Array<String>)

    View IDs

Returns:

  • (Array<Hash>)

    Shared detail entries



1028
1029
1030
1031
1032
1033
# File 'lib/zoho_analytics_client.rb', line 1028

def get_shared_details_for_views(view_ids)
  config = { 'viewIds' => view_ids }
  endpoint = "#{@endpoint}/share/shareddetails"
  response = @ac.send_api_request('GET', endpoint, config, @request_headers)
  response['sharedDetails']
end

#get_slideshow_details(slide_id) ⇒ Hash

Get slideshow details.

Parameters:

  • slide_id (String)

    Slideshow ID

Returns:

  • (Hash)

    Slideshow details



1279
1280
1281
1282
1283
# File 'lib/zoho_analytics_client.rb', line 1279

def get_slideshow_details(slide_id)
  endpoint = "#{@endpoint}/slides/#{slide_id}"
  response = @ac.send_api_request('GET', endpoint, nil, @request_headers)
  response['slideInfo']
end

#get_slideshow_url(slide_id, config = {}) ⇒ String

Get URL to access a slideshow.

Parameters:

  • slide_id (String)

    Slideshow ID

  • config (Hash) (defaults to: {})

    Optional config

Returns:

  • (String)

    Published URL



1269
1270
1271
1272
1273
# File 'lib/zoho_analytics_client.rb', line 1269

def get_slideshow_url(slide_id, config = {})
  endpoint = "#{@endpoint}/slides/#{slide_id}/publish"
  response = @ac.send_api_request('GET', endpoint, config, @request_headers)
  response['slideUrl']
end

#get_slideshowsArray<Hash>

Get all slideshows in the workspace.

Returns:

  • (Array<Hash>)

    Slideshow list



1258
1259
1260
1261
1262
# File 'lib/zoho_analytics_client.rb', line 1258

def get_slideshows
  endpoint = "#{@endpoint}/slides"
  response = @ac.send_api_request('GET', endpoint, nil, @request_headers)
  response['slideshows']
end

#get_trash_viewsArray<Hash>

Get list of trash views.

Returns:

  • (Array<Hash>)

    Trash views



1365
1366
1367
1368
1369
# File 'lib/zoho_analytics_client.rb', line 1365

def get_trash_views
  endpoint = "#{@endpoint}/trash"
  response = @ac.send_api_request('GET', endpoint, nil, @request_headers)
  response['views']
end

#get_variable_details(variable_id) ⇒ Hash

Get details of a specific variable.

Parameters:

  • variable_id (String)

    ID of the variable

Returns:

  • (Hash)

    Variable details



1329
1330
1331
1332
1333
# File 'lib/zoho_analytics_client.rb', line 1329

def get_variable_details(variable_id)
  endpoint = "#{@endpoint}/variables/#{variable_id}"
  response = @ac.send_api_request('GET', endpoint, nil, @request_headers)
  response
end

#get_variablesArray<Hash>

Get list of variables in the workspace.

Returns:

  • (Array<Hash>)

    List of variables



1319
1320
1321
1322
1323
# File 'lib/zoho_analytics_client.rb', line 1319

def get_variables
  endpoint = "#{@endpoint}/variables"
  response = @ac.send_api_request('GET', endpoint, nil, @request_headers)
  response['variables']
end

#get_views(config = {}) ⇒ Array<Hash>

Get list of all views in the workspace.

Parameters:

  • config (Hash) (defaults to: {})

    Optional config

Returns:

  • (Array<Hash>)

    View list



1060
1061
1062
1063
1064
# File 'lib/zoho_analytics_client.rb', line 1060

def get_views(config = {})
  endpoint = "#{@endpoint}/views"
  response = @ac.send_api_request('GET', endpoint, config, @request_headers)
  response['views']
end

#get_workspace_usersArray<Hash>

Get users in the workspace.

Returns:

  • (Array<Hash>)

    User list



1419
1420
1421
1422
1423
# File 'lib/zoho_analytics_client.rb', line 1419

def get_workspace_users
  endpoint = "#{@endpoint}/users"
  response = @ac.send_api_request('GET', endpoint, nil, @request_headers)
  response['users']
end

#make_default_folder(folder_id) ⇒ Object

Mark a folder as default.



1336
1337
1338
1339
# File 'lib/zoho_analytics_client.rb', line 1336

def make_default_folder(folder_id)
  endpoint = "#{@endpoint}/folders/#{folder_id}/default"
  @ac.send_api_request('PUT', endpoint, nil, @request_headers)
end

#move_views_to_folder(folder_id, view_ids, config = {}) ⇒ Object

Move views into a folder.



1398
1399
1400
1401
1402
1403
# File 'lib/zoho_analytics_client.rb', line 1398

def move_views_to_folder(folder_id, view_ids, config = {})
  endpoint = "#{@endpoint}/views/movetofolder"
  config['folderId'] = folder_id
  config['viewIds'] = view_ids
  @ac.send_api_request('PUT', endpoint, config, @request_headers)
end

#remove_admins(email_ids, config = {}) ⇒ Object

Remove admins from the workspace.

Parameters:

  • email_ids (Array<String>)

    Email addresses

  • config (Hash) (defaults to: {})

    Optional config



983
984
985
986
987
# File 'lib/zoho_analytics_client.rb', line 983

def remove_admins(email_ids, config = {})
  config['emailIds'] = email_ids
  endpoint = "#{@endpoint}/admins"
  @ac.send_api_request('DELETE', endpoint, config, @request_headers)
end

#remove_defaultObject

Unset the workspace from default.



955
956
957
958
# File 'lib/zoho_analytics_client.rb', line 955

def remove_default
  endpoint = "#{@endpoint}/default"
  @ac.send_api_request('DELETE', endpoint, nil, @request_headers)
end

#remove_favoriteObject

Unmark the workspace as favorite.



943
944
945
946
# File 'lib/zoho_analytics_client.rb', line 943

def remove_favorite
  endpoint = "#{@endpoint}/favorite"
  @ac.send_api_request('DELETE', endpoint, nil, @request_headers)
end

#remove_group_members(group_id, email_ids, config = {}) ⇒ Object

Remove users from a group.

Parameters:

  • group_id (String)

    Group ID

  • email_ids (Array<String>)

    Email list

  • config (Hash) (defaults to: {})

    Optional config



1218
1219
1220
1221
1222
# File 'lib/zoho_analytics_client.rb', line 1218

def remove_group_members(group_id, email_ids, config = {})
  config['emailIds'] = email_ids
  endpoint = "#{@endpoint}/groups/#{group_id}/members"
  @ac.send_api_request('DELETE', endpoint, config, @request_headers)
end

#remove_share(view_ids, email_ids, config = {}) ⇒ Object

Remove shared views for specific users.

Parameters:

  • view_ids (Array<String>, nil)

    View IDs

  • email_ids (Array<String>)

    User emails

  • config (Hash) (defaults to: {})

    Optional config



1017
1018
1019
1020
1021
1022
# File 'lib/zoho_analytics_client.rb', line 1017

def remove_share(view_ids, email_ids, config = {})
  config['emailIds'] = email_ids
  config['viewIds'] = view_ids if view_ids
  endpoint = "#{@endpoint}/share"
  @ac.send_api_request('DELETE', endpoint, config, @request_headers)
end

#remove_workspace_users(email_ids, config = {}) ⇒ Object

Remove users from the workspace.



1434
1435
1436
1437
1438
# File 'lib/zoho_analytics_client.rb', line 1434

def remove_workspace_users(email_ids, config = {})
  config['emailIds'] = email_ids
  endpoint = "#{@endpoint}/users"
  @ac.send_api_request('DELETE', endpoint, config, @request_headers)
end

#rename(workspace_name, config = {}) ⇒ Object

Rename the specified workspace.

Parameters:

  • workspace_name (String)

    New name

  • config (Hash) (defaults to: {})

    Optional config



916
917
918
919
# File 'lib/zoho_analytics_client.rb', line 916

def rename(workspace_name, config = {})
  config['workspaceName'] = workspace_name
  @ac.send_api_request('PUT', @endpoint, config, @request_headers)
end

#rename_folder(folder_id, folder_name, config = {}) ⇒ Object

Rename a folder.

Parameters:

  • folder_id (String)

    Folder ID

  • folder_name (String)

    New name

  • config (Hash) (defaults to: {})

    Optional config



1136
1137
1138
1139
1140
# File 'lib/zoho_analytics_client.rb', line 1136

def rename_folder(folder_id, folder_name, config = {})
  config['folderName'] = folder_name
  endpoint = "#{@endpoint}/folders/#{folder_id}"
  @ac.send_api_request('PUT', endpoint, config, @request_headers)
end

#rename_group(group_id, group_name, config = {}) ⇒ Object

Rename a group.

Parameters:

  • group_id (String)

    Group ID

  • group_name (String)

    New name

  • config (Hash) (defaults to: {})

    Optional config



1188
1189
1190
1191
1192
# File 'lib/zoho_analytics_client.rb', line 1188

def rename_group(group_id, group_name, config = {})
  config['groupName'] = group_name
  endpoint = "#{@endpoint}/groups/#{group_id}"
  @ac.send_api_request('PUT', endpoint, config, @request_headers)
end

#restore_trash_views(view_id, config = {}) ⇒ Object

Restore a view from trash.



1372
1373
1374
1375
# File 'lib/zoho_analytics_client.rb', line 1372

def restore_trash_views(view_id, config = {})
  endpoint = "#{@endpoint}/trash/#{view_id}"
  @ac.send_api_request('POST', endpoint, config, @request_headers)
end

#share_views(view_ids, email_ids, permissions, config = {}) ⇒ Object

Share views to users.

Parameters:

  • view_ids (Array<String>)

    View IDs to share

  • email_ids (Array<String>)

    User emails

  • permissions (Hash)

    Permission map

  • config (Hash) (defaults to: {})

    Optional config



1004
1005
1006
1007
1008
1009
1010
# File 'lib/zoho_analytics_client.rb', line 1004

def share_views(view_ids, email_ids, permissions, config = {})
  config['viewIds'] = view_ids
  config['emailIds'] = email_ids
  config['permissions'] = permissions
  endpoint = "#{@endpoint}/share"
  @ac.send_api_request('POST', endpoint, config, @request_headers)
end

#sync_data(datasource_id, config = {}) ⇒ Object

Trigger data sync for a data source.



1351
1352
1353
1354
# File 'lib/zoho_analytics_client.rb', line 1351

def sync_data(datasource_id, config = {})
  endpoint = "#{@endpoint}/datasources/#{datasource_id}/sync"
  @ac.send_api_request('POST', endpoint, config, @request_headers)
end

#trigger_email_schedule(schedule_id) ⇒ Object

Trigger the configured email schedule instantly.

Parameters:

  • schedule_id (String)

    ID of the email schedule to trigger



1498
1499
1500
1501
# File 'lib/zoho_analytics_client.rb', line 1498

def trigger_email_schedule(schedule_id)
  endpoint = "#{@endpoint}/emailschedules/#{schedule_id}"
  @ac.send_api_request("POST", endpoint, nil, @request_headers)
end

#update_datasource_connection(datasource_id, config = {}) ⇒ Object

Update data source connection.



1357
1358
1359
1360
# File 'lib/zoho_analytics_client.rb', line 1357

def update_datasource_connection(datasource_id, config = {})
  endpoint = "#{@endpoint}/datasources/#{datasource_id}"
  @ac.send_api_request('PUT', endpoint, config, @request_headers)
end

#update_email_schedule(schedule_id, config) ⇒ String

Update configurations of the specified email schedule.

Parameters:

  • schedule_id (String)

    ID of the email schedule to update

  • config (Hash)

    configuration parameters to update

Returns:

  • (String)

    updated schedule ID



1490
1491
1492
1493
1494
# File 'lib/zoho_analytics_client.rb', line 1490

def update_email_schedule(schedule_id, config)
  endpoint = "#{@endpoint}/emailschedules/#{schedule_id}"
  response = @ac.send_api_request("PUT", endpoint, config, @request_headers)
  response["scheduleId"].to_s
end

#update_report(view_id, config = {}) ⇒ Object

Update the design and configuration of the specified report.

Parameters:

  • view_id (String)

    ID of the report view

  • config (Hash) (defaults to: {})

    configuration parameters



1558
1559
1560
1561
# File 'lib/zoho_analytics_client.rb', line 1558

def update_report(view_id, config = {})
  endpoint = "#{@endpoint}/reports/#{view_id}"
  @ac.send_api_request("PUT", endpoint, config, @request_headers)
end

#update_slideshow(slide_id, config = {}) ⇒ Object

Update a slideshow.

Parameters:

  • slide_id (String)

    Slideshow ID

  • config (Hash) (defaults to: {})

    Update data



1242
1243
1244
1245
# File 'lib/zoho_analytics_client.rb', line 1242

def update_slideshow(slide_id, config = {})
  endpoint = "#{@endpoint}/slides/#{slide_id}"
  @ac.send_api_request('PUT', endpoint, config, @request_headers)
end

#update_variable(variable_id, variable_name, variable_datatype, variable_type, config = {}) ⇒ Object

Update a variable in the workspace.



1302
1303
1304
1305
1306
1307
1308
# File 'lib/zoho_analytics_client.rb', line 1302

def update_variable(variable_id, variable_name, variable_datatype, variable_type, config = {})
  endpoint = "#{@endpoint}/variables/#{variable_id}"
  config['variableName'] = variable_name
  config['variableDataType'] = variable_datatype
  config['variableType'] = variable_type
  @ac.send_api_request('PUT', endpoint, config, @request_headers)
end