diff --git a/factories/ContactFactory.php b/factories/ContactFactory.php index 1f98db8..3d1fdb3 100644 --- a/factories/ContactFactory.php +++ b/factories/ContactFactory.php @@ -36,6 +36,8 @@ public static function getAll() $contactDetails['editURL'] = (string) $attributes['href']; } elseif ($attributes['rel'] == 'self') { $contactDetails['selfURL'] = (string) $attributes['href']; + } elseif ($attributes['rel'] == 'http://schemas.google.com/contacts/2008/rel#edit-photo') { + $contactDetails['photoURL'] = (string) $attributes['href']; } } } @@ -100,6 +102,8 @@ public static function getBySelfURL($selfURL) $contactDetails['editURL'] = (string) $attributes['href']; } elseif ($attributes['rel'] == 'self') { $contactDetails['selfURL'] = (string) $attributes['href']; + } elseif ($attributes['rel'] == 'http://schemas.google.com/contacts/2008/rel#edit-photo') { + $contactDetails['photoURL'] = (string) $attributes['href']; } } } @@ -293,4 +297,14 @@ public static function delete(Contact $toDelete) $client->getAuth()->authenticatedRequest($req); } + + public static function getPhoto($photoURL) + { + $client = GoogleHelper::getClient(); + $req = new \Google_Http_Request($photoURL); + $req->setRequestMethod('GET'); + $val = $client->getAuth()->authenticatedRequest($req); + $response = $val->getResponseBody(); + return $response; + } }