Device APIDeviceAPI is a collection of ruby gems that make working with physical devices easy and consistent. DeviceAPI provides common utilities such as device detection and identification, and useful helpers for installing applications and identifying problems with devices.

License: MIT

Project Links:Website

DeviceAPI is a collection of ruby gems that make working with physical devices easy and consistent. DeviceAPI provides common utilities such as device detection and identification, and useful helpers for installing applications and identifying problems with devices.

We use DeviceAPI heavily to leverage devices in Hive CI. It's also used by our test developers in their test code. It's our interface to the devices we test against and is where we put all common code for interacting with our physical devices. It also provides an abstraction so we can deal with devices interchangeably.

DeviceAPI-AndroidCopy heading link to clipboard

DeviceAPI-Android is the DeviceAPI implementation for Android devices. It uses the Android SDK, external command line tools for interacting with connected devices:

Code Snippet (ruby)
device = DeviceAPI::Android.devices.first
device.model #=> 'samsung gt-i9100'
device.orientation #=> :portrait
device.install('path/to/build.apk') #=> true

In addition to detecting and identifying physical devices, DeviceAPI-Android handles functions like:

  • managing keystores and signing apps

  • installing and deleting applications

  • managing orientation and settings

  • capturing screenshots

  • performing cleanup operations

  • executing monkey testing

DeviceAPI-IOSCopy heading link to clipboard

DeviceAPI-IOS is the iOS implementation of DeviceAPI. It uses libimobiledevice, external for interacting with connected devices.

This gem offers most of the same features as the Android version. The API is identical where possible:

Code Snippet (ruby)
device = DeviceAPI::IOS.devices.first
device.model #=> 'iPad mini 3'