Class: DuoApi::Device
- Inherits:
-
DuoApi
- Object
- DuoApi
- DuoApi::Device
- Defined in:
- lib/duo_api/device.rb
Overview
Duo Device API (https://duo.com/docs/deviceapi)
Instance Attribute Summary collapse
-
#mkey ⇒ Object
Returns the value of attribute mkey.
Instance Method Summary collapse
- #activate_device_cache(cache_key:) ⇒ Object
- #add_device_cache_devices(cache_key:, devices:) ⇒ Object
- #create_device_cache(**optional_params) ⇒ Object
- #delete_device_cache(cache_key:) ⇒ Object
- #delete_device_cache_devices(cache_key:, devices:) ⇒ Object
- #get_device_cache(cache_key:) ⇒ Object
- #get_device_cache_devices(cache_key:, **optional_params) ⇒ Object
- #get_device_caches(status:) ⇒ Object
-
#initialize(ikey, skey, host, proxy = nil, mkey:, ca_file: nil, default_params: {}) ⇒ Device
constructor
A new instance of Device.
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: active 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) # optional_params: device_ids data_array_path = %i[response devices_retrieved] = %i[response] get_all("/device/v1/management_systems/#{@mkey}/device_cache/#{cache_key}/devices", optional_params, data_array_path: data_array_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 |