Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions GoogleClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct()
// Checking current access token is expired
if($this->client->isAccessTokenExpired()){
// Refresh access token and add it into session
$client->refreshToken($_SESSION['GOOGLE_REFRESH_TOKEN']);
$this->client->refreshToken($_SESSION['GOOGLE_REFRESH_TOKEN']);
$access_token = $this->client->getAccessToken();
$_SESSION['GOOGLE_ACCESS_TOKEN'] = $access_token;
}
Expand All @@ -56,7 +56,7 @@ public function authenticate($code)
{
$this->client->authenticate($code);
$_SESSION['GOOGLE_ACCESS_TOKEN'] = $this->client->getAccessToken();
$_SESSION['GOOGLE_REFRESH_TOKEN'] = $this->client->getRefreshToken();
$_SESSION['GOOGLE_REFRESH_TOKEN'] = $this->client->refreshToken($code);
}

/**
Expand Down Expand Up @@ -91,7 +91,7 @@ public function getClient()
*/
public function initDriveService()
{
$this->service = new \Google_Service_Drive($this->client);
$this->service = new \Soramugi\GoogleDrive\Service($this->client);
}

/**
Expand All @@ -103,7 +103,7 @@ public function initDriveService()
public function createFolder($parentId, $folderName)
{
// Setting File Matadata
$fileMetadata = new \Google_Service_Drive_DriveFile(array(
$fileMetadata = new \Soramugi\GoogleDrive\File(array(
'name' => $folderName,
'parents' => array($parentId),
'mimeType' => 'application/vnd.google-apps.folder'));
Expand Down Expand Up @@ -185,7 +185,7 @@ public function uploadFile($parentId, $filePath, $fileName = "none")
}

// Creating file matadata
$fileMetadata = new \Google_Service_Drive_DriveFile(array(
$fileMetadata = new \Soramugi\GoogleDrive\File(array(
'name' => $fileName,
'parents' => array($parentId)
));
Expand Down