Module: AppleDEPClient::Profile

Defined in:
lib/apple_dep_client/profile.rb

Constant Summary collapse

DEFINE_PATH =
"/profile"
ASSIGN_PATH =
"/profile/devices"
FETCH_PATH =
"/profile"
REMOVE_PATH =
"/profile/devices"
PROFILE_KEYS =
[:profile_name, :url, :allow_pairing, :is_supervised,
:is_mandatory, :await_device_configured, :is_mdm_removable, :support_phone_number,
:support_email_address, :org_magic, :anchor_certs, :supervising_host_certs,
:skip_setup_items, :department, :devices]

Class Method Summary collapse

Class Method Details

.assign(profile_uuid, devices) ⇒ Object



23
24
25
26
27
# File 'lib/apple_dep_client/profile.rb', line 23

def self.assign(profile_uuid, devices)
  body = { "profile_uuid" => profile_uuid, "devices" => devices }
  body = JSON.dump body
  AppleDEPClient::Request.make_request(AppleDEPClient::Request.make_url(ASSIGN_PATH), :put, body)
end

.define(profile_data) ⇒ Object



17
18
19
20
21
# File 'lib/apple_dep_client/profile.rb', line 17

def self.define(profile_data)
  profile_data.select! { |key, _value| PROFILE_KEYS.include? key.to_sym }
  profile_data = JSON.dump profile_data
  AppleDEPClient::Request.make_request(AppleDEPClient::Request.make_url(DEFINE_PATH), :post, profile_data)
end

.fetch(profile_uuid) ⇒ Object



29
30
31
32
# File 'lib/apple_dep_client/profile.rb', line 29

def self.fetch(profile_uuid)
  params = { "profile_uuid" => profile_uuid }
  AppleDEPClient::Request.make_request(AppleDEPClient::Request.make_url(FETCH_PATH), :get, nil, params: params)
end

.remove(devices) ⇒ Object



34
35
36
37
38
# File 'lib/apple_dep_client/profile.rb', line 34

def self.remove(devices)
  body = { "devices" => devices }
  body = JSON.dump body
  AppleDEPClient::Request.make_request(AppleDEPClient::Request.make_url(REMOVE_PATH), :delete, body)
end