diff --git a/DependencyInjection/Factory/DropboxAdapterFactory.php b/DependencyInjection/Factory/DropboxAdapterFactory.php new file mode 100644 index 0000000..b1ff4f8 --- /dev/null +++ b/DependencyInjection/Factory/DropboxAdapterFactory.php @@ -0,0 +1,45 @@ +setDefinition($id, new DefinitionDecorator('knp_gaufrette.adapter.dropbox')) + ->addArgument(new Reference($config['api_id'])) + ; + } + + /** + * {@inheritDoc} + */ + function getKey() + { + return 'dropbox'; + } + + /** + * {@inheritDoc} + */ + function addConfiguration(NodeDefinition $builder) + { + $builder + ->children() + ->scalarNode('api_id')->cannotBeEmpty()->end() + ->end() + ; + } +} diff --git a/README.markdown b/README.markdown index 67524dc..28e31d6 100644 --- a/README.markdown +++ b/README.markdown @@ -809,4 +809,46 @@ knp_gaufrette: checksum: checksum ``` +## Dropbox (dropbox) + +Adapter for Dropbox. + +### Parameters + + * `api_id` The id of the service that provides Dropbox API access. + +### Example + +> In order to get a Dropbox token and token_secret, you need to add a new Dropbox App in your account, and then you'll need to go through the oAuth authorization process + +``` yaml +# app/config/config.yml +knp_gaufrette: + adapters: + foo: + dropbox: + api_id: acme_test.dropbox.api +``` + +In your AcmeTestBundle, add following service definitions: + +``` yaml +# src/Acme/TestBundle/Resources/config/services.yml +parameters: + acme_test.dropbox.key: my_consumer_key + acme_test.dropbox.secret: my_consumer_secret + acme_test.dropbox.token: some_token + acme_test.dropbox.token_secret: some_token_secret + +services: + acme_test.dropbox.oauth: + class: Dropbox_OAuth_Curl + arguments: [%acme_test.dropbox.key%, %acme_test.dropbox.secret%] + calls: + - [setToken, ["%acme_test.dropbox.token%", "%acme_test.dropbox.token_secret%"]] + acme_test.dropbox.api: + class: Dropbox_API + arguments: [@acme_test.dropbox.oauth, "sandbox"] +``` + [gaufrette-homepage]: https://github.com/KnpLabs/Gaufrette diff --git a/Resources/config/adapter_factories.xml b/Resources/config/adapter_factories.xml index ce3aca0..562a144 100644 --- a/Resources/config/adapter_factories.xml +++ b/Resources/config/adapter_factories.xml @@ -53,7 +53,9 @@ - + + + diff --git a/Resources/config/gaufrette.xml b/Resources/config/gaufrette.xml index 20f1a8e..49041e4 100644 --- a/Resources/config/gaufrette.xml +++ b/Resources/config/gaufrette.xml @@ -48,6 +48,7 @@ +