2017 © Pedro Peláez
 

cakephp-plugin http-source

Provides base class for datasorses with Http protocol

image

imsamurai/http-source

Provides base class for datasorses with Http protocol

  • Tuesday, June 2, 2015
  • by imsamurai
  • Repository
  • 3 Watchers
  • 3 Stars
  • 1,488 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 23 Forks
  • 6 Open issues
  • 25 Versions
  • 0 % Grown

The README.md

HttpSource Plugin Main page

Build Status Coverage Status Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

Plugin with HttpSource to provide base class for datasorses with Http protocol. Based on ProLoser implementation. I make some refactoring to make HttpSource more similar to DboSource and removed OAuth component, because i think for login better use Opauth., (*2)

For existing plugins check ProLoser readme. But they will not work with HttpSource. I will adapt these plugins later., (*3)

Notes

HttpSource is an abstract class and must be extended by the Api you wish to support. Open a bug ticket if you'd like some help making your own or just want me to do it. It's very easy to add new ones - check out the list, (*4)

Installation

Step 1: Clone or download to Plugin/HttpSource

cd my_cake_app/app
git clone git://github.com/imsamurai/cakephp-httpsource-datasource.git Plugin/HttpSource

or if you use git add as submodule:, (*5)

cd my_cake_app
git submodule add "git://github.com/imsamurai/cakephp-httpsource-datasource.git" "app/Plugin/HttpSource"

then update submodules:, (*6)

git submodule init
git submodule update

Step 2: Add your configuration to database.php and set it to the model

:: database.php ::
var $myapi = array(
    'datasource' => 'MyPlugin.Http/MyPlugin', // Example: 'Github.Http/Github'
        'host' => 'api.myplugin.com/v1',
        'port' => 80,
        'persistent' => false,
        'auth' => array(
            'name' => 'oauth',
            'version' => '1.0', //version 2 not tested, maybe don't work
            'oauth_consumer_key' => '--Your API Key--',
            'oauth_consumer_secret' => '--Your API Secret--'
        ),
        //all other parameters that passed to config of http socket
        //...
);
:: MyModel.php ::

```php public $useDbConfig = 'myapi'; public $useTable = 'myapi_table';, (*7)


### Step 3: Load main plugin and your plugin

:: bootstrap.php ::, (*8)

```php
CakePlugin::load('HttpSource', array('bootstrap' => true, 'routes' => true));
CakePlugin::load('MyPlugin');

Step 4: Querying the API

Best to just give an example. I switch the datasource on the fly because the model is actually a projects table in the DB. I tend to query from my API and then switch to default and save the results., (*9)

App::uses('HttpSourceModel', 'HttpSource.Model');

class Project extends HttpSourceModel {
    function findAuthedUserRepos() {
        $this->setDataSource('github');
        $projects = $this->find('all', array(
                        //used as repo name if useTable is empty, otherwise used as standart fields parameter
            'fields' => 'repos'
        ));
        $this->setDataSource('default'); // if more queries are done later
        return $projects;
    }
}

Configuration

See wiki., (*10)

The Versions

02/06 2015

1.2.11

1.2.11.0 http://github.com/imsamurai/cakephp-httpsource-datasource

Provides base class for datasorses with Http protocol

  Sources   Download

MIT

The Requires

 

plugin database cakephp http datasource

02/06 2015

dev-master

9999999-dev http://github.com/imsamurai/cakephp-httpsource-datasource

Provides base class for datasorses with Http protocol

  Sources   Download

MIT

The Requires

 

plugin database cakephp http datasource

22/12 2014

1.2.10

1.2.10.0 http://github.com/imsamurai/cakephp-httpsource-datasource

Provides base class for datasorses with Http protocol

  Sources   Download

MIT

The Requires

 

plugin database cakephp http datasource

19/12 2014

1.2.9

1.2.9.0 http://github.com/imsamurai/cakephp-httpsource-datasource

Provides base class for datasorses with Http protocol

  Sources   Download

MIT

The Requires

 

plugin database cakephp http datasource

18/12 2014

1.2.8

1.2.8.0 http://github.com/imsamurai/cakephp-httpsource-datasource

Provides base class for datasorses with Http protocol

  Sources   Download

MIT

The Requires

 

plugin database cakephp http datasource

17/12 2014

1.2.7

1.2.7.0 http://github.com/imsamurai/cakephp-httpsource-datasource

Provides base class for datasorses with Http protocol

  Sources   Download

MIT

The Requires

 

plugin database cakephp http datasource

17/12 2014

1.2.6

