For the record: At this time (year 2015) GDirections, GLatLng, GEvent, etc. are deprecated.
You can use google.maps.DirectionsService class (Google Maps JavaScript API V3)
In the following snippet, location and target are objects containing latitude and longitude coordinates.
1) The google.maps.DirectionsService class admit both LatLng and string values to feed their origin and destination properties.
2) A LatLng is a point in geographical coordinates: latitude and longitude.
var origin = new google.maps.LatLng( location.latitude, location.longitude ); // using google.maps.LatLng class
var destination = target.latitude + ', ' + target.longitude; // using string
var directionsService = new google.maps.DirectionsService();
var request = {
origin: origin, // LatLng|string
destination: destination, // LatLng|string
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route( request, function( response, status ) {
if ( status === 'OK' ) {
var point = response.routes[ 0 ].legs[ 0 ];
$( '#travel_data' ).html( 'Estimated travel time: ' + point.duration.text + ' (' + point.distance.text + ')' );
}
} );