10 defined(
'JPATH_PLATFORM') or die;
31 parent::__construct($options, $auth);
33 if (isset($this->auth) && !$this->auth->getOption(
'scope'))
35 $this->auth->setOption(
'scope',
'https://www.googleapis.com/auth/plus.me');
49 public function getPeople($id, $fields = null)
51 if ($this->isAuthenticated())
53 $url = $this->getOption(
'api.url') .
'people/' . $id;
58 $url .=
'?fields=' . $fields;
61 $jdata = $this->auth->query($url);
63 return json_decode($jdata->body,
true);
85 public function search($query, $fields = null, $language = null, $max = 10, $token = null)
87 if ($this->isAuthenticated())
89 $url = $this->getOption(
'api.url') .
'people?query=' . urlencode($query);
94 $url .=
'&fields=' . $fields;
100 $url .=
'&language=' . $language;
106 $url .=
'&maxResults=' . $max;
112 $url .=
'&pageToken=' . $token;
115 $jdata = $this->auth->query($url);
117 return json_decode($jdata->body,
true);
139 public function listByActivity($activityId, $collection, $fields = null, $max = 10, $token = null)
141 if ($this->isAuthenticated())
143 $url = $this->getOption(
'api.url') .
'activities/' . $activityId .
'/people/' . $collection;
148 $url .=
'?fields=' . $fields;
154 $url .= (strpos($url,
'?') ===
false) ?
'?maxResults=' :
'&maxResults=';
161 $url .= (strpos($url,
'?') ===
false) ?
'?pageToken=' :
'&pageToken=';
165 $jdata = $this->auth->query($url);
167 return json_decode($jdata->body,
true);