class Applocate::API
Public Class Methods
expected params, udid = “ABCD-DCCDDC-12394812389-CDC”
# File lib/applocate/api.rb, line 24 def self.active_commands(udid) response = self.get("/api/devices/#{udid}/active_commands", { headers: authentication }) JSON.parse response.body rescue [] end
expected options { udid: “ABCD-DCCDDC-12394812389-CDC” }
# File lib/applocate/api.rb, line 92 def self.app_list(options = {}) response = self.post('/deploy/app_list', { body: options.to_json, headers: authentication }) JSON.parse response.body rescue [] end
expected params: udid = “ABCD-DCCDDC-12394812389-CDC”, name = “me.example.restrictions” options { … Apple MDM Restrictions Profile … }
# File lib/applocate/api.rb, line 48 def self.apply_named_restrictions(udid, name, options = {}) options = options.merge({ profile_name: name }) response = self.post("/api/devices/#{udid}/profiles", { body: options.to_json, headers: authentication }) JSON.parse response.body rescue {} end
# File lib/applocate/api.rb, line 128 def self.authentication { "X-Applocate-Secret" => secret, "X-Applocate-Token" => token, 'Content-Type' => "application/json" } end
expected params, udid = “ABCD-DCCDDC-12394812389-CDC”, commmand_uuid = “xxxx-xxx-xxxx-xxxxxxxxxxx”
# File lib/applocate/api.rb, line 30 def self.cancel_commmand(udid, commmand_uuid) response = self.get("/api/devices/#{udid}/commands/#{commmand_uuid}", { headers: authentication }) JSON.parse response.body rescue {} end
expected options { device_id: 12345 }
OR { udid: "ABCD-DCCDDC-12394812389-CDC" }
# File lib/applocate/api.rb, line 123 def self.delete_device(options) response = self.delete("/api/devices", { body: options.to_json, headers: authentication }) response.code == 200 end
expected options udid_or_identifier = 12345 OR udid_or_identifier = “ABCD-DCCDDC-12394812389-CDC” NOTE: this may return more than one device.
# File lib/applocate/api.rb, line 116 def self.get_devices(udid_or_identifier) response = self.get("/api/devices/#{udid_or_identifier}", { headers: authentication }) JSON.parse response.body rescue [] end
expected options { udid: “ABCD-DCCDDC-12394812389-CDC”, itunes_id: “284910350” }
# File lib/applocate/api.rb, line 86 def self.install_app(options = {}) response = self.post('/deploy/app', { body: options.to_json, headers: authentication }) JSON.parse response.body rescue [] end
expected options { udid: “ABCD-DCCDDC-12394812389-CDC”, vpn_username: “123456”, vpn_password: “p@ssw0rd” }
# File lib/applocate/api.rb, line 74 def self.install_vpn(options = {}) response = self.post('/deploy/vpn', { body: options.to_json, headers: authentication }) JSON.parse response.body rescue [] end
# File lib/applocate/api.rb, line 109 def self.list_devices response = self.get('/api/devices', { headers: authentication }) JSON.parse response.body rescue [] end
expected options { udid: “ABCD-DCCDDC-12394812389-CDC” }
# File lib/applocate/api.rb, line 98 def self.mdm_app_list(options = {}) response = self.post('/deploy/mdm_app_list', { body: options.to_json, headers: authentication }) JSON.parse response.body rescue [] end
expected params, udid = “ABCD-DCCDDC-12394812389-CDC”
# File lib/applocate/api.rb, line 42 def self.profile_list(udid) response = self.get("/api/devices/#{udid}/profiles", { headers: authentication }) JSON.parse response.body rescue [] end
expected params, udid = “ABCD-DCCDDC-12394812389-CDC”
# File lib/applocate/api.rb, line 12 def self.recent_checkins(udid) response = self.get("/api/devices/#{udid}/recent_checkins", { headers: authentication }) JSON.parse response.body rescue [] end
expected params, udid = “ABCD-DCCDDC-12394812389-CDC”
# File lib/applocate/api.rb, line 18 def self.recent_commands(udid) response = self.get("/api/devices/#{udid}/recent_commands", { headers: authentication }) JSON.parse response.body rescue [] end
expected options { name: “Steve J's iPad Air”, identifier: “XXX-123456 APPLE INC.”, configuration: “default” }
# File lib/applocate/api.rb, line 104 def self.register_device(options = {}) response = self.post('/api/devices', { body: options.to_json, headers: authentication }) JSON.parse response.body rescue [] end
expected params, udid = “ABCD-DCCDDC-12394812389-CDC”, name = “me.example.restrictions”
# File lib/applocate/api.rb, line 55 def self.remove_named_restrictions(udid, name) query = { profile_name: name } response = self.delete("/api/devices/#{udid}/profiles", { query: query, headers: authentication }) JSON.parse response.body rescue {} end
expected options { udid: “ABCD-DCCDDC-12394812389-CDC” }
# File lib/applocate/api.rb, line 80 def self.remove_vpn(options = {}) response = self.delete('/deploy/vpn', { body: options.to_json, headers: authentication }) JSON.parse response.body rescue [] end
expected options { udid: “ABCD-DCCDDC-12394812389-CDC” }
# File lib/applocate/api.rb, line 62 def self.restrict(options = {}) response = self.post('/deploy/profile', { body: options.to_json, headers: authentication }) JSON.parse response.body rescue [] end
expected params, udid = “ABCD-DCCDDC-12394812389-CDC”
# File lib/applocate/api.rb, line 36 def self.restrictions(udid) response = self.get("/api/devices/#{udid}/restrictions", { headers: authentication }) JSON.parse response.body rescue [] end
# File lib/applocate/api.rb, line 136 def self.secret Applocate.configuration.secret end
# File lib/applocate/api.rb, line 132 def self.token Applocate.configuration.token end
expected options { udid: “ABCD-DCCDDC-12394812389-CDC” }
# File lib/applocate/api.rb, line 68 def self.unrestrict(options = {}) response = self.delete('/deploy/profile', { body: options.to_json, headers: authentication }) JSON.parse response.body rescue [] end