1.2.6.0 http://github.com/imsamurai/cakephp-httpsource-datasource

Provides base class for datasorses with Http protocol

  Sources   Download

MIT

The Requires

 

plugin database cakephp http datasource

11/12 2014

1.2.5

1.2.5.0 http://github.com/imsamurai/cakephp-httpsource-datasource

Provides base class for datasorses with Http protocol

  Sources   Download

MIT

The Requires

 

plugin database cakephp http datasource

10/12 2014

1.2.4

1.2.4.0 http://github.com/imsamurai/cakephp-httpsource-datasource

Provides base class for datasorses with Http protocol

  Sources   Download

MIT

The Requires

 

plugin database cakephp http datasource

05/09 2014

1.2.3

1.2.3.0 http://github.com/imsamurai/cakephp-httpsource-datasource

Provides base class for datasorses with Http protocol

  Sources   Download

MIT

The Requires

 

plugin database cakephp http datasource

04/09 2014

1.2.2

1.2.2.0 http://github.com/imsamurai/cakephp-httpsource-datasource

Provides base class for datasorses with Http protocol

  Sources   Download

MIT

The Requires

 

plugin database cakephp http datasource

03/09 2014

1.2.1

1.2.1.0 http://github.com/imsamurai/cakephp-httpsource-datasource

Provides base class for datasorses with Http protocol

  Sources   Download

MIT

The Requires

 

plugin database cakephp http datasource

02/09 2014

1.2.0

1.2.0.0 http://github.com/imsamurai/cakephp-httpsource-datasource

Provides base class for datasorses with Http protocol

  Sources   Download

MIT

The Requires

 

plugin database cakephp http datasource

01/07 2014

1.1.2

1.1.2.0 http://github.com/imsamurai/cakephp-httpsource-datasource

Provides base class for datasorses with Http protocol

  Sources   Download

MIT

The Requires

 

plugin database cakephp http datasource

05/06 2014

1.1.1

1.1.1.0 http://github.com/imsamurai/cakephp-httpsource-datasource

Provides base class for datasorses with Http protocol

  Sources   Download

MIT

The Requires

 

plugin database cakephp http datasource

04/06 2014

1.1.0

1.1.0.0 http://github.com/imsamurai/cakephp-httpsource-datasource

Provides base class for datasorses with Http protocol

  Sources   Download

MIT

The Requires

 

plugin database cakephp http datasource

28/05 2014

1.0.8

1.0.8.0 http://github.com/imsamurai/cakephp-httpsource-datasource

Provides base class for datasorses with Http protocol

  Sources   Download

MIT

The Requires

 

plugin database cakephp http datasource

28/04 2014

1.0.7

1.0.7.0 http://github.com/imsamurai/cakephp-httpsource-datasource

Provides base class for datasorses with Http protocol

  Sources   Download

MIT

The Requires

 

plugin database cakephp http datasource

07/04 2014

1.0.6

1.0.6.0 http://github.com/imsamurai/cakephp-httpsource-datasource

Provides base class for datasorses with Http protocol

  Sources   Download

MIT

The Requires

 

plugin database cakephp http datasource

31/03 2014

1.0.5

1.0.5.0 http://github.com/imsamurai/cakephp-httpsource-datasource

Provides base class for datasorses with Http protocol

  Sources   Download

MIT

The Requires

 

plugin database cakephp http datasource

03/03 2014

1.0.4

1.0.4.0 http://github.com/imsamurai/cakephp-httpsource-datasource

Provides base class for datasorses with Http protocol

  Sources   Download

MIT

The Requires

 

plugin database cakephp http datasource

28/02 2014

1.0.3

1.0.3.0 http://github.com/imsamurai/cakephp-httpsource-datasource

Provides base class for datasorses with Http protocol

  Sources   Download

MIT

The Requires

 

plugin database cakephp http datasource

11/02 2014

1.0.2

1.0.2.0 http://github.com/imsamurai/cakephp-httpsource-datasource

Provides base class for datasorses with Http protocol

  Sources   Download

MIT

The Requires

 

plugin database cakephp http datasource

06/02 2014

1.0.0

1.0.0.0 http://github.com/imsamurai/cakephp-httpsource-datasource

Provides base class for datasorses with Http protocol

  Sources   Download

MIT

The Requires

 

plugin database cakephp http datasource

06/02 2014

1.0.1

1.0.1.0 http://github.com/imsamurai/cakephp-httpsource-datasource

Provides base class for datasorses with Http protocol

  Sources   Download

MIT

The Requires

 

plugin database cakephp http datasource