I'm not sure if GTFS-realtime data is in the Google Maps Directions API, but it is possible to get real-time data for public transit from the Google Maps API. To do this, you need to set up a Google Maps API key, and then enable the "Directions API" and "Distance Matrix API" for that key. Once you have done that, you can use the Google Maps API to get real-time data for public transit.