class Mdm::Enrollment::Profile

Public Instance Methods

method() click to toggle source
# File lib/mdm/enrollment/service/profile.rb, line 16
def method
  :get
end
path() click to toggle source
# File lib/mdm/enrollment/service/profile.rb, line 12
def path
  '/profile'
end
result() click to toggle source
# File lib/mdm/enrollment/service/profile.rb, line 20
def result
  {
    profile: @profile.to_json
  }
end
start() click to toggle source
Calls superclass method Mdm::Enrollment::Service::Base#start
# File lib/mdm/enrollment/service/profile.rb, line 7
def start
  super
  find_or_create_profile
end

Private Instance Methods

find_or_create_profile() click to toggle source
# File lib/mdm/enrollment/service/profile.rb, line 28
def find_or_create_profile
  @profile ||= begin
                 profile = Profile.find_or_create_by(
                   profile_uuid: client.response['profile_uuid']
                 )

                 profile.update!(
                   profile_uuid: client.response['profile_uuid'],
                   profile_name: client.response['profile_name'],
                   url: client.response['url'],
                   is_supervised: client.response['is_supervised'],
                   allow_pairing: client.response['allow_pairing'],
                   is_mandatory: client.response['is_mandatory'],
                   await_device_configured: client.response['await_device_configured'],
                   is_mdm_removable: client.response['is_mdm_removable'],
                   department: client.response['department'],
                   org_magic: client.response['org_magic'],
                   support_phone_number: client.response['support_phone_number'],
                   support_email_address: client.response['support_email_address'],
                   anchor_certs: client.response['anchor_certs'],
                   supervising_host_certs: client.response['supervising_host_certs'],
                   skip_setup_items: client.response['skip_setup_items'],
                   devices: client.response['devices']
                 )

                 profile
               end
end