Class: RubyWsOne::Device

Inherits:
Request show all
Defined in:
lib/ruby_ws_one.rb

Instance Attribute Summary

Attributes inherited from Request

#aw_tenant_code, #client_id, #client_secret, #domain, #system

Instance Method Summary collapse

Methods inherited from Request

#http_method, #token, #transform

Constructor Details

#initialize(json = {}) ⇒ Device

Returns a new instance of Device.



129
130
131
132
# File 'lib/ruby_ws_one.rb', line 129

def initialize(json = {})
  super(json)
  @system ||= :mdm
end

Instance Method Details

#activateObject



156
# File 'lib/ruby_ws_one.rb', line 156

def activate; end

#call(args = {}) ⇒ Object



134
135
136
# File 'lib/ruby_ws_one.rb', line 134

def call(args = {})
  transform(http_method(args.merge!(element: :devices)), args)
end

#commands(args = {}) ⇒ Object

[Lock, EnterpriseWipe, DeviceWipe, DeviceQuery, ClearPasscode, SyncDevice, StopAirPlay].



167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/ruby_ws_one.rb', line 167

def commands(args = {})
  transform(
    http_method(
      args.merge!(
        method: :post,
        action: __method__,
        id: args.fetch(:version, 2) == 2 ? uuid : id&.value,
        element: :devices
      )
    ),
    args
  )
end

#lockObject



142
143
144
# File 'lib/ruby_ws_one.rb', line 142

def lock
  commands(command: :lock)
end

#lostmodeObject



146
147
148
# File 'lib/ruby_ws_one.rb', line 146

def lostmode
  commands(command: :clearpasscode)
end

#phone?Boolean

Returns:

  • (Boolean)


162
163
164
# File 'lib/ruby_ws_one.rb', line 162

def phone?
  %w[Android Apple WindowsMobile WindowsPhone8 BlackBerry10 WindowsPhone Symbian].include?(platform)
end

#rebootObject



150
# File 'lib/ruby_ws_one.rb', line 150

def reboot; end

#retireObject



158
159
160
# File 'lib/ruby_ws_one.rb', line 158

def retire
  transform(http_method(args.merge!(method: :delete, id: id&.value, element: :devices)), {})
end

#search(args = {}) ⇒ Object



138
139
140
# File 'lib/ruby_ws_one.rb', line 138

def search(args = {})
  transform(http_method(args.merge!(action: __method__, element: :devices)), args)
end

#wipeObject



152
153
154
# File 'lib/ruby_ws_one.rb', line 152

def wipe
  commands(command: :devicewipe)
end