How to know android version or device name?

Hello,
I’m doing autotesting with Appium and Ruby.
I’m looking for getting the android version or the device name I’m using.
It can be find in the capabilities but I don’t know how to reach capabilities in my code.
Thanks