From ae786b1faa1a417e5597fe54d95bb564975a99ae Mon Sep 17 00:00:00 2001 From: Radu Topala Date: Fri, 4 Oct 2013 06:17:52 +0000 Subject: [PATCH 1/3] added Dropbox Adapter Factory --- .../Factory/DropboxAdapterFactory.php | 45 +++++++++++++++++++ Resources/config/adapter_factories.xml | 4 +- Resources/config/gaufrette.xml | 1 + 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 DependencyInjection/Factory/DropboxAdapterFactory.php diff --git a/DependencyInjection/Factory/DropboxAdapterFactory.php b/DependencyInjection/Factory/DropboxAdapterFactory.php new file mode 100644 index 0000000..6cada02 --- /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')->isRequired()->end() + ->end() + ; + } +} diff --git a/Resources/config/adapter_factories.xml b/Resources/config/adapter_factories.xml index 6ae6efe..2dbf5d8 100644 --- a/Resources/config/adapter_factories.xml +++ b/Resources/config/adapter_factories.xml @@ -47,7 +47,9 @@ - + + + diff --git a/Resources/config/gaufrette.xml b/Resources/config/gaufrette.xml index f80c01c..b9d37a7 100644 --- a/Resources/config/gaufrette.xml +++ b/Resources/config/gaufrette.xml @@ -46,6 +46,7 @@ + From 8875fccb5e0b1e7b63d462f5d3660ff9466e1383 Mon Sep 17 00:00:00 2001 From: Radu Topala Date: Fri, 4 Oct 2013 10:41:20 +0300 Subject: [PATCH 2/3] Update README.markdown --- README.markdown | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/README.markdown b/README.markdown index 601a56d..3f93772 100644 --- a/README.markdown +++ b/README.markdown @@ -790,4 +790,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 From 209928f896adc1ce418606164df446c7200d8fd9 Mon Sep 17 00:00:00 2001 From: Radu Topala Date: Sun, 6 Oct 2013 09:25:51 +0300 Subject: [PATCH 3/3] Update DropboxAdapterFactory.php --- DependencyInjection/Factory/DropboxAdapterFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DependencyInjection/Factory/DropboxAdapterFactory.php b/DependencyInjection/Factory/DropboxAdapterFactory.php index 6cada02..b1ff4f8 100644 --- a/DependencyInjection/Factory/DropboxAdapterFactory.php +++ b/DependencyInjection/Factory/DropboxAdapterFactory.php @@ -38,7 +38,7 @@ function addConfiguration(NodeDefinition $builder) { $builder ->children() - ->scalarNode('api_id')->isRequired()->end() + ->scalarNode('api_id')->cannotBeEmpty()->end() ->end() ; }