Get IOS device name during script

I’m doing Appium test in Ruby and I need to get to the IOS device name during scripting (to put it in the screenshot name).
I’ve tried driver.GetCapabilities() but function is unknow.
To get android device name connected, I do “%x(adb shell getprop | grep ro.product.model)” but I don’t find something like that for IOS.

So if somebody can help me to get capabilities or directly emulator device name, it would be very appreciate !
Thanks a lot.

Hi Ericzered,

I am unable to starting iOS webkit debug proxy server and get iPhone information( UDID, Device Name and Device Version) from Terminal Using Java Code in mac machine. Is it possible to get the iOS device information from terminal using java code in mac machine. This is priority work for me. Please help me.

Thanks in advance.

I use a shell script to manage my appium processes. One of which steps is to dynamically grab the UDID if needed.
Assumes: Only 1 iOS device attached.

        #Get the iOS udid dynamically
        udid=`system_profiler SPUSBDataType | sed -n -e '/iPad/,/Serial/p' -e '/iPhone/,/Serial/p' | grep "Serial Number:" | awk -F ": " '{print $2}'`

You can use the Ruby system command to call out to any shell script or initiate any shell command of your choosing. I’m not a java expert, but I imagine there’s a similar way in Java.