Skip to content

Commit

Permalink
Merge pull request rapidwebltd#28 from pyranhax/master
Browse files Browse the repository at this point in the history
Photo function
  • Loading branch information
DivineOmega authored Dec 22, 2016
2 parents 945d89b + 13326a8 commit a2511af
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions factories/ContactFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
}
}
}
Expand Down Expand Up @@ -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'];
}
}
}
Expand Down Expand Up @@ -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;
}
}

0 comments on commit a2511af

Please sign in to comment.