Permalink
Browse files

renames parameters to be standard with spe

  • Loading branch information...
1 parent 331e4f8 commit 2aa8adc138eac96a91393ffb01350e5b36404788 @bshaffer committed Mar 25, 2013
Showing with 9 additions and 9 deletions.
  1. +5 −5 data/parameters.json.dist
  2. +4 −4 src/Demo/ControllerProvider.php
View
@@ -1,10 +1,10 @@
{
"client_id": "demoapp",
"client_secret": "demopass",
- "grant_route": "grant",
+ "token_route": "grant",
"authorize_route": "authorize",
- "curl_options": {},
- "api_route": "access",
- "api_method": "GET",
- "api_params": {}
+ "resource_route": "access",
+ "resource_method": "GET",
+ "resource_params": {},
+ "curl_options": {}
}
@@ -38,7 +38,7 @@ public function connect(Application $app)
// call the API using curl
$curl = new Curl();
- $grantRoute = $app['parameters']['grant_route'];
+ $grantRoute = $app['parameters']['token_route'];
$endpoint = 0 === strpos($grantRoute, 'http') ? $grantRoute : $app['url_generator']->generate($grantRoute, array(), true);
$response = $curl->request($endpoint, $query, 'POST', $app['parameters']['curl_options']);
@@ -58,10 +58,10 @@ public function connect(Application $app)
if (isset($json['access_token'])) {
$token = $json['access_token'];
// make request to the API for awesome data
- $params = array_merge(array('access_token' => $token), $app['parameters']['api_params']);
- $apiRoute = $app['parameters']['api_route'];
+ $params = array_merge(array('access_token' => $token), $app['parameters']['resource_params']);
+ $apiRoute = $app['parameters']['resource_route'];
$endpoint = 0 === strpos($apiRoute, 'http') ? $apiRoute : $app['url_generator']->generate($apiRoute, array(), true);
- $response = $curl->request($endpoint, $params, $app['parameters']['api_method'], $app['parameters']['curl_options']);
+ $response = $curl->request($endpoint, $params, $app['parameters']['resource_method'], $app['parameters']['curl_options']);
$json = json_decode($response['response'], true);
return $app['twig']->render('demo/granted.twig', array('response' => $json ? $json : $response, 'token' => $token, 'endpoint' => $endpoint));
}

0 comments on commit 2aa8adc

Please sign in to comment.