Class: OrgAPI
- Inherits:
-
Object
- Object
- OrgAPI
- Defined in:
- lib/zoho_analytics_client.rb
Overview
OrgAPI contains organization-level operations.
Instance Method Summary collapse
-
#activate_users(email_ids, config = {}) ⇒ Object
Activate users in the specified organization.
-
#add_users(email_ids, config = {}) ⇒ Object
Add users to the specified organization.
-
#change_user_role(email_ids, role, config = {}) ⇒ Object
Change role for the specified users.
-
#create_workspace(workspace_name, config = {}) ⇒ Integer
Create a blank workspace in the specified organization.
-
#deactivate_users(email_ids, config = {}) ⇒ Object
Deactivate users in the specified organization.
-
#get_admins ⇒ Array<Hash>
Returns list of admins for a specified organization.
-
#get_meta_details(workspace_name, view_name = nil) ⇒ Hash
Returns metadata details of a workspace or a specific view.
-
#get_resource_details ⇒ Hash
Returns resource usage details of the specified organization.
-
#get_subscription_details ⇒ Hash
Returns subscription details of the specified organization.
-
#get_users ⇒ Array<Hash>
Returns list of users for the specified organization.
-
#initialize(ac, org_id) ⇒ OrgAPI
constructor
Initializes a new instance of OrgAPI.
-
#remove_users(email_ids, config = {}) ⇒ Object
Remove users from the specified organization.
Constructor Details
#initialize(ac, org_id) ⇒ OrgAPI
Initializes a new instance of OrgAPI.
764 765 766 767 |
# File 'lib/zoho_analytics_client.rb', line 764 def initialize(ac, org_id) @ac = ac @request_headers = { 'ZANALYTICS-ORGID' => org_id } end |
Instance Method Details
#activate_users(email_ids, config = {}) ⇒ Object
Activate users in the specified organization.
825 826 827 828 829 |
# File 'lib/zoho_analytics_client.rb', line 825 def activate_users(email_ids, config = {}) config['emailIds'] = email_ids endpoint = '/restapi/v2/users/active' @ac.send_api_request('PUT', endpoint, config, @request_headers) end |
#add_users(email_ids, config = {}) ⇒ Object
Add users to the specified organization.
805 806 807 808 809 |
# File 'lib/zoho_analytics_client.rb', line 805 def add_users(email_ids, config = {}) config['emailIds'] = email_ids endpoint = '/restapi/v2/users' @ac.send_api_request('POST', endpoint, config, @request_headers) end |
#change_user_role(email_ids, role, config = {}) ⇒ Object
Change role for the specified users.
846 847 848 849 850 851 |
# File 'lib/zoho_analytics_client.rb', line 846 def change_user_role(email_ids, role, config = {}) config['emailIds'] = email_ids config['role'] = role endpoint = '/restapi/v2/users/role' @ac.send_api_request('PUT', endpoint, config, @request_headers) end |
#create_workspace(workspace_name, config = {}) ⇒ Integer
Create a blank workspace in the specified organization.
776 777 778 779 780 781 |
# File 'lib/zoho_analytics_client.rb', line 776 def create_workspace(workspace_name, config = {}) config['workspaceName'] = workspace_name endpoint = '/restapi/v2/workspaces/' response = @ac.send_api_request('POST', endpoint, config, @request_headers) response['workspaceId'].to_i end |
#deactivate_users(email_ids, config = {}) ⇒ Object
Deactivate users in the specified organization.
835 836 837 838 839 |
# File 'lib/zoho_analytics_client.rb', line 835 def deactivate_users(email_ids, config = {}) config['emailIds'] = email_ids endpoint = '/restapi/v2/users/inactive' @ac.send_api_request('PUT', endpoint, config, @request_headers) end |
#get_admins ⇒ Array<Hash>
Returns list of admins for a specified organization.
786 787 788 789 790 |
# File 'lib/zoho_analytics_client.rb', line 786 def get_admins endpoint = '/restapi/v2/orgadmins' response = @ac.send_api_request('GET', endpoint, nil, @request_headers) response['orgAdmins'] end |
#get_meta_details(workspace_name, view_name = nil) ⇒ Hash
Returns metadata details of a workspace or a specific view.
876 877 878 879 880 881 882 |
# File 'lib/zoho_analytics_client.rb', line 876 def (workspace_name, view_name = nil) config = { 'workspaceName' => workspace_name } config['viewName'] = view_name unless view_name.nil? endpoint = '/restapi/v2/metadetails' response = @ac.send_api_request('GET', endpoint, config, @request_headers) response end |
#get_resource_details ⇒ Hash
Returns resource usage details of the specified organization.
865 866 867 868 869 |
# File 'lib/zoho_analytics_client.rb', line 865 def get_resource_details endpoint = '/restapi/v2/resources' response = @ac.send_api_request('GET', endpoint, nil, @request_headers) response['resourceDetails'] end |
#get_subscription_details ⇒ Hash
Returns subscription details of the specified organization.
856 857 858 859 860 |
# File 'lib/zoho_analytics_client.rb', line 856 def get_subscription_details endpoint = '/restapi/v2/subscription' response = @ac.send_api_request('GET', endpoint, nil, @request_headers) response['subscription'] end |
#get_users ⇒ Array<Hash>
Returns list of users for the specified organization.
795 796 797 798 799 |
# File 'lib/zoho_analytics_client.rb', line 795 def get_users endpoint = '/restapi/v2/users' response = @ac.send_api_request('GET', endpoint, nil, @request_headers) response['users'] end |
#remove_users(email_ids, config = {}) ⇒ Object
Remove users from the specified organization.
815 816 817 818 819 |
# File 'lib/zoho_analytics_client.rb', line 815 def remove_users(email_ids, config = {}) config['emailIds'] = email_ids endpoint = '/restapi/v2/users' @ac.send_api_request('DELETE', endpoint, config, @request_headers) end |