class ZohoSdk::Analytics::Workspace
Attributes
client[R]
Public Class Methods
new(workspace_name, client)
click to toggle source
# File lib/zoho-sdk/analytics/workspace.rb, line 7 def initialize(workspace_name, client) @workspace_name = workspace_name @client = client @metadata = nil end
Public Instance Methods
create_table(table_name, folder = nil, **opts)
click to toggle source
Create a new table in the workspace. @param table_name [String] The new table's name @param folder [String] Folder name to create the table under. @param opts [Hash] Optional arguments @option opts [String] :description The table's description @return [Table] Newly created table
# File lib/zoho-sdk/analytics/workspace.rb, line 42 def create_table(table_name, folder = nil, **opts) table_design = { "TABLENAME" => table_name, "TABLEDESCRIPTION" => opts[:description] || "", "COLUMNS" => [] } table_design["FOLDERNAME"] = folder if !folder.nil? res = client.get path: name, params: { "ZOHO_ACTION" => "CREATETABLE", "ZOHO_TABLE_DESIGN" => table_design.to_json } if res.success? data = JSON.parse(res.body) Table.new(name, self, client) else nil end end
metadata()
click to toggle source
# File lib/zoho-sdk/analytics/workspace.rb, line 17 def metadata return @metadata if !@metadata.nil? metadata! end
metadata!()
click to toggle source
# File lib/zoho-sdk/analytics/workspace.rb, line 22 def metadata! res = client.get path: name, params: { "ZOHO_ACTION" => "DATABASEMETADATA", "ZOHO_METADATA" => "ZOHO_CATALOG_INFO" } if res.success? data = JSON.parse(res.body) @metadata = data.dig("response", "result") @metadata else nil end end
name()
click to toggle source
# File lib/zoho-sdk/analytics/workspace.rb, line 13 def name @workspace_name end
table(table_name)
click to toggle source
Retrieve a table by name from the workspace @param table_name [String] The table name @return [Table]
# File lib/zoho-sdk/analytics/workspace.rb, line 64 def table(table_name) res = client.get path: name, params: { "ZOHO_ACTION" => "ISVIEWEXIST", "ZOHO_VIEW_NAME" => table_name } if res.success? data = JSON.parse(res.body) if data.dig("response", "result", "isviewexist") == "true" Table.new(table_name, self, client) else nil end else nil end end