Class: Mdm::Enrollment::Devices

Inherits:
Service::Base show all
Defined in:
lib/mdm/enrollment/service/devices.rb

Direct Known Subclasses

Sync

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Service::Base

#authenticate?, available_services, #params, #params=

Instance Attribute Details

#limit=(value) ⇒ Object

Sets the attribute limit

Parameters:

  • value

    the value to set the attribute limit to.



7
8
9
# File 'lib/mdm/enrollment/service/devices.rb', line 7

def limit=(value)
  @limit = value
end

Class Method Details

.accepted_paramsObject



12
13
14
# File 'lib/mdm/enrollment/service/devices.rb', line 12

def self.accepted_params
  [:limit, :cursor]
end

Instance Method Details

#methodObject



38
39
40
# File 'lib/mdm/enrollment/service/devices.rb', line 38

def method
  :post
end

#pathObject



16
17
18
# File 'lib/mdm/enrollment/service/devices.rb', line 16

def path
  '/server/devices'
end

#resultObject



42
43
44
45
46
47
# File 'lib/mdm/enrollment/service/devices.rb', line 42

def result
  {
    devices: devices,
    cursor: cursor
  }
end

#startObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/mdm/enrollment/service/devices.rb', line 20

def start
  params[:limit] = limit
  params[:cursor] = cursor.content

  super

  cursor.content, device_payloads, more_to_follow = client.extract_from_response(
    'cursor',
    'devices',
    'more_to_follow')

  create_or_update_devices(device_payloads)

  if cursor.save && more_to_follow
    start
  end
end