You are here

public static function ServicesClientOAuthRequest::from_consumer_and_token in Services Client 7.2

Same name and namespace in other branches
  1. 7 services_client_connection/modules/services_client_oauth/plugins/ServicesClientOAuthRequest.inc \ServicesClientOAuthRequest::from_consumer_and_token()

pretty much a helper function to set up the request

2 calls to ServicesClientOAuthRequest::from_consumer_and_token()
ServicesClientConnectionOAuthAuth::sign in services_client_connection/modules/services_client_oauth/plugins/ServicesClientConnectionOAuthAuth.inc
Authenticate request
ServicesClientDrupalOAuthClient::get in services_client_connection/modules/services_client_oauth/plugins/ServicesClientDrupalOAuthClient.inc
Make an OAuth request.

File

services_client_connection/modules/services_client_oauth/plugins/ServicesClientOAuthRequest.inc, line 14

Class

ServicesClientOAuthRequest
@file

Code

public static function from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters = NULL) {
  $parameters = $parameters ? $parameters : array();
  $defaults = array(
    "oauth_version" => OAuthRequest::$version,
    "oauth_nonce" => ServicesClientOAuthRequest::generate_nonce(),
    "oauth_timestamp" => ServicesClientOAuthRequest::generate_timestamp(),
    "oauth_consumer_key" => $consumer->key,
  );
  if ($token) {
    $defaults['oauth_token'] = $token->key;
  }
  $parameters = array_merge($defaults, $parameters);
  return new ServicesClientOAuthRequest($http_method, $http_url, $parameters);
}