-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from bbc/device_name
Return a devices' assigned name
- Loading branch information
Showing
4 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# DeviceAPI - an interface to allow for automation of devices | ||
module DeviceAPI | ||
# iOS component of DeviceAPI | ||
module IOS | ||
# Namespace for all methods encapsulating idevicename calls | ||
class IDeviceName < Execution | ||
|
||
# Returns the device name based on the provided UUID | ||
# @param device_id uuid of the device | ||
# @return device name if device is connected | ||
def self.name(device_id) | ||
result = execute("idevicename -u #{device_id}") | ||
return IDeviceNameError.new(result.stderr) if result.exit != 0 | ||
result.stdout.strip | ||
end | ||
end | ||
|
||
# Error class for the IDeviceName class | ||
class IDeviceNameError < StandardError | ||
def initialize(msg) | ||
super(msg) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters