Class: SimpleMDM::Device
- Defined in:
- lib/simplemdm/device.rb
Class Method Summary collapse
Instance Method Summary collapse
- #clear_passcode ⇒ Object
- #installed_apps ⇒ Object
- #lock(options = {}) ⇒ Object
- #push_apps ⇒ Object
- #wipe ⇒ Object
Methods inherited from Base
Class Method Details
.all ⇒ Object
4 5 6 7 8 |
# File 'lib/simplemdm/device.rb', line 4 def self.all hash, code = fetch("devices") hash['data'].collect { |d| build d } end |
.find(id) ⇒ Object
10 11 12 13 14 |
# File 'lib/simplemdm/device.rb', line 10 def self.find(id) hash, code = fetch("devices/#{id}") build hash['data'] end |
Instance Method Details
#clear_passcode ⇒ Object
32 33 34 35 36 |
# File 'lib/simplemdm/device.rb', line 32 def clear_passcode hash, code = fetch("devices/#{id}/clear_passcode", :post) code == 202 end |
#installed_apps ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/simplemdm/device.rb', line 16 def installed_apps raise "You cannot retrieve installed apps for a device that hasn't been created yet." if new? hash, code = fetch("devices/#{id}/installed_apps") hash['data'].collect { |a| InstalledApp.build a } end |
#lock(options = {}) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/simplemdm/device.rb', line 24 def lock( = {}) params = .delete_if { |k,v| ![:message, :phone_number, :pin].include?(k) } hash, code = fetch("devices/#{id}/lock", :post, params) code == 202 end |
#push_apps ⇒ Object
44 45 46 47 48 |
# File 'lib/simplemdm/device.rb', line 44 def push_apps hash, code = fetch("devices/#{id}/push_apps", :post) code == 202 end |
#wipe ⇒ Object
38 39 40 41 42 |
# File 'lib/simplemdm/device.rb', line 38 def wipe hash, code = fetch("devices/#{id}/wipe", :post) code == 202 end |