Module: DeviceAPI::IOS

Defined in:
lib/device_api/ios/device.rb,
lib/device_api/ios.rb,
lib/device_api/ios/idevice.rb

Overview

iOS component of DeviceAPI

Defined Under Namespace

Classes: Device, IDevice, IDeviceCommandError

Class Method Summary collapse

Class Method Details

.device(serial) ⇒ Object

Retrieve a Device object by serial ID



18
19
20
21
22
23
# File 'lib/device_api/ios.rb', line 18

def self.device(serial)
  if serial.to_s.empty?
    raise DeviceAPI::BadSerialString.new("Serial was '#{ serial.nil? ? 'nil' : serial }'")
  end
  DeviceAPI::IOS::Device.new(serial: serial, state: 'ok')
end

.devicesObject

Returns an array of connected iOS devices



9
10
11
12
13
14
15
# File 'lib/device_api/ios.rb', line 9

def self.devices
  IDevice.devices.map do |d|
    if d.keys.first
      DeviceAPI::IOS::Device.new(serial: d.keys.first, display: d.values.flatten.first, state: 'ok')
    end
  end
end