$CI
$CI :
Google Synchronization Class
This class implements all the core synchronization between the Google Calendar and the Easy!Appointments system. Do not place any model handling inside this library.
authenticate( $auth_code)
Authenticate the Google API usage.
When the user grants consent for his data usage, google is going to redirect the browser back to the given redirect url. There a authentication code is provided. Using this code, we can authenticate the API usage and store the token information to the database.
$auth_code |
refresh_token(string $refresh_token)
Refresh the Google Client access token.
This method must be executed every time we need to make actions on a provider's Google Calendar account. A new token is necessary and the only way to get it is to use the stored refresh token that was provided when the provider granted consent to Easy!Appointments for use his Google Calendar account.
string | $refresh_token | The provider's refresh token. This value is stored in the database and used every time we need to make actions to his Google Caledar account. |
add_appointment(array $appointment, array $provider, array $service, array $customer, $company_settings) : \Google_Event
Add an appointment record to its providers Google Calendar account.
This method checks whether the appointment's provider has enabled the Google Sync utility of Easy!Appointments and the stored access token is still valid. If yes, the selected appointment record is going to be added to the Google Calendar account.
array | $appointment | Contains the appointment record data. |
array | $provider | Contains the provider record data. |
array | $service | Contains the service record data. |
array | $customer | Contains the customer recod data. |
$company_settings |
Returns the Google_Event class object.
update_appointment(array $appointment, array $provider, array $service, array $customer, $company_settings) : \Google_Event
Update an existing appointment that is already synced with Google Calendar.
This method updates the google calendar event item that is connected with the provided appointment record of Easy!Appointments.
array | $appointment | Contains the appointment record data. |
array | $provider | Contains the provider record data. |
array | $service | Contains the service record data. |
array | $customer | Contains the customer recod data. |
$company_settings |
Returns the Google_Event class object.
add_unavailable(array $provider, array $unavailable) : \Google_Event
Add unavailable period event to Google Calendar.
array | $provider | Contains the provider record data. |
array | $unavailable | Contains unavailable period's data. |
Returns the google event's object.
update_unavailable(array $provider, array $unavailable) : \Google_Event
Update Google Calendar unavailable period event.
array | $provider | Contains the provider record data. |
array | $unavailable | Contains the unavailable period data. |
Returns the Google_Event object.
get_sync_events(string $google_calendar, \date $start, \date $end) : object
Get all the events between the sync period.
string | $google_calendar | The name of the google calendar to be used. |
\date | $start | The start date of sync period. |
\date | $end | The end date of sync period. |
Returns an array with Google_Event objects that belong on the given sync period (start, end).