\Google

Summary

Methods
Properties
Constants
__construct()
oauth()
oauth_callback()
sync()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

__construct()

__construct() 

oauth()

oauth(integer  $provider_id) 

Authorize Google Calendar API usage for a specific provider.

Since it is required to follow the web application flow, in order to retrieve a refresh token from the Google API service, this method is going to authorize the given provider.

Parameters

integer $provider_id

The provider id, for whom the sync authorization is made.

oauth_callback()

oauth_callback() 

Callback method for the Google Calendar API authorization process.

Once the user grants consent with his Google Calendar data usage, the Google OAuth service will redirect him back in this page. Here we are going to store the refresh token, because this is what will be used to generate access tokens in the future.

IMPORTANT! Because it is necessary to authorize the application using the web server flow (see official documentation of OAuth), every Easy!Appointments installation should use its own calendar api key. So in every api console account, the "http://path-to-e!a/google/oauth_callback" should be included in an allowed redirect url.

sync()

sync(\numeric  $provider_id = NULL) 

Complete synchronization of appointments between Google Calendar and Easy!Appointments.

This method will completely sync the appointments of a provider with his Google Calendar account. The sync period needs to be relatively small, because a lot of API calls might be necessary and this will lead to consuming the Google limit for the Calendar API usage.

Parameters

\numeric $provider_id

Provider record to be synced.