Class: PlatformRest::Me

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

Overview

Class containing all the actions for the Me Resource

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Me

Returns a new instance of Me.



30
31
32
# File 'lib/platform_rest/me.rb', line 30

def initialize(client)
  @client = client
end

Instance Method Details

#add_recent_item(params = {}) ⇒ Object

Adds an item to a recent item list

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.User, me.*, or me.addRecentItem.

Parameters:

  • hash data - Object containing recent item info (api.losant.com/#/definitions/recentItem)

  • 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:

Errors:

Raises:

  • (ArgumentError)


54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/platform_rest/me.rb', line 54

def add_recent_item(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { _actions: false, _links: true, _embedded: true }
  headers = {}
  body = nil

  raise ArgumentError.new("data is required") unless params.has_key?(:data)

  body = params[:data] if params.has_key?(:data)
  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 = "/me/recentItems"

  @client.request(
    method: :post,
    path: path,
    query: query_params,
    headers: headers,
    body: body)
end

#change_password(params = {}) ⇒ Object

Changes the current user’s password and optionally logs out all other sessions

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.User, me.*, or me.changePassword.

Parameters:

  • hash data - Object containing the password change info (api.losant.com/#/definitions/changePassword)

  • 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:

Errors:

Raises:

  • (ArgumentError)


98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/platform_rest/me.rb', line 98

def change_password(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { _actions: false, _links: true, _embedded: true }
  headers = {}
  body = nil

  raise ArgumentError.new("data is required") unless params.has_key?(:data)

  body = params[:data] if params.has_key?(:data)
  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 = "/me/changePassword"

  @client.request(
    method: :patch,
    path: path,
    query: query_params,
    headers: headers,
    body: body)
end

#delete(params = {}) ⇒ Object

Deletes the current 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.User, me.*, or me.delete.

Parameters:

  • hash credentials - User authentication credentials (api.losant.com/#/definitions/userCredentials)

  • 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:

Errors:

Raises:

  • (ArgumentError)


142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/platform_rest/me.rb', line 142

def delete(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { _actions: false, _links: true, _embedded: true }
  headers = {}
  body = nil

  raise ArgumentError.new("credentials is required") unless params.has_key?(:credentials)

  body = params[:credentials] if params.has_key?(:credentials)
  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 = "/me/delete"

  @client.request(
    method: :post,
    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 current 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.User, all.User.read, me.*, or me.deviceCounts.

Parameters:

  • 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:

Errors:



187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/platform_rest/me.rb', line 187

def device_counts(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { _actions: false, _links: true, _embedded: true }
  headers = {}
  body = nil


  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 = "/me/deviceCounts"

  @client.request(
    method: :get,
    path: path,
    query: query_params,
    headers: headers,
    body: body)
end

#disable_two_factor_auth(params = {}) ⇒ Object

Disables multi-factor authentication for the current 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.User, me.*, or me.disableTwoFactorAuth.

Parameters:

  • hash data - Object containing multi-factor authentication properties (api.losant.com/#/definitions/multiFactorAuthDisable)

  • string includeRecent - Should the user include recent app/dashboard info

  • 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:

Errors:

Raises:

  • (ArgumentError)


234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/platform_rest/me.rb', line 234

def disable_two_factor_auth(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { _actions: false, _links: true, _embedded: true }
  headers = {}
  body = nil

  raise ArgumentError.new("data is required") unless params.has_key?(:data)

  body = params[:data] if params.has_key?(:data)
  query_params[:includeRecent] = params[:includeRecent] if params.has_key?(:includeRecent)
  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 = "/me/disableTwoFactorAuth"

  @client.request(
    method: :patch,
    path: path,
    query: query_params,
    headers: headers,
    body: body)
end

#disconnect_github(params = {}) ⇒ Object

Disconnects the user from Github

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.User, me.*, or me.disconnectGithub.

Parameters:

  • string includeRecent - Should the user include recent app/dashboard info

  • 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:

Errors:



283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/platform_rest/me.rb', line 283

def disconnect_github(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { _actions: false, _links: true, _embedded: true }
  headers = {}
  body = nil


  query_params[:includeRecent] = params[:includeRecent] if params.has_key?(:includeRecent)
  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 = "/me/disconnectGithub"

  @client.request(
    method: :patch,
    path: path,
    query: query_params,
    headers: headers,
    body: body)
end

#enable_two_factor_auth(params = {}) ⇒ Object

Enables multi-factor authentication for the current 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.User, me.*, or me.enableTwoFactorAuth.

Parameters:

  • hash data - Object containing multi-factor authentication properties (api.losant.com/#/definitions/multiFactorAuthEnable)

  • string includeRecent - Should the user include recent app/dashboard info

  • 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:

Errors:

Raises:

  • (ArgumentError)


331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
# File 'lib/platform_rest/me.rb', line 331

def enable_two_factor_auth(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { _actions: false, _links: true, _embedded: true }
  headers = {}
  body = nil

  raise ArgumentError.new("data is required") unless params.has_key?(:data)

  body = params[:data] if params.has_key?(:data)
  query_params[:includeRecent] = params[:includeRecent] if params.has_key?(:includeRecent)
  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 = "/me/enableTwoFactorAuth"

  @client.request(
    method: :patch,
    path: path,
    query: query_params,
    headers: headers,
    body: body)
end

#fetch_recent_items(params = {}) ⇒ Object

Gets a recent item list

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.User, all.User.read, me.*, or me.fetchRecentItems.

Parameters:

  • string parentId - Parent id of the recent list

  • undefined itemType - Item type to get the recent list of. Accepted values are: application, device, flow, dashboard, organization

  • 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:

Errors:

Raises:

  • (ArgumentError)


379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/platform_rest/me.rb', line 379

def fetch_recent_items(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { _actions: false, _links: true, _embedded: true }
  headers = {}
  body = nil

  raise ArgumentError.new("itemType is required") unless params.has_key?(:itemType)

  query_params[:parentId] = params[:parentId] if params.has_key?(:parentId)
  query_params[:itemType] = params[:itemType] if params.has_key?(:itemType)
  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 = "/me/recentItems"

  @client.request(
    method: :get,
    path: path,
    query: query_params,
    headers: headers,
    body: body)
end

#generate_two_factor_auth(params = {}) ⇒ Object

Returns the multi-factor authentication key for the current 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.User, me.*, or me.generateTwoFactorAuth.

Parameters:

  • 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:

Errors:



423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
# File 'lib/platform_rest/me.rb', line 423

def generate_two_factor_auth(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { _actions: false, _links: true, _embedded: true }
  headers = {}
  body = nil


  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 = "/me/generateTwoFactorAuth"

  @client.request(
    method: :patch,
    path: path,
    query: query_params,
    headers: headers,
    body: body)
end

#get(params = {}) ⇒ Object

Retrieves information on the current 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.User, all.User.read, me.*, or me.get.

Parameters:

  • string includeRecent - Should the user include recent app/dashboard info

  • 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:

Errors:



466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
# File 'lib/platform_rest/me.rb', line 466

def get(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { _actions: false, _links: true, _embedded: true }
  headers = {}
  body = nil


  query_params[:includeRecent] = params[:includeRecent] if params.has_key?(:includeRecent)
  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 = "/me"

  @client.request(
    method: :get,
    path: path,
    query: query_params,
    headers: headers,
    body: body)
end

#invite(params = {}) ⇒ Object

Retrieves information for an invitation to an organization

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.User, all.User.read, me.*, or me.invite.

Parameters:

  • string inviteId - ID associated with the invitation

  • 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:

Errors:

Raises:

  • (ArgumentError)


512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
# File 'lib/platform_rest/me.rb', line 512

def invite(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { _actions: false, _links: true, _embedded: true }
  headers = {}
  body = nil

  raise ArgumentError.new("inviteId is required") unless params.has_key?(:inviteId)

  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 = "/me/invites/#{params[:inviteId]}"

  @client.request(
    method: :get,
    path: path,
    query: query_params,
    headers: headers,
    body: body)
end

#invites(params = {}) ⇒ Object

Retrieves pending organization invitations for a 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.User, all.User.read, me.*, or me.invites.

Parameters:

  • 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:

Errors:



554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
# File 'lib/platform_rest/me.rb', line 554

def invites(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { _actions: false, _links: true, _embedded: true }
  headers = {}
  body = nil


  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 = "/me/invites"

  @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 current 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.User, all.User.read, me.*, or me.notebookMinuteCounts.

Parameters:

  • 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:

Errors:



597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
# File 'lib/platform_rest/me.rb', line 597

def notebook_minute_counts(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { _actions: false, _links: true, _embedded: true }
  headers = {}
  body = nil


  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 = "/me/notebookMinuteCounts"

  @client.request(
    method: :get,
    path: path,
    query: query_params,
    headers: headers,
    body: body)
end

#patch(params = {}) ⇒ Object

Updates information about the current 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.User, me.*, or me.patch.

Parameters:

  • hash user - Object containing new user properties (api.losant.com/#/definitions/mePatch)

  • string includeRecent - Should the user include recent app/dashboard info

  • 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:

Errors:

Raises:

  • (ArgumentError)


644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
# File 'lib/platform_rest/me.rb', line 644

def patch(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { _actions: false, _links: true, _embedded: true }
  headers = {}
  body = nil

  raise ArgumentError.new("user is required") unless params.has_key?(:user)

  body = params[:user] if params.has_key?(:user)
  query_params[:includeRecent] = params[:includeRecent] if params.has_key?(:includeRecent)
  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 = "/me"

  @client.request(
    method: :patch,
    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 current 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.User, all.User.read, me.*, or me.payloadCounts.

Parameters:

  • 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:

Errors:



693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
# File 'lib/platform_rest/me.rb', line 693

def payload_counts(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { _actions: false, _links: true, _embedded: true }
  headers = {}
  body = nil


  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 = "/me/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 current 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.User, all.User.read, me.*, or me.payloadCountsBreakdown.

Parameters:

  • 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:

Errors:



742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
# File 'lib/platform_rest/me.rb', line 742

def payload_counts_breakdown(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { _actions: false, _links: true, _embedded: true }
  headers = {}
  body = nil


  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 = "/me/payloadCountsBreakdown"

  @client.request(
    method: :get,
    path: path,
    query: query_params,
    headers: headers,
    body: body)
end

#refresh_token(params = {}) ⇒ Object

Returns a new auth token based on the current auth token

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.User, or me.*.

Parameters:

  • 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:

Errors:



789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
# File 'lib/platform_rest/me.rb', line 789

def refresh_token(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { _actions: false, _links: true, _embedded: true }
  headers = {}
  body = nil


  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 = "/me/refreshToken"

  @client.request(
    method: :get,
    path: path,
    query: query_params,
    headers: headers,
    body: body)
end

#respond_to_invite(params = {}) ⇒ Object

Accepts or rejects an invitation to an organization

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.User, me.*, or me.respondToInvite.

Parameters:

  • string inviteId - ID associated with the invitation

  • hash response - Response to invitation (api.losant.com/#/definitions/orgInviteActionUser)

  • 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:

Errors:

Raises:

  • (ArgumentError)


834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
# File 'lib/platform_rest/me.rb', line 834

def respond_to_invite(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { _actions: false, _links: true, _embedded: true }
  headers = {}
  body = nil

  raise ArgumentError.new("inviteId is required") unless params.has_key?(:inviteId)
  raise ArgumentError.new("response is required") unless params.has_key?(:response)

  body = params[:response] if params.has_key?(:response)
  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 = "/me/invites/#{params[:inviteId]}"

  @client.request(
    method: :post,
    path: path,
    query: query_params,
    headers: headers,
    body: body)
end

#transfer_resources(params = {}) ⇒ Object

Moves resources to a new owner

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.User, me.*, or me.transferResources.

Parameters:

  • hash transfer - Object containing properties of the transfer (api.losant.com/#/definitions/resourceTransfer)

  • 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:

Errors:

Raises:

  • (ArgumentError)


879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
# File 'lib/platform_rest/me.rb', line 879

def transfer_resources(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { _actions: false, _links: true, _embedded: true }
  headers = {}
  body = nil

  raise ArgumentError.new("transfer is required") unless params.has_key?(:transfer)

  body = params[:transfer] if params.has_key?(:transfer)
  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 = "/me/transferResources"

  @client.request(
    method: :patch,
    path: path,
    query: query_params,
    headers: headers,
    body: body)
end

#verify_email(params = {}) ⇒ Object

Sends an email verification to the 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.User, me.*, or me.verifyEmail.

Parameters:

  • 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:

Errors:



922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
# File 'lib/platform_rest/me.rb', line 922

def verify_email(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { _actions: false, _links: true, _embedded: true }
  headers = {}
  body = nil


  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 = "/me/verify-email"

  @client.request(
    method: :post,
    path: path,
    query: query_params,
    headers: headers,
    body: body)
end