OAuthOAuth1ServiceScoopIt

The Gravity Forms Salesforce Add-On OAuth OAuth1 Service ScoopIt class.

Defined (1)

The class is defined in the following location(s).

/lib/PHPoAuthLib/src/OAuth/OAuth1/Service/ScoopIt.php  
  1. class ScoopIt extends AbstractService 
  2. public function __construct( 
  3. CredentialsInterface $credentials,  
  4. ClientInterface $httpClient,  
  5. TokenStorageInterface $storage,  
  6. SignatureInterface $signature,  
  7. UriInterface $baseApiUri = null 
  8. ) { 
  9. parent::__construct($credentials, $httpClient, $storage, $signature, $baseApiUri); 
  10.  
  11. if (null === $baseApiUri) { 
  12. $this->baseApiUri = new Uri('https://www.scoop.it/api/1/'); 
  13.  
  14. /** 
  15. * {@inheritDoc} 
  16. */ 
  17. public function getRequestTokenEndpoint() 
  18. return new Uri('https://www.scoop.it/oauth/request'); 
  19.  
  20. /** 
  21. * {@inheritdoc} 
  22. */ 
  23. public function getAuthorizationEndpoint() 
  24. return new Uri('https://www.scoop.it/oauth/authorize'); 
  25.  
  26. /** 
  27. * {@inheritdoc} 
  28. */ 
  29. public function getAccessTokenEndpoint() 
  30. return new Uri('https://www.scoop.it/oauth/access'); 
  31.  
  32. /** 
  33. * {@inheritdoc} 
  34. */ 
  35. protected function parseRequestTokenResponse($responseBody) 
  36. parse_str($responseBody, $data); 
  37.  
  38. if (null === $data || !is_array($data)) { 
  39. throw new TokenResponseException('Unable to parse response.'); 
  40. } elseif (!isset($data['oauth_callback_confirmed']) || $data['oauth_callback_confirmed'] !== 'true') { 
  41. throw new TokenResponseException('Error in retrieving token.'); 
  42.  
  43. return $this->parseAccessTokenResponse($responseBody); 
  44.  
  45. /** 
  46. * {@inheritdoc} 
  47. */ 
  48. protected function parseAccessTokenResponse($responseBody) 
  49. parse_str($responseBody, $data); 
  50.  
  51. if (null === $data || !is_array($data)) { 
  52. throw new TokenResponseException('Unable to parse response.'); 
  53. } elseif (isset($data['error'])) { 
  54. throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); 
  55.  
  56. $token = new StdOAuth1Token(); 
  57.  
  58. $token->setRequestToken($data['oauth_token']); 
  59. $token->setRequestTokenSecret($data['oauth_token_secret']); 
  60. $token->setAccessToken($data['oauth_token']); 
  61. $token->setAccessTokenSecret($data['oauth_token_secret']); 
  62.  
  63. $token->setEndOfLife(StdOAuth1Token::EOL_NEVER_EXPIRES); 
  64. unset($data['oauth_token'], $data['oauth_token_secret']); 
  65. $token->setExtraParams($data); 
  66.  
  67. return $token;