Skip to content

Commit 6686752

Browse files
committed
Api: Missed access token key
1 parent d37d551 commit 6686752

File tree

1 file changed

+40
-40
lines changed

1 file changed

+40
-40
lines changed

lib/Be/Api.php

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function exchangeCodeForToken( $code, $redirect_uri, $state = '', $grant
130130

131131
$this->setAccessToken( $response->access_token );
132132
$this->setAuthenticatedUser( $response->user );
133-
133+
134134
return $this->_access_token;
135135

136136
} // exchangeCodeForToken
@@ -146,7 +146,7 @@ public function getAccessToken() {
146146

147147
/**
148148
* After authenticating with the oAuth API, store the access_token before making authenticated requests
149-
*
149+
*
150150
* @param string $access_token
151151
*/
152152
public function setAccessToken( $access_token ) {
@@ -157,26 +157,26 @@ public function setAccessToken( $access_token ) {
157157

158158
/**
159159
* Sets the user object from the token authentication response to be reused
160-
*
160+
*
161161
* @param Object $user
162162
*/
163163
public function setAuthenticatedUser( $user ) {
164-
164+
165165
$this->_user = $user;
166-
166+
167167
} // setAuthenticatedUser
168-
168+
169169
/**
170170
* When available, returns the currently authenticated user object
171-
*
171+
*
172172
* @return Object|null
173173
*/
174174
public function getAuthenticatedUser() {
175-
175+
176176
return $this->_user;
177-
177+
178178
} // getAuthenticatedUser
179-
179+
180180
/**
181181
* Retrieves a full Project, by ID
182182
*
@@ -276,7 +276,7 @@ public function getUserAppreciations( $id_or_username, $assoc = false ) {
276276
* @param int|string $id_or_username : user
277277
* @param bool $assoc : return objects will be converted to associative arrays
278278
* @param array $options : search options
279-
*
279+
*
280280
* @return array : stdClass objects or associative arrays, based on $assoc
281281
*/
282282
public function getUserFollows( $id_or_username, $options = array(), $assoc = false ) {
@@ -289,7 +289,7 @@ public function getUserFollows( $id_or_username, $options = array(), $assoc = fa
289289
return ( empty( $results ) )
290290
? array()
291291
: $results;
292-
292+
293293
} // getUserFollows
294294

295295
/**
@@ -298,32 +298,32 @@ public function getUserFollows( $id_or_username, $options = array(), $assoc = fa
298298
* @param int|string $id_or_username : user
299299
* @param bool $assoc : return objects will be converted to associative arrays
300300
* @param array $options : search options
301-
*
301+
*
302302
* @return array : stdClass objects or associative arrays, based on $assoc
303303
*/
304304
public function getUserFollowers( $id_or_username, $options = array(), $assoc = false ) {
305305

306306
$endpoint = self::ENDPOINT_USERS . '/' . $id_or_username . '/followers';
307-
307+
308308
if ( !empty( $this->_access_token ) )
309-
$options['access_token'] = $this->_access_token;
309+
$options[ self::ACCESS_TOKEN_KEY ] = $this->_access_token;
310310

311311
$results = $this->_getDecodedJson( $endpoint, $options, 'followers', $assoc );
312312

313313
// IMPORTANT: Ensure this will always return an array
314314
return ( empty( $results ) )
315315
? array()
316316
: $results;
317-
317+
318318
} // getUserFollowers
319319

320320
/**
321321
* Retrieves a list of users in the given user's feedback circle
322322
*
323-
* @param int|string $id_or_username : user
323+
* @param int|string $id_or_username : user
324324
* @param bool $assoc : return objects will be converted to associative arrays
325325
* @param array $options : search options
326-
*
326+
*
327327
* @return array : stdClass objects or associative arrays, based on $assoc
328328
*/
329329
public function getUserFeedbackCircle( $id_or_username, $options = array(), $assoc = false ) {
@@ -336,9 +336,9 @@ public function getUserFeedbackCircle( $id_or_username, $options = array(), $ass
336336
return ( empty( $results ) )
337337
? array()
338338
: $results;
339-
339+
340340
} // getUserFeedbackCircle
341-
341+
342342
/**
343343
* Retrieves a list of $id_or_username's works in progress
344344
*
@@ -394,14 +394,14 @@ public function createUserWip( $image_path, $title, array $tags, $description =
394394

395395
/**
396396
* Create new Work in Progress ( WIP ) revision
397-
*
397+
*
398398
* @param int $wip_id : wip id
399399
* @param string $image_path : full image path
400400
* @param string $title : title of WIP
401401
* @param array $tags : tags assoicated with wip revision
402402
* @param string $description : description of wip revision
403403
* @param boolean $assoc : return objects will be converted to associative arrays
404-
*
404+
*
405405
* @return array : stdClass objects or associative arrays, based on $assoc
406406
*/
407407
public function createUserWipRevision( $wip_id, $image_path, $title, array $tags, $description = '', $assoc = false ) {
@@ -414,7 +414,7 @@ public function createUserWipRevision( $wip_id, $image_path, $title, array $tags
414414
$post_body['image'] = '@' . $image_path;
415415
$post_body['title'] = $title;
416416
$post_body['description'] = $description;
417-
417+
418418

419419
$curl_params[ CURLOPT_HTTPHEADER ] = array( 'Content-Type: multipart/form-data' );
420420

@@ -454,11 +454,11 @@ public function updateUserWipRevisionDescription( $wip_id, $revision_id, $descri
454454

455455
/**
456456
* Update WIP title
457-
*
457+
*
458458
* @param string $wip_id : WIP to be updated
459459
* @param string $title : WIP title
460460
* @param boolean $assoc : return objects will be converted to associative arrays
461-
*
461+
*
462462
* @return array : stdClass objects or associative arrays, based on $assoc
463463
*/
464464
public function updateUserWipTitle( $wip_id, $title, $assoc = false ) {
@@ -468,7 +468,7 @@ public function updateUserWipTitle( $wip_id, $title, $assoc = false ) {
468468
$query_params[ self::ACCESS_TOKEN_KEY ] = $this->_access_token;
469469

470470
$put_body['title'] = $title;
471-
471+
472472
$response = $this->_put( $endpoint, $query_params, $put_body );
473473

474474
return ( empty( $response ) )
@@ -505,12 +505,12 @@ public function updateUserWipRevisionTags( $wip_id, $revision_id, array $tags, $
505505

506506
/**
507507
* Post WIP comment
508-
*
508+
*
509509
* @param string $wip_id : WIP to comment on
510510
* @param string $revision_id : WIP revision to comment on
511511
* @param string $comment : comment text
512512
* @param boolean $assoc : return objects will be converted to associative arrays
513-
*
513+
*
514514
* @return array : stdClass objects or associative arrays, based on $assoc
515515
*/
516516
public function postWipComment( $wip_id, $revision_id, $comment, $assoc = false ) {
@@ -525,7 +525,7 @@ public function postWipComment( $wip_id, $revision_id, $comment, $assoc = false
525525
return ( empty( $response ) )
526526
? false
527527
: json_decode( $response, $assoc );
528-
528+
529529
} // postProjectComment
530530

531531
/**
@@ -583,10 +583,10 @@ public function deleteUserWip( $wip_id, $assoc = false ) {
583583
*/
584584
public function getUserActivity( $offset_ts = false, $assoc = false ) {
585585

586-
$endpoint = self::ENDPOINT_ACTIVITY ;
587-
588-
$params['offset_ts'] = $offset_ts;
589-
$params['access_token'] = $this->_access_token;
586+
$endpoint = self::ENDPOINT_ACTIVITY ;
587+
588+
$params['offset_ts'] = $offset_ts;
589+
$params[ self::ACCESS_TOKEN_KEY ] = $this->_access_token;
590590

591591
$results = $this->_getDecodedJson( $endpoint, $params, 'activity', $assoc );
592592

@@ -875,7 +875,7 @@ public function appreciateProject( $id, $assoc = false ) {
875875

876876
/**
877877
* Post project comment
878-
*
878+
*
879879
* @param int $id : project to post comment
880880
* @param string $comment : comment to post
881881
* @param bool $assoc : return objects will be converted to associative arrays
@@ -890,11 +890,11 @@ public function postProjectComment( $id, $comment, $assoc = false ) {
890890
$body_params['comment'] = $comment;
891891

892892
$response = $this->_post( $endpoint, $query_params, $body_params );
893-
893+
894894
return ( empty( $response ) )
895895
? false
896896
: json_decode( $response, $assoc );
897-
897+
898898
} // postProjectComment
899899

900900
/**
@@ -1069,10 +1069,10 @@ public function unfollowUser( $id_or_username, $assoc = false ) {
10691069

10701070
} // unfollowUser
10711071

1072-
1072+
10731073
/**
10741074
* Change the URL root of the Behance API, mostly for testing purposes
1075-
*
1075+
*
10761076
* @param string $url : protocol + fully qualified domain to use instead of https://www.behance.net/v2
10771077
*/
10781078
public function setApiRoot( $url ) {
@@ -1081,8 +1081,8 @@ public function setApiRoot( $url ) {
10811081
$this->_api_root = rtrim( $url, '/' );
10821082

10831083
} // setApiRoot
1084-
1085-
1084+
1085+
10861086
/**
10871087
* Automates retrieval data from $endpoint, using $query_params, and returns stdClass based on presence of $root_node
10881088
*

0 commit comments

Comments
 (0)