Class: ArtikCloud::DevicesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/artikcloud/api/devices_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ DevicesApi

Returns a new instance of DevicesApi.



18
19
20
# File 'lib/artikcloud/api/devices_api.rb', line 18

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



16
17
18
# File 'lib/artikcloud/api/devices_api.rb', line 16

def api_client
  @api_client
end

Instance Method Details

#add_device(device, opts = {}) ⇒ DeviceEnvelope

Add Device Create a device

Parameters:

  • device

    Device to be added to the user

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

    the optional parameters

Returns:



27
28
29
30
# File 'lib/artikcloud/api/devices_api.rb', line 27

def add_device(device, opts = {})
  data, _status_code, _headers = add_device_with_http_info(device, opts)
  return data
end

#add_device_with_http_info(device, opts = {}) ⇒ Array<(DeviceEnvelope, Fixnum, Hash)>

Add Device Create a device

Parameters:

  • device

    Device to be added to the user

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

    the optional parameters

Returns:

  • (Array<(DeviceEnvelope, Fixnum, Hash)>)

    DeviceEnvelope data, response status code and response headers



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/artikcloud/api/devices_api.rb', line 37

def add_device_with_http_info(device, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: DevicesApi.add_device ..."
  end
  # verify the required parameter 'device' is set
  fail ArgumentError, "Missing the required parameter 'device' when calling DevicesApi.add_device" if device.nil?
  # resource path
  local_var_path = "/devices".sub('{format}','json')

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(device)
  auth_names = ['artikcloud_oauth']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'DeviceEnvelope')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DevicesApi#add_device\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_device(device_id, opts = {}) ⇒ DeviceEnvelope

Delete Device Deletes a device

Parameters:

  • device_id

    deviceId

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

    the optional parameters

Returns:



80
81
82
83
# File 'lib/artikcloud/api/devices_api.rb', line 80

def delete_device(device_id, opts = {})
  data, _status_code, _headers = delete_device_with_http_info(device_id, opts)
  return data
end

#delete_device_token(device_id, opts = {}) ⇒ DeviceTokenEnvelope

Delete Device Token Deletes a device’s token

Parameters:

  • device_id

    deviceId

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

    the optional parameters

Returns:



131
132
133
134
# File 'lib/artikcloud/api/devices_api.rb', line 131

def delete_device_token(device_id, opts = {})
  data, _status_code, _headers = delete_device_token_with_http_info(device_id, opts)
  return data
end

#delete_device_token_with_http_info(device_id, opts = {}) ⇒ Array<(DeviceTokenEnvelope, Fixnum, Hash)>

Delete Device Token Deletes a device&#39;s token

Parameters:

  • device_id

    deviceId

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

    the optional parameters

Returns:

  • (Array<(DeviceTokenEnvelope, Fixnum, Hash)>)

    DeviceTokenEnvelope data, response status code and response headers



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/artikcloud/api/devices_api.rb', line 141

