Some improvements to Ruby api

Change-Id: Ic0530ad4f174e57e9502976ff72a67ce5b5b0d46