Skip to content

Commit d37d551

Browse files
committed
Client: Use access_token key const
1 parent 9f55064 commit d37d551

1 file changed

Lines changed: 23 additions & 21 deletions

File tree

lib/Be/Api.php

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class Be_Api {
2929
const VALID = 1;
3030
const INVALID = 0;
3131

32+
const ACCESS_TOKEN_KEY = 'access_token';
33+
3234
protected $_api_root = 'https://www.behance.net/v2';
3335

3436
protected $_client_id,
@@ -370,9 +372,9 @@ public function getUserWips( $id_or_username, $assoc = false ) {
370372
*/
371373
public function createUserWip( $image_path, $title, array $tags, $description = '', $assoc = false ) {
372374

373-
$endpoint = self::ENDPOINT_WIPS;
375+
$endpoint = self::ENDPOINT_WIPS;
374376

375-
$query_params['access_token'] = $this->_access_token;
377+
$query_params[ self::ACCESS_TOKEN_KEY ] = $this->_access_token;
376378

377379
$post_body['tags'] = implode( '|', $tags );
378380
$post_body['image'] = '@' . $image_path;
@@ -406,7 +408,7 @@ public function createUserWipRevision( $wip_id, $image_path, $title, array $tags
406408

407409
$endpoint = self::ENDPOINT_WIPS . '/' . $id;
408410

409-
$query_params['access_token'] = $this->_access_token;
411+
$query_params[ self::ACCESS_TOKEN_KEY ] = $this->_access_token;
410412

411413
$post_body['tags'] = implode( '|', $tags );
412414
$post_body['image'] = '@' . $image_path;
@@ -438,7 +440,7 @@ public function updateUserWipRevisionDescription( $wip_id, $revision_id, $descri
438440

439441
$endpoint = self::ENDPOINT_WIPS . '/' . $wip_id . '/' . $revision_id;
440442

441-
$query_params['access_token'] = $this->_access_token;
443+
$query_params[ self::ACCESS_TOKEN_KEY ] = $this->_access_token;
442444

443445
$put_body['description'] = $description;
444446

@@ -463,7 +465,7 @@ public function updateUserWipTitle( $wip_id, $title, $assoc = false ) {
463465

464466
$endpoint = self::ENDPOINT_WIPS . '/' . $wip_id ;
465467

466-
$query_params['access_token'] = $this->_access_token;
468+
$query_params[ self::ACCESS_TOKEN_KEY ] = $this->_access_token;
467469

468470
$put_body['title'] = $title;
469471

@@ -489,7 +491,7 @@ public function updateUserWipRevisionTags( $wip_id, $revision_id, array $tags, $
489491

490492
$endpoint = self::ENDPOINT_WIPS . '/' . $wip_id . '/' . $revision_id;
491493

492-
$query_params['access_token'] = $this->_access_token;
494+
$query_params[ self::ACCESS_TOKEN_KEY ] = $this->_access_token;
493495

494496
$put_body['tags'] = implode( '|', $tags );
495497

@@ -515,7 +517,7 @@ public function postWipComment( $wip_id, $revision_id, $comment, $assoc = false
515517

516518
$endpoint = self::ENDPOINT_WIPS . '/' . $id . '/' . $revision_id . '/comments';
517519

518-
$query_params['access_token'] = $this->_access_token;
520+
$query_params[ self::ACCESS_TOKEN_KEY ] = $this->_access_token;
519521
$body_params['comment'] = $comment;
520522

521523
$response = $this->_post( $endpoint, $query_params, $body_params );
@@ -539,7 +541,7 @@ public function deleteUserWipRevision( $wip_id, $revision_id, $assoc = false ) {
539541

540542
$endpoint = self::ENDPOINT_WIPS . '/' . $wip_id . '/' . $revision_id;
541543

542-
$query_params['access_token'] = $this->_access_token;
544+
$query_params[ self::ACCESS_TOKEN_KEY ] = $this->_access_token;
543545

544546
$response = $this->_delete( $endpoint, $query_params );
545547

@@ -561,7 +563,7 @@ public function deleteUserWip( $wip_id, $assoc = false ) {
561563

562564
$endpoint = self::ENDPOINT_WIPS . '/' . $wip_id ;
563565

564-
$query_params['access_token'] = $this->_access_token;
566+
$query_params[ self::ACCESS_TOKEN_KEY ] = $this->_access_token;
565567

566568
$response = $this->_delete( $endpoint, $query_params );
567569

@@ -650,7 +652,7 @@ public function createCollection( $title, $project_ids = array(), $assoc = false
650652

651653
$endpoint = self::ENDPOINT_COLLECTIONS;
652654

653-
$query_params['access_token'] = $this->_access_token;
655+
$query_params[ self::ACCESS_TOKEN_KEY ] = $this->_access_token;
654656
$body_params['title'] = $title;
655657

656658
if ( !empty( $project_ids ) )
@@ -677,7 +679,7 @@ public function deleteCollection( $id, $assoc = false ) {
677679

678680
$endpoint = self::ENDPOINT_COLLECTIONS . '/' . $id;
679681

680-
$query_params['access_token'] = $this->_access_token;
682+
$query_params[ self::ACCESS_TOKEN_KEY ] = $this->_access_token;
681683

682684
$response = $this->_delete( $endpoint, $query_params );
683685

@@ -700,7 +702,7 @@ public function updateCollection( $id, $title, $assoc = false ) {
700702

701703
$endpoint = self::ENDPOINT_COLLECTIONS . '/' . $id;
702704

703-
$query_params['access_token'] = $this->_access_token;
705+
$query_params[ self::ACCESS_TOKEN_KEY ] = $this->_access_token;
704706
$body_params['title'] = $title;
705707

706708
$response = $this->_put( $endpoint, $query_params, $body_params );
@@ -747,7 +749,7 @@ public function addProjectsToCollection( $id, array $project_ids, $assoc = false
747749

748750
$projects = implode( '|', $project_ids );
749751

750-
$query_params['access_token'] = $this->_access_token;
752+
$query_params[ self::ACCESS_TOKEN_KEY ] = $this->_access_token;
751753

752754
$body_params['projects'] = $projects;
753755

@@ -773,7 +775,7 @@ public function removeProjectFromCollection( $id, $project_id, $assoc = false )
773775

774776
$endpoint = self::ENDPOINT_COLLECTIONS . '/' . $id . '/projects/' . $project_id;
775777

776-
$query_params['access_token'] = $this->_access_token;
778+
$query_params[ self::ACCESS_TOKEN_KEY ] = $this->_access_token;
777779

778780
$response = $this->_delete( $endpoint, $query_params );
779781

@@ -839,7 +841,7 @@ public function viewProject( $id, $assoc = false ) {
839841

840842
$endpoint = self::ENDPOINT_PROJECTS . '/' . $id . '/view';
841843

842-
$query_params['access_token'] = $this->_access_token;
844+
$query_params[ self::ACCESS_TOKEN_KEY ] = $this->_access_token;
843845

844846
$response = $this->_post( $endpoint, $query_params );
845847

@@ -861,7 +863,7 @@ public function appreciateProject( $id, $assoc = false ) {
861863

862864
$endpoint = self::ENDPOINT_PROJECTS . '/' . $id . '/appreciate';
863865

864-
$query_params['access_token'] = $this->_access_token;
866+
$query_params[ self::ACCESS_TOKEN_KEY ] = $this->_access_token;
865867

866868
$response = $this->_post( $endpoint, $query_params );
867869

@@ -884,7 +886,7 @@ public function postProjectComment( $id, $comment, $assoc = false ) {
884886

885887
$endpoint = self::ENDPOINT_PROJECTS . '/' . $id . '/comments';
886888

887-
$query_params['access_token'] = $this->_access_token;
889+
$query_params[ self::ACCESS_TOKEN_KEY ] = $this->_access_token;
888890
$body_params['comment'] = $comment;
889891

890892
$response = $this->_post( $endpoint, $query_params, $body_params );
@@ -907,7 +909,7 @@ public function followCollection( $id, $assoc = false ) {
907909

908910
$endpoint = self::ENDPOINT_COLLECTIONS . '/' . $id . '/follow';
909911

910-
$query_params['access_token'] = $this->_access_token;
912+
$query_params[ self::ACCESS_TOKEN_KEY ] = $this->_access_token;
911913

912914
$response = $this->_post( $endpoint, $query_params );
913915

@@ -929,7 +931,7 @@ public function unfollowCollection( $id, $assoc = false ) {
929931

930932
$endpoint = self::ENDPOINT_COLLECTIONS . '/' . $id . '/follow';
931933

932-
$query_params['access_token'] = $this->_access_token;
934+
$query_params[ self::ACCESS_TOKEN_KEY ] = $this->_access_token;
933935

934936
$response = $this->_delete( $endpoint, $query_params );
935937

@@ -1035,7 +1037,7 @@ public function followUser( $id_or_username, $assoc = false ) {
10351037

10361038
$endpoint = self::ENDPOINT_USERS . "/{$id_or_username}/follow";
10371039

1038-
$query_params['access_token'] = $this->_access_token;
1040+
$query_params[ self::ACCESS_TOKEN_KEY ] = $this->_access_token;
10391041

10401042
$response = $this->_post( $endpoint, $query_params );
10411043

@@ -1057,7 +1059,7 @@ public function unfollowUser( $id_or_username, $assoc = false ) {
10571059

10581060
$endpoint = self::ENDPOINT_USERS . "/{$id_or_username}/follow";
10591061

1060-
$query_params['access_token'] = $this->_access_token;
1062+
$query_params[ self::ACCESS_TOKEN_KEY ] = $this->_access_token;
10611063

10621064
$response = $this->_delete( $endpoint, $query_params );
10631065

0 commit comments

Comments
 (0)