Class: PlatformRest::InstanceSandbox
- Inherits:
-
Object
- Object
- PlatformRest::InstanceSandbox
- Defined in:
- lib/platform_rest/instance_sandbox.rb
Overview
Class containing all the actions for the Instance Sandbox Resource
Instance Method Summary collapse
-
#delete(params = {}) ⇒ Object
Deletes a sandbox user account.
-
#device_counts(params = {}) ⇒ Object
Returns device counts by day for the time range specified for all applications the sandbox user owns.
-
#get(params = {}) ⇒ Object
Returns a sandbox user.
-
#initialize(client) ⇒ InstanceSandbox
constructor
A new instance of InstanceSandbox.
-
#notebook_minute_counts(params = {}) ⇒ Object
Returns notebook execution usage by day for the time range specified for all applications the sandbox user owns.
-
#payload_counts(params = {}) ⇒ Object
Returns payload counts for the time range specified for all applications the sandbox user owns.
-
#payload_counts_breakdown(params = {}) ⇒ Object
Returns payload counts per resolution in the time range specified for all applications the sandbox user owns.
-
#undelete(params = {}) ⇒ Object
Restores a sandbox user account.
Constructor Details
#initialize(client) ⇒ InstanceSandbox
30 31 32 |
# File 'lib/platform_rest/instance_sandbox.rb', line 30 def initialize(client) @client = client end |
Instance Method Details
#delete(params = {}) ⇒ Object
Deletes a sandbox user account
Authentication: The client must be configured with a valid api access token to call this action. The token must include at least one of the following scopes: all.Instance, all.User, instanceSandbox.*, or instanceSandbox.delete.
Parameters:
-
string instanceId - ID associated with the instance
-
string instanceSandboxId - ID associated with the sandbox user
-
string losantdomain - Domain scope of request (rarely needed)
-
boolean _actions - Return resource actions in response
-
boolean _links - Return resource link in response
-
boolean _embedded - Return embedded resources in response
Responses:
-
200 - If a sandbox was successfully deleted (api.losant.com/#/definitions/success)
Errors:
-
400 - Error if malformed request (api.losant.com/#/definitions/error)
-
404 - Error if sandbox or instance was not found (api.losant.com/#/definitions/error)
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/platform_rest/instance_sandbox.rb', line 56 def delete(params = {}) params = Utils.symbolize_hash_keys(params) query_params = { _actions: false, _links: true, _embedded: true } headers = {} body = nil raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId) raise ArgumentError.new("instanceSandboxId is required") unless params.has_key?(:instanceSandboxId) headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain) query_params[:_actions] = params[:_actions] if params.has_key?(:_actions) query_params[:_links] = params[:_links] if params.has_key?(:_links) query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded) path = "/instances/#{params[:instanceId]}/sandboxes/#{params[:instanceSandboxId]}" @client.request( method: :delete, path: path, query: query_params, headers: headers, body: body) end |
#device_counts(params = {}) ⇒ Object
Returns device counts by day for the time range specified for all applications the sandbox user owns
Authentication: The client must be configured with a valid api access token to call this action. The token must include at least one of the following scopes: all.Instance, all.Instance.read, all.User, all.User.read, instanceSandbox.*, or instanceSandbox.deviceCounts.
Parameters:
-
string instanceId - ID associated with the instance
-
string instanceSandboxId - ID associated with the sandbox user
-
string start - Start of range for device count query (ms since epoch)
-
string end - End of range for device count query (ms since epoch)
-
string losantdomain - Domain scope of request (rarely needed)
-
boolean _actions - Return resource actions in response
-
boolean _links - Return resource link in response
-
boolean _embedded - Return embedded resources in response
Responses:
-
200 - Device counts by day (api.losant.com/#/definitions/deviceCounts)
Errors:
-
400 - Error if malformed request (api.losant.com/#/definitions/error)
-
404 - Error if sandbox or instance was not found (api.losant.com/#/definitions/error)
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/platform_rest/instance_sandbox.rb', line 104 def device_counts(params = {}) params = Utils.symbolize_hash_keys(params) query_params = { _actions: false, _links: true, _embedded: true } headers = {} body = nil raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId) raise ArgumentError.new("instanceSandboxId is required") unless params.has_key?(:instanceSandboxId) query_params[:start] = params[:start] if params.has_key?(:start) query_params[:end] = params[:end] if params.has_key?(:end) headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain) query_params[:_actions] = params[:_actions] if params.has_key?(:_actions) query_params[:_links] = params[:_links] if params.has_key?(:_links) query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded) path = "/instances/#{params[:instanceId]}/sandboxes/#{params[:instanceSandboxId]}/deviceCounts" @client.request( method: :get, path: path, query: query_params, headers: headers, body: body) end |
#get(params = {}) ⇒ Object
Returns a sandbox user
Authentication: The client must be configured with a valid api access token to call this action. The token must include at least one of the following scopes: all.Instance, all.Instance.read, all.User, all.User.read, instanceSandbox.*, or instanceSandbox.get.
Parameters:
-
string instanceId - ID associated with the instance
-
string instanceSandboxId - ID associated with the sandbox user
-
string summaryExclude - Comma-separated list of summary fields to exclude from user summary
-
string summaryInclude - Comma-separated list of summary fields to include in user summary
-
string losantdomain - Domain scope of request (rarely needed)
-
boolean _actions - Return resource actions in response
-
boolean _links - Return resource link in response
-
boolean _embedded - Return embedded resources in response
Responses:
-
200 - A single sandbox user (api.losant.com/#/definitions/instanceSandbox)
Errors:
-
400 - Error if malformed request (api.losant.com/#/definitions/error)
-
404 - Error if sandbox or instance was not found (api.losant.com/#/definitions/error)
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/platform_rest/instance_sandbox.rb', line 154 def get(params = {}) params = Utils.symbolize_hash_keys(params) query_params = { _actions: false, _links: true, _embedded: true } headers = {} body = nil raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId) raise ArgumentError.new("instanceSandboxId is required") unless params.has_key?(:instanceSandboxId) query_params[:summaryExclude] = params[:summaryExclude] if params.has_key?(:summaryExclude) query_params[:summaryInclude] = params[:summaryInclude] if params.has_key?(:summaryInclude) headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain) query_params[:_actions] = params[:_actions] if params.has_key?(:_actions) query_params[:_links] = params[:_links] if params.has_key?(:_links) query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded) path = "/instances/#{params[:instanceId]}/sandboxes/#{params[:instanceSandboxId]}" @client.request( method: :get, path: path, query: query_params, headers: headers, body: body) end |
#notebook_minute_counts(params = {}) ⇒ Object
Returns notebook execution usage by day for the time range specified for all applications the sandbox user owns
Authentication: The client must be configured with a valid api access token to call this action. The token must include at least one of the following scopes: all.Instance, all.Instance.read, all.User, all.User.read, instanceSandbox.*, or instanceSandbox.notebookMinuteCounts.
Parameters:
-
string instanceId - ID associated with the instance
-
string instanceSandboxId - ID associated with the sandbox user
-
string start - Start of range for notebook execution query (ms since epoch)
-
string end - End of range for notebook execution query (ms since epoch)
-
string losantdomain - Domain scope of request (rarely needed)
-
boolean _actions - Return resource actions in response
-
boolean _links - Return resource link in response
-
boolean _embedded - Return embedded resources in response
Responses:
-
200 - Notebook usage information (api.losant.com/#/definitions/notebookMinuteCounts)
Errors:
-
400 - Error if malformed request (api.losant.com/#/definitions/error)
-
404 - Error if sandbox or instance was not found (api.losant.com/#/definitions/error)
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
# File 'lib/platform_rest/instance_sandbox.rb', line 204 def notebook_minute_counts(params = {}) params = Utils.symbolize_hash_keys(params) query_params = { _actions: false, _links: true, _embedded: true } headers = {} body = nil raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId) raise ArgumentError.new("instanceSandboxId is required") unless params.has_key?(:instanceSandboxId) query_params[:start] = params[:start] if params.has_key?(:start) query_params[:end] = params[:end] if params.has_key?(:end) headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain) query_params[:_actions] = params[:_actions] if params.has_key?(:_actions) query_params[:_links] = params[:_links] if params.has_key?(:_links) query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded) path = "/instances/#{params[:instanceId]}/sandboxes/#{params[:instanceSandboxId]}/notebookMinuteCounts" @client.request( method: :get, path: path, query: query_params, headers: headers, body: body) end |
#payload_counts(params = {}) ⇒ Object
Returns payload counts for the time range specified for all applications the sandbox user owns
Authentication: The client must be configured with a valid api access token to call this action. The token must include at least one of the following scopes: all.Instance, all.Instance.read, all.User, all.User.read, instanceSandbox.*, or instanceSandbox.payloadCounts.
Parameters:
-
string instanceId - ID associated with the instance
-
string instanceSandboxId - ID associated with the sandbox user
-
string start - Start of range for payload count query (ms since epoch)
-
string end - End of range for payload count query (ms since epoch)
-
string asBytes - If the resulting stats should be returned as bytes
-
string losantdomain - Domain scope of request (rarely needed)
-
boolean _actions - Return resource actions in response
-
boolean _links - Return resource link in response
-
boolean _embedded - Return embedded resources in response
Responses:
-
200 - Payload counts, by type and source (api.losant.com/#/definitions/payloadStats)
Errors:
-
400 - Error if malformed request (api.losant.com/#/definitions/error)
-
404 - Error if sandbox or instance was not found (api.losant.com/#/definitions/error)
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/platform_rest/instance_sandbox.rb', line 255 def payload_counts(params = {}) params = Utils.symbolize_hash_keys(params) query_params = { _actions: false, _links: true, _embedded: true } headers = {} body = nil raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId) raise ArgumentError.new("instanceSandboxId is required") unless params.has_key?(:instanceSandboxId) query_params[:start] = params[:start] if params.has_key?(:start) query_params[:end] = params[:end] if params.has_key?(:end) query_params[:asBytes] = params[:asBytes] if params.has_key?(:asBytes) headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain) query_params[:_actions] = params[:_actions] if params.has_key?(:_actions) query_params[:_links] = params[:_links] if params.has_key?(:_links) query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded) path = "/instances/#{params[:instanceId]}/sandboxes/#{params[:instanceSandboxId]}/payloadCounts" @client.request( method: :get, path: path, query: query_params, headers: headers, body: body) end |
#payload_counts_breakdown(params = {}) ⇒ Object
Returns payload counts per resolution in the time range specified for all applications the sandbox user owns
Authentication: The client must be configured with a valid api access token to call this action. The token must include at least one of the following scopes: all.Instance, all.Instance.read, all.User, all.User.read, instanceSandbox.*, or instanceSandbox.payloadCountsBreakdown.
Parameters:
-
string instanceId - ID associated with the instance
-
string instanceSandboxId - ID associated with the sandbox user
-
string start - Start of range for payload count query (ms since epoch)
-
string end - End of range for payload count query (ms since epoch)
-
string resolution - Resolution in milliseconds. Accepted values are: 86400000, 3600000
-
string asBytes - If the resulting stats should be returned as bytes
-
string includeNonBillable - If non-billable payloads should be included in the result
-
string losantdomain - Domain scope of request (rarely needed)
-
boolean _actions - Return resource actions in response
-
boolean _links - Return resource link in response
-
boolean _embedded - Return embedded resources in response
Responses:
-
200 - Sum of payload counts by date (api.losant.com/#/definitions/payloadCountsBreakdown)
Errors:
-
400 - Error if malformed request (api.losant.com/#/definitions/error)
-
404 - Error if sandbox or instance was not found (api.losant.com/#/definitions/error)
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
# File 'lib/platform_rest/instance_sandbox.rb', line 309 def payload_counts_breakdown(params = {}) params = Utils.symbolize_hash_keys(params) query_params = { _actions: false, _links: true, _embedded: true } headers = {} body = nil raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId) raise ArgumentError.new("instanceSandboxId is required") unless params.has_key?(:instanceSandboxId) query_params[:start] = params[:start] if params.has_key?(:start) query_params[:end] = params[:end] if params.has_key?(:end) query_params[:resolution] = params[:resolution] if params.has_key?(:resolution) query_params[:asBytes] = params[:asBytes] if params.has_key?(:asBytes) query_params[:includeNonBillable] = params[:includeNonBillable] if params.has_key?(:includeNonBillable) headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain) query_params[:_actions] = params[:_actions] if params.has_key?(:_actions) query_params[:_links] = params[:_links] if params.has_key?(:_links) query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded) path = "/instances/#{params[:instanceId]}/sandboxes/#{params[:instanceSandboxId]}/payloadCountsBreakdown" @client.request( method: :get, path: path, query: query_params, headers: headers, body: body) end |
#undelete(params = {}) ⇒ Object
Restores a sandbox user account
Authentication: The client must be configured with a valid api access token to call this action. The token must include at least one of the following scopes: all.Instance, all.User, instanceSandbox.*, or instanceSandbox.undelete.
Parameters:
-
string instanceId - ID associated with the instance
-
string instanceSandboxId - ID associated with the sandbox user
-
string summaryExclude - Comma-separated list of summary fields to exclude from user summary
-
string summaryInclude - Comma-separated list of summary fields to include in user summary
-
string losantdomain - Domain scope of request (rarely needed)
-
boolean _actions - Return resource actions in response
-
boolean _links - Return resource link in response
-
boolean _embedded - Return embedded resources in response
Responses:
-
200 - A single restored sandbox user (api.losant.com/#/definitions/instanceSandbox)
Errors:
-
400 - Error if malformed request (api.losant.com/#/definitions/error)
-
404 - Error if sandbox or instance was not found (api.losant.com/#/definitions/error)
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 |
# File 'lib/platform_rest/instance_sandbox.rb', line 362 def undelete(params = {}) params = Utils.symbolize_hash_keys(params) query_params = { _actions: false, _links: true, _embedded: true } headers = {} body = nil raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId) raise ArgumentError.new("instanceSandboxId is required") unless params.has_key?(:instanceSandboxId) query_params[:summaryExclude] = params[:summaryExclude] if params.has_key?(:summaryExclude) query_params[:summaryInclude] = params[:summaryInclude] if params.has_key?(:summaryInclude) headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain) query_params[:_actions] = params[:_actions] if params.has_key?(:_actions) query_params[:_links] = params[:_links] if params.has_key?(:_links) query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded) path = "/instances/#{params[:instanceId]}/sandboxes/#{params[:instanceSandboxId]}/undelete" @client.request( method: :patch, path: path, query: query_params, headers: headers, body: body) end |