From 41e16fba9e480eeeac620c18e0f51de8dd3c007f Mon Sep 17 00:00:00 2001 From: Kyle Robinson Young Date: Mon, 14 May 2012 11:37:38 -0700 Subject: [PATCH] Fix setting Auth in Source --- Model/Datasource/StripeSource.php | 39 ++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/Model/Datasource/StripeSource.php b/Model/Datasource/StripeSource.php index 9918d76..22c4c3a 100755 --- a/Model/Datasource/StripeSource.php +++ b/Model/Datasource/StripeSource.php @@ -167,16 +167,13 @@ public function request($request = array()) { 'uri' => array( 'host' => 'api.stripe.com', 'scheme' => 'https', - 'path' => '/' + 'path' => '/', ), 'method' => 'GET', - 'auth' => array( - 'user' => $this->config['api_key'], - 'pass' => '' - ) ); $this->request = Set::merge($this->request, $request); - $this->request['uri']['path'] = '/v1/'.trim($this->request['uri']['path'], '/'); + $this->request['uri']['path'] = '/v1/' . trim($this->request['uri']['path'], '/'); + $this->Http->configAuth('Basic', $this->config['api_key'], ''); try { $response = $this->Http->request($this->request); @@ -223,18 +220,38 @@ public function reformat($model, $data) { return $data; } - - /** - * Unused function + * For checking if record exists. Always say yes. * - * @param Model $model + * @param Model $Model * @param string $func + * @return true + */ + public function calculate(Model $Model, $func) { + return 1; + } + +/** + * Don't use internal caching + * * @return null */ - public function calculate($model, $func) { + public function listSources() { return null; } +/** + * Descibe with schema. Check the model or use nothing. + * + * @param Model $Model + * @return array + */ + public function describe(Model $Model) { + if (isset($Model->_schema)) { + return $Model->_schema; + } else { + return null; + } + } } \ No newline at end of file