예제 #1
0
 /**
  * Send the user to the authorisation page and redirect to the callback page on completion
  * 
  * @param string $callback_url The url to redirect the user to once they're logged in at Videojuicer
  * @param string $unauthorized_token_value The token value to use when signning the request (optional: if no value passed, the current one is retrieved from the Videojuicer class)
  */
 public static function get_authorize_url($callback_url, $unauthorized_token_value = null)
 {
     // If we weren't given a token to use, retrieve it from Videojuicer class
     if (is_null($unauthorized_token_value)) {
         $token = Videojuicer::get_token();
         if ($token instanceof Videojuicer_Token_Unauthorized) {
             $unauthorized_token_value = $token->get_token();
         }
     }
     $method = "oauth/tokens/new";
     $type = Videojuicer_Request::GET;
     $response_class = "Videojuicer_Token_Authorize_Response";
     $exception_class = "Videojuicer_Token_Authorize_Exception";
     $permission = Videojuicer_Permission::NONE;
     $request = new Videojuicer_Request($method, $type, $permission, $response_class, $exception_class);
     $request->set_authorized(true, $unauthorized_token_value);
     $request->set_vars(array("oauth_callback" => $callback_url));
     $request->use_extension(false);
     // Do the logic to decide what the components of the HTTP request should be
     Videojuicer_ClassLoader::load("Videojuicer_Call_Helper");
     $helper = new Videojuicer_Call_Helper($request);
     $helper->setup_components();
     // Retrieve the values determined
     $url = $helper->get_url();
     return $url;
 }
예제 #2
0
 /**
  * Update the presentation with ID provided to the attributes provided
  *
  * @param int $id
  * @param array $attributes
  */
 public static function update($asset_type, $id, $attributes, $token_value, $token_secret)
 {
     #TODO: Check if token value/secret is null and if so try to retrieve from VJ  (Videojuicer::get_access_token()->get_token(), Videojuicer::get_access_token()->get_secret())
     $method = "assets/{$asset_type}/{$id}";
     $type = Videojuicer_Request::PUT;
     $response_class = "Videojuicer_Asset_" . ucfirst($asset_type) . "_Update_Response";
     $exception_class = "Videojuicer_Asset_" . ucfirst($asset_type) . "_Update_Exception";
     $permission = Videojuicer_Permission::WRITE_USER;
     $attributes = Videojuicer_Request::wrap_vars($attributes, "asset");
     $request = new Videojuicer_Request($method, $type, $permission, $response_class, $exception_class);
     $request->set_vars($attributes);
     $request->set_authorized(true, $token_value, $token_secret);
     return Videojuicer::execute_call($request);
 }
예제 #3
0
 /**
  * Get all presentations, optinally meeting the required criteria
  *
  * @param array $criteria Find only presentations which meet the criteria provided
  * @return Videojuicer_Presentation_List_Response
  */
 public function find_all($criteria = array())
 {
     $method = "presentations";
     $type = Videojuicer_Request::GET;
     $response_class = "Videojuicer_Presentation_List_Response";
     $exception_class = "Videojuicer_Presentation_List_Exception";
     $permission = Videojuicer_Permission::NONE;
     $request = new Videojuicer_Request($method, $type, $permission, $response_class, $exception_class);
     // Wrap each of the criteria with a presentation key
     $converted_criteria = array();
     foreach ($criteria as $k => $v) {
         $converted_criteria["presentation[{$k}]"] = $v;
     }
     $request->set_vars($converted_criteria);
     return Videojuicer::execute_call($request);
 }
예제 #4
0
 public static function remove_role($id, $role, $token_value, $token_secret)
 {
     #TODO: Check if token value/secret is null and if so try to retrieve from VJ  (Videojuicer::get_access_token()->get_token(), Videojuicer::get_access_token()->get_secret())
     $method = "users/{$id}/remove_role";
     $type = Videojuicer_Request::POST;
     $response_class = "Videojuicer_User_RemoveRole_Response";
     $exception_class = "Videojuicer_User_RemoveRole_Exception";
     $permission = Videojuicer_Permission::NONE;
     $attributes = array("role" => $role);
     $request = new Videojuicer_Request($method, $type, $permission, $response_class, $exception_class);
     $request->set_authorized(true, $token_value, $token_secret);
     $request->set_vars($attributes);
     return Videojuicer::execute_call($request);
 }