* software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ // Include the Google API Client library, and the Buzz Service wrapper require_once "../../src/apiClient.php"; require_once "../../src/contrib/apiBuzzService.php"; // Include the utility function to display a buzz post- This is only intended to be a demo and a developer should create the UI that works for their app require_once 'includes/displayBuzzPost.php'; // Setup the API Client, and create the Buzz client using it $apiClient = new apiClient(); $buzz = new apiBuzzService($apiClient); // If a oauth token was stored in the session, use that- and otherwise go through the oauth dance if (isset($_SESSION['auth_token'])) { $apiClient->setAccessToken($_SESSION['auth_token']); } else { // In a real application this would be stored in a database, and not in the session! $_SESSION['auth_token'] = $apiClient->authenticate(); } // Include the common header UI require_once "includes/header.php"; // Get the consumption stream (the activities from the people you're following) for @me, which means 'the authenticated user', using $buzz->listActivities() $activities = $buzz->listActivities('@public', '@me', 50, 50, null, 50); //echo "<pre>".print_r($activities, true)."</pre>"; foreach ($activities['items'] as $buzzPost) { displayBuzzPost($buzzPost); } // Include the common footer UI require_once "includes/footer.php";
echo "Activity id: $activityId<br>"; } $comments = $buzz->listComments('@self', '@me', $activityId, 20); echo "<pre>" . print_r($comments, true) . "</pre>"; */ //$related = $buzz->listRelated('@self', '@me', 'tag:google.com,2010:buzz:z122xx25xsazeroqe04cdpjqtv3lznixdd0', 20); //echo "<pre>".print_r($related, true)."</pre>"; /* $people = $buzz->listPeople('@following', '@me', 10); if (isset($people['entry']) && count($people['entry'])) { $personId = $people['entry'][0]['id']; } $ret = $buzz->updatePeople('@following', '@me', $personId, ''); echo "<pre>Result:" . print_r($ret, true) . "</pre>"; */ $activities = $buzz->listActivities('@consumption', '@me', 50, 50, null, 50); echo "<pre>Activities:\n" . print_r($activities, true) . "</pre>"; //$groups = $buzz->listGroups('@me', 20); //echo "<pre>Groups:\n" . print_r($groups, true) . "</pre>"; /*// Batch 2 functions $results = apiBatch::execute( $apiClient->buzz->activities->list(array('userId' => 'chabotc', 'scope' => '@public'), 'listActivities') //$apiClient->buzz->people->get(array('userId' => '@me'), 'getPeople') ); echo "<pre>Batch Results:\n". print_r($results, true)."</pre>"; */ // Old style call //$activities = $apiClient->buzz->activities->list(array('userId' => '@me', 'scope' => '@consumption')); /* // New style using the apiBuzzService wrapper $activities = $buzz->listActivities('@consumption', '@me');
/** * @depends testGetPublicStream */ public function testUnauthenticatedStream() { global $apiConfig; // test unauthenticated public stream fetching $apiConfig['authClass'] = 'apiAuthNone'; $apiClient = new apiClient(); $buzz = new apiBuzzService($apiClient); $apiClient->setAccessToken($apiConfig['oauth_test_token']); // fetch the unauthenticated, public activity streamn $activities = $buzz->listActivities('@public', $apiConfig['oauth_test_user']); // and evaluate it $this->evaluateActivitiesStream($activities); // restore the default Auth class & clean up $apiConfig['authClass'] = 'apiOAuth'; unset($buzz); unset($apiClient); unset($activities); }