def delete_device_token_with_http_info(device_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: DevicesApi.delete_device_token ..."
  end
  # verify the required parameter 'device_id' is set
  fail ArgumentError, "Missing the required parameter 'device_id' when calling DevicesApi.delete_device_token" if device_id.nil?
  # resource path
  local_var_path = "/devices/{deviceId}/tokens".sub('{format}','json').sub('{' + 'deviceId' + '}', device_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['artikcloud_oauth']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'DeviceTokenEnvelope')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DevicesApi#delete_device_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_device_with_http_info(device_id, opts = {}) ⇒ Array<(DeviceEnvelope, Fixnum, Hash)>

Delete Device Deletes a device

Parameters:

  • device_id

    deviceId

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

    the optional parameters

Returns:

  • (Array<(DeviceEnvelope, Fixnum, Hash)>)

    DeviceEnvelope data, response status code and response headers



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/artikcloud/api/devices_api.rb', line 90

def delete_device_with_http_info(device_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: DevicesApi.delete_device ..."
  end
  # verify the required parameter 'device_id' is set
  fail ArgumentError, "Missing the required parameter 'device_id' when calling DevicesApi.delete_device" if device_id.nil?
  # resource path
  local_var_path = "/devices/{deviceId}".sub('{format}','json').sub('{' + 'deviceId' + '}', device_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['artikcloud_oauth']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'DeviceEnvelope')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DevicesApi#delete_device\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_device(device_id, opts = {}) ⇒ DeviceEnvelope

Get Device Retrieves a device

Parameters:

  • device_id

    deviceId

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

    the optional parameters

Returns:



182
183
184
185
# File 'lib/artikcloud/api/devices_api.rb', line 182

def get_device(device_id, opts = {})
  data, _status_code, _headers = get_device_with_http_info(device_id, opts)
  return data
end

#get_device_presence(device_id, opts = {}) ⇒ PresenceEnvelope

Get device presence information Return the presence status of the given device along with the time it was last seen

Parameters:

  • device_id

    Device ID.

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

    the optional parameters

Returns:



233
234
235
236
# File 'lib/artikcloud/api/devices_api.rb', line 233

def get_device_presence(device_id, opts = {})
  data, _status_code, _headers = get_device_presence_with_http_info(device_id, opts)
  return data
end

#get_device_presence_with_http_info(device_id, opts = {}) ⇒ Array<(PresenceEnvelope, Fixnum, Hash)>

Get device presence information Return the presence status of the given device along with the time it was last seen

Parameters:

  • device_id

    Device ID.

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

    the optional parameters

Returns:

  • (Array<(PresenceEnvelope, Fixnum, Hash)>)

    PresenceEnvelope data, response status code and response headers



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/artikcloud/api/devices_api.rb', line 243

def get_device_presence_with_http_info(device_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: DevicesApi.get_device_presence ..."
  end
  # verify the required parameter 'device_id' is set
  fail ArgumentError, "Missing the required parameter 'device_id' when calling DevicesApi.get_device_presence" if device_id.nil?
  # resource path
  local_var_path = "/devices/{deviceId}/presence".sub('{format}','json').sub('{' + 'deviceId' + '}', device_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['artikcloud_oauth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'PresenceEnvelope')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DevicesApi#get_device_presence\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_device_token(device_id, opts = {}) ⇒ DeviceTokenEnvelope

Get Device Token Retrieves a device’s token

Parameters:

  • device_id

    deviceId

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

    the optional parameters

Returns:



284
285
286
287
# File 'lib/artikcloud/api/devices_api.rb', line 284

def get_device_token(device_id, opts = {})
  data, _status_code, _headers = get_device_token_with_http_info(device_id, opts)
  return data
end

#get_device_token_with_http_info(device_id, opts = {}) ⇒ Array<(DeviceTokenEnvelope, Fixnum, Hash)>

Get Device Token Retrieves a device&#39;s token

Parameters:

  • device_id

    deviceId

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

    the optional parameters

Returns:

  • (Array<(DeviceTokenEnvelope, Fixnum, Hash)>)

    DeviceTokenEnvelope data, response status code and response headers



294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/artikcloud/api/devices_api.rb', line 294

def get_device_token_with_http_info(device_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: DevicesApi.get_device_token ..."
  end
  # verify the required parameter 'device_id' is set
  fail ArgumentError, "Missing the required parameter 'device_id' when calling DevicesApi.get_device_token" if device_id.nil?
  # resource path
  local_var_path = "/devices/{deviceId}/tokens".sub('{format}','json').sub('{' + 'deviceId' + '}', device_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['artikcloud_oauth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'DeviceTokenEnvelope')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DevicesApi#get_device_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_device_with_http_info(device_id, opts = {}) ⇒ Array<(DeviceEnvelope, Fixnum, Hash)>

Get Device Retrieves a device

Parameters:

  • device_id

    deviceId

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

    the optional parameters

Returns:

  • (Array<(DeviceEnvelope, Fixnum, Hash)>)

    DeviceEnvelope data, response status code and response headers



192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/artikcloud/api/devices_api.rb', line 192

def get_device_with_http_info(device_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: DevicesApi.get_device ..."
  end
  # verify the required parameter 'device_id' is set
  fail ArgumentError, "Missing the required parameter 'device_id' when calling DevicesApi.get_device" if device_id.nil?
  # resource path
  local_var_path = "/devices/{deviceId}".sub('{format}','json').sub('{' + 'deviceId' + '}', device_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['artikcloud_oauth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'DeviceEnvelope')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DevicesApi#get_device\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_device(device_id, device, opts = {}) ⇒ DeviceEnvelope

Update Device Updates a device

Parameters:

  • device_id

    deviceId

  • device

    Device to be updated

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

    the optional parameters

Returns:



336
337
338
339
# File 'lib/artikcloud/api/devices_api.rb', line 336

def update_device(device_id, device, opts = {})
  data, _status_code, _headers = update_device_with_http_info(device_id, device, opts)
  return data
end

#update_device_token(device_id, opts = {}) ⇒ DeviceTokenEnvelope

Update Device Token Updates a device’s token

Parameters:

  • device_id

    deviceId

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

    the optional parameters

Returns:



392
393
394
395
# File 'lib/artikcloud/api/devices_api.rb', line 392

def update_device_token(device_id, opts = {})
  data, _status_code, _headers = update_device_token_with_http_info(device_id, opts)
  return data
end

#update_device_token_with_http_info(device_id, opts = {}) ⇒ Array<(DeviceTokenEnvelope, Fixnum, Hash)>

Update Device Token Updates a device&#39;s token

Parameters:

  • device_id

    deviceId

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

    the optional parameters

Returns:

  • (Array<(DeviceTokenEnvelope, Fixnum, Hash)>)

    DeviceTokenEnvelope data, response status code and response headers



402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
# File 'lib/artikcloud/api/devices_api.rb', line 402

def update_device_token_with_http_info(device_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: DevicesApi.update_device_token ..."
  end
  # verify the required parameter 'device_id' is set
  fail ArgumentError, "Missing the required parameter 'device_id' when calling DevicesApi.update_device_token" if device_id.nil?
  # resource path
  local_var_path = "/devices/{deviceId}/tokens".sub('{format}','json').sub('{' + 'deviceId' + '}', device_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['text/plain'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['artikcloud_oauth']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'DeviceTokenEnvelope')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DevicesApi#update_device_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_device_with_http_info(device_id, device, opts = {}) ⇒ Array<(DeviceEnvelope, Fixnum, Hash)>

Update Device Updates a device

Parameters:

  • device_id

    deviceId

  • device

    Device to be updated

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

    the optional parameters

Returns:

  • (Array<(DeviceEnvelope, Fixnum, Hash)>)

    DeviceEnvelope data, response status code and response headers



347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
# File 'lib/artikcloud/api/devices_api.rb', line 347

def update_device_with_http_info(device_id, device, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: DevicesApi.update_device ..."
  end
  # verify the required parameter 'device_id' is set
  fail ArgumentError, "Missing the required parameter 'device_id' when calling DevicesApi.update_device" if device_id.nil?
  # verify the required parameter 'device' is set
  fail ArgumentError, "Missing the required parameter 'device' when calling DevicesApi.update_device" if device.nil?
  # resource path
  local_var_path = "/devices/{deviceId}".sub('{format}','json').sub('{' + 'deviceId' + '}', device_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(device)
  auth_names = ['artikcloud_oauth']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'DeviceEnvelope')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DevicesApi#update_device\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end