Class: DuoApi::Device
Overview
Constant Summary
Constants inherited
from DuoApi
BACKOFF_FACTOR, INITIAL_BACKOFF_WAIT_SECS, MAX_BACKOFF_WAIT_SECS, VERSION
Instance Attribute Summary collapse
Attributes inherited from DuoApi
#ca_file, #default_params
Instance Method Summary
collapse
Methods inherited from DuoApi
#delete, #get, #get_all, #get_image, #post, #put, #request
Constructor Details
#initialize(ikey, skey, host, proxy = nil, mkey:, ca_file: nil, default_params: {}) ⇒ Device
Returns a new instance of Device.
13
14
15
16
17
|
# File 'lib/duo_api/device.rb', line 13
def initialize(ikey, skey, host, proxy = nil, mkey:, ca_file: nil, default_params: {})
super(ikey, skey, host, proxy, ca_file: ca_file, default_params: default_params)
@mkey = mkey
end
|
Instance Attribute Details
#mkey ⇒ Object
Returns the value of attribute mkey.
11
12
13
|
# File 'lib/duo_api/device.rb', line 11
def mkey
@mkey
end
|
Instance Method Details
#activate_device_cache(cache_key:) ⇒ Object
45
46
47
|
# File 'lib/duo_api/device.rb', line 45
def activate_device_cache(cache_key:)
post("/device/v1/management_systems/#{@mkey}/device_cache/#{cache_key}/activate")[:response]
end
|
#add_device_cache_devices(cache_key:, devices:) ⇒ Object
27
28
29
30
|
# File 'lib/duo_api/device.rb', line 27
def add_device_cache_devices(cache_key:, devices:)
params = { devices: devices }
post("/device/v1/management_systems/#{@mkey}/device_cache/#{cache_key}/devices", params)[:response]
end
|
#create_device_cache(**optional_params) ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/duo_api/device.rb', line 19
def create_device_cache(**optional_params)
optional_params.tap do |p|
p[:active] = stringified_python_boolean(p[:active]) if p[:active]
end
post("/device/v1/management_systems/#{@mkey}/device_cache", optional_params)[:response]
end
|
#delete_device_cache(cache_key:) ⇒ Object
49
50
51
|
# File 'lib/duo_api/device.rb', line 49
def delete_device_cache(cache_key:)
delete("/device/v1/management_systems/#{@mkey}/device_cache/#{cache_key}")[:response]
end
|
#delete_device_cache_devices(cache_key:, devices:) ⇒ Object
40
41
42
43
|
# File 'lib/duo_api/device.rb', line 40
def delete_device_cache_devices(cache_key:, devices:)
params = { devices: devices }
delete("/device/v1/management_systems/#{@mkey}/device_cache/#{cache_key}/devices", params)[:response]
end
|
#get_device_cache(cache_key:) ⇒ Object
58
59
60
|
# File 'lib/duo_api/device.rb', line 58
def get_device_cache(cache_key:)
get("/device/v1/management_systems/#{@mkey}/device_cache/#{cache_key}")[:response]
end
|
#get_device_cache_devices(cache_key:, **optional_params) ⇒ Object
32
33
34
35
36
37
38
|
# File 'lib/duo_api/device.rb', line 32
def get_device_cache_devices(cache_key:, **optional_params)
data_array_path = %i[response devices_retrieved]
metadata_path = %i[response]
get_all("/device/v1/management_systems/#{@mkey}/device_cache/#{cache_key}/devices", optional_params,
data_array_path: data_array_path, metadata_path: metadata_path).dig(*data_array_path)
end
|
#get_device_caches(status:) ⇒ Object
53
54
55
56
|
# File 'lib/duo_api/device.rb', line 53
def get_device_caches(status:)
params = { status: status }
get("/device/v1/management_systems/#{@mkey}/device_cache", params)[:response]
end
|