class DeviceAPI::IOS::IPAddress

Namespace for all methods encapsulating idevice calls

Public Class Methods

address(serial) click to toggle source

Get the IP Address from the installed app @param [String] serial serial of the target device @return [String] IP Address if found

# File lib/device_api/ios/ipaddress.rb, line 30
def self.address(serial)
  return nil unless installed?(serial)
  result = IDeviceDebug.run(serial: serial, bundle_id: ipaddress_bundle_id )

  ip_address = nil
  result.each do |line|
    if /"en0\/ipv4" = "(.*)"/.match(line)
      ip_address = Regexp.last_match[1]
    end
  end
  ip_address
end
installed?(serial) click to toggle source

Check to see if the IPAddress app is installed @param [String] serial serial of the target device @return [Boolean] returns true if the app is installed

# File lib/device_api/ios/ipaddress.rb, line 19
def self.installed?(serial)
  if DeviceAPI::IOS::IDeviceInstaller.package_installed?( serial: serial, package: ipaddress_bundle_id )
    return true
  else
    warn IPAddressError.new('IP Address package not installed: Please see https://github.com/bbc/ios-test-helper')
  end
end
ipaddress_bundle_id() click to toggle source

Package name for the IP Address app

# File lib/device_api/ios/ipaddress.rb, line 12
def self.ipaddress_bundle_id
  'uk.co.bbc.titan.IPAddress'
end