10 defined(
'JPATH_PLATFORM') or die();
28 public function getDetails()
30 $token = $this->oauth->getToken();
34 'oauth_token' => $token[
'key']
38 $base =
'user/details';
41 $path = $this->getOption(
'api.url') . $base;
44 $response = $this->oauth->oauthRequest($path,
'GET', $parameters);
46 return $response->body;
56 public function getPreferences()
58 $token = $this->oauth->getToken();
62 'oauth_token' => $token[
'key']
66 $base =
'user/preferences';
69 $path = $this->getOption(
'api.url') . $base;
72 $response = $this->oauth->oauthRequest($path,
'GET', $parameters);
74 return $response->body;
86 public function replacePreferences($preferences)
88 $token = $this->oauth->getToken();
92 'oauth_token' => $token[
'key']
96 $base =
'user/preferences';
99 $path = $this->getOption(
'api.url') . $base;
102 $preference_list =
'';
104 if (!empty($preferences))
106 foreach ($preferences as $key => $value)
108 $preference_list .=
'<preference k="' . $key .
'" v="' . $value .
'"/>';
112 $xml =
'<?xml version="1.0" encoding="UTF-8"?>
113 <osm version="0.6" generator="JOpenstreetmap">
119 $header[
'Content-Type'] =
'text/xml';
122 $response = $this->oauth->oauthRequest($path,
'PUT', $parameters, $xml, $header);
124 return $response->body;
137 public function changePreference($key, $preference)
139 $token = $this->oauth->getToken();
143 'oauth_token' => $token[
'key']
147 $base =
'user/preferences/' . $key;
150 $path = $this->getOption(
'api.url') . $base;
153 $response = $this->oauth->oauthRequest($path,
'PUT', $parameters, $preference);
155 return $response->body;