usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rockers...@apache.org
Subject [31/45] incubator-usergrid git commit: updated read me. Updated manifest files to include notifications and messages. Updated tests to add @group annotation to tests that require internet and usergrid install so tests can be excluded when testing without
Date Wed, 12 Nov 2014 01:15:36 GMT
updated read me.
Updated manifest files to include notifications and messages.
Updated tests to add @group annotation to tests that require internet and usergrid install
so tests can be excluded when testing without usergrid install.


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/b86966ed
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/b86966ed
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/b86966ed

Branch: refs/heads/master
Commit: b86966ed29c2ec3ee1e5749992feabcadcce4f16
Parents: 45cf125
Author: Jason Kristian <jasonk@apps4u.com.au>
Authored: Fri Nov 7 14:26:41 2014 +1000
Committer: Jason Kristian <jasonk@apps4u.com.au>
Committed: Fri Nov 7 14:26:41 2014 +1000

----------------------------------------------------------------------
 .../Examples/collections/books.php              |  18 +-
 sdks/php5/apache-usergrid/Examples/examples.md  |  17 ++
 sdks/php5/apache-usergrid/Examples/examples.php |  24 +--
 .../Examples/management/management.php          |  91 ++++++++++
 .../apache-usergrid/Examples/messages/data.php  |  17 ++
 .../Examples/messages/messages.php              |  62 +++++++
 .../Examples/notifications/data.php             |  17 ++
 .../Examples/notifications/notifications.php    |  62 +++++++
 sdks/php5/apache-usergrid/README.md             |  41 +++--
 .../src/Manifests/1.0.1/Messages.php            |  19 +++
 .../src/Manifests/1.0.1/Notification.php        | 154 -----------------
 .../src/Manifests/1.0.1/Notifications.php       | 169 ++++++++++++++++++-
 .../apache-usergrid/tests/Api/UsergridTest.php  |   2 +-
 .../apache-usergrid/tests/Api/test_config.php   |   6 +-
 14 files changed, 503 insertions(+), 196 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b86966ed/sdks/php5/apache-usergrid/Examples/collections/books.php
----------------------------------------------------------------------
diff --git a/sdks/php5/apache-usergrid/Examples/collections/books.php b/sdks/php5/apache-usergrid/Examples/collections/books.php
index 922b24d..e5dec7b 100644
--- a/sdks/php5/apache-usergrid/Examples/collections/books.php
+++ b/sdks/php5/apache-usergrid/Examples/collections/books.php
@@ -72,7 +72,7 @@ $books = Usergrid::application()->EntityGet(['collection' => 'books',
'limit' =>
 
 
 // get result count just call the Illuminate\Support\Collection  count method
-var_dump($books->count());
+var_dump($books->entities->count());
 
 
 // As responses are model object you can treat them like a assoc arrays
@@ -81,32 +81,32 @@ var_dump($books[0]['uuid']);
 // if you like a more object orientated way then use the Collection Class methods
 
 // get all uuid
-var_dump($books->fetch('uuid'));
+var_dump($books->entities->fetch('uuid'));
 
 // get first item in collection -- this is the first item in my response php collection not
the Usergrid Collection (table).
-var_dump($books->first());
+var_dump($books->entities->first());
 
 // get last item in collection -- this is the last item in my response php collection not
the Usergrid Collection (table).
-var_dump($books->last());
+var_dump($books->entities->last());
 
 
 
 // Illuminate\Support\Collection class support all advanced collection methods
 
 // pop last item off collection
-$book = $books->pop();
+$book = $books->entities->pop();
 
 // Converting methods
-$json_ = $books->toJson();
+$json_ = $books->entities->toJson();
 
 //Convert the object into something JSON serializable.
-$books->jsonSerialize();
+$books->entities->jsonSerialize();
 
 // Get an iterator for the items in collection
-$iterator = $books->getIterator();
+$iterator = $books->entities->getIterator();
 
 //Get a CachingIterator instance
-$caching_iterator = $books->getCachingIterator();
+$caching_iterator = $books->entities->getCachingIterator();
 
 /// Here are some more Methods that you can call on your responses .. To get the most out
of this SDK please look at the Illuminate\Support\Collection class
 /// which is the supper class of Apache/Usergrid/Api/Models/BaseCollection class

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b86966ed/sdks/php5/apache-usergrid/Examples/examples.md
----------------------------------------------------------------------
diff --git a/sdks/php5/apache-usergrid/Examples/examples.md b/sdks/php5/apache-usergrid/Examples/examples.md
new file mode 100644
index 0000000..0266743
--- /dev/null
+++ b/sdks/php5/apache-usergrid/Examples/examples.md
@@ -0,0 +1,17 @@
+## Examples Read Me ##
+
+I don't show every method that you can call in the examples but I show you the most common
api calls you will make but to get the most out of this api 
+you really should spend around 10 to 15 minutes to read all the guzzle web service descriptors
files in the Manifest folders that are versioned the most 
+up to date version is 1.0.1 folder.
+
+### Manifest files ###
+Guzzle web service descriptors.
+
+You can use the files included with the sdk but you are able to create your own , so you
can pass the path the the manifest folder in the config to the sdk. 
+The reason you might create you own is to support you own custom collections. So the way
to do that is to copy the manifest folder to the location you want
+then there is a file called custom that you need to copy and edit so for example if I had
a custom Collection called Books and I want to be able to call
+the sdk like ```Usergrid::books()->findById(['uuid'=> '12121']); ``` . All I have to
do is copy the manifest file called custom and name it books and then 
+in the file replace the ```$custom``` with the word ```'books'``` .
+From that point on I can make api calls to my custom collection just like any of the default
collection usergrid give you its a easy as that Ive designed this
+SDK to be extened so you can get the most out of your usergrid install .
+

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b86966ed/sdks/php5/apache-usergrid/Examples/examples.php
----------------------------------------------------------------------
diff --git a/sdks/php5/apache-usergrid/Examples/examples.php b/sdks/php5/apache-usergrid/Examples/examples.php
index f139808..b896ec7 100644
--- a/sdks/php5/apache-usergrid/Examples/examples.php
+++ b/sdks/php5/apache-usergrid/Examples/examples.php
@@ -65,10 +65,12 @@ $usergrid = $bootstrapper->createUsergrid();
 
 /** Note: I'm using Users for the first lot of example's but you could do the same for all
default collections eg: groups, devices, roles, notification etc*/
 
+// All responses are model objects that subclass the baseCollection class so all collection
methods are available eg: first(), map(), fetch(), hasValue(), hasKey() etc.
+
 //find users with query
 $user = $usergrid->users()->find(['ql' => 'select * where activated=true']);
 
-//var_dump($user->first());
+//var_dump($user->entities->first());
 
 //request that throw exception in this case 404 not found
 try {
@@ -103,12 +105,12 @@ foreach ($user_iterator as $iUser) {
 // create new user
 $new_user = ['name' => 'jasonk', 'username' => 'JasonK', 'email' => 'jason@example.com',
'password' => 'some_password'];
 //$created_user = $usergrid->users()->create($new_user);
-//var_dump($created_user);
+//var_dump($created_user->entities);
 
 //Update Users by name or uuid
 $new_email = ['email' => 'jason@example', 'entity_name_or_uuid' => 'benn'];
 $updated_user = $usergrid->users()->update($new_email);
-//var_dump($updated_user);
+//var_dump($updated_user->entities);
 
 // delete a user
 //$deleted_user = $usergrid->users()->delete(['entity_name_or_uuid' => 'benn']);
@@ -116,7 +118,7 @@ $updated_user = $usergrid->users()->update($new_email);
 
 //get custom collection
 $custom_collection = $usergrid->application()->EntityGet(['collection' => 'shops']);
-//var_dump($custom_collection->get('entities'));
+//var_dump($custom_collection->entities->get('name'));
 
 //get custom collection with query
 $custom_collection_query = $usergrid->application()->EntityGet([
@@ -133,7 +135,7 @@ $custom_entity = [
     'type' => 'pet_shop'
 ];
 //$created_entity = $usergrid->application()->EntityJsonPost($custom_entity);
-//var_dump($created_entity);
+//var_dump($created_entity->entities);
 
 // update custom Entity
 $custom_entity_edit = [
@@ -169,16 +171,16 @@ $fNew_user = [
     'password' => 'some_password'
 ];
 $fCreated_user = Usergrid::users()->create($fNew_user);
-//var_dump($fCreated_user);
+//var_dump($fCreated_user->entities);
 
 //Update Users by name or uuid
 $fNew_email = ['email' => 'jason@example', 'entity_name_or_uuid' => 'benn'];
 $fUpdated_user = Usergrid::users()->update($fNew_email);
-//var_dump($fUpdated_user);
+//var_dump($fUpdated_user->entities);
 
 // delete a user
 $fDeleted_user = Usergrid::users()->delete(['entity_name_or_uuid' => 'benn']);
-//var_dump($fDeleted_user);
+//var_dump($fDeleted_user->entities);
 
 //get custom collection
 $fCustom_collection = Usergrid::application()->EntityGet(['collection' => 'shops']);
@@ -189,7 +191,7 @@ $fCustom_collection_query = Usergrid::application()->EntityGet([
     'collection' => 'shops',
     'ql' => "select * where country='aus'"
 ]);
-//var_dump($custom_collection_query->get('entities'));
+//var_dump($custom_collection_query->get('name'));
 
 // Post custom collection as JSON data
 $fCustom_entity = [
@@ -199,7 +201,7 @@ $fCustom_entity = [
     'type' => 'pet_shop'
 ];
 $fCreated_entity = Usergrid::applictions()->EntityJsonPost($custom_entity);
-//var_dump($fCreated_entity);
+//var_dump($fCreated_entity->entities);
 
 // update entity
 $fCustom_entity_edit = [
@@ -208,7 +210,7 @@ $fCustom_entity_edit = [
     ['adr' => ['street' => '3 main st', 'location' => 'act', 'post_code' => '3323']]
 ];
 $fEdited_entity = Usergrid::applications()->EntityPut($fCustom_entity_edit);
-//var_dump($fEdited_entity);
+//var_dump($fEdited_entity->entities);
 
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b86966ed/sdks/php5/apache-usergrid/Examples/management/management.php
----------------------------------------------------------------------
diff --git a/sdks/php5/apache-usergrid/Examples/management/management.php b/sdks/php5/apache-usergrid/Examples/management/management.php
new file mode 100644
index 0000000..5808a6c
--- /dev/null
+++ b/sdks/php5/apache-usergrid/Examples/management/management.php
@@ -0,0 +1,91 @@
+<?php
+/**
+ * Copyright 2010-2014 baas-platform.com, Pty Ltd. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * or in the "license" file accompanying this file. This file is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+include('vendor/autoload.php');
+
+
+use Apache\Usergrid\Native\UsergridBootstrapper;
+use Apache\Usergrid\Native\Facades\Usergrid;
+
+/**
+ * When working with the management api any calls that require a application to target will
use the default app name set in the config but some times you may want to
+ * make a api call to a different application which is possible when the url requires a application
name it taken from the config but if you pass in a different application
+ * name in the method arguments it will override the default application name just for that
api call so If I wanted to add a user to two application I could make the same call
+ * twice but pass in a application name only for the 2nd call.
+ */
+
+/** Source your config from file I'm using array here just for ease of use.
+ * When using Laravel Framework publish the package config file when using with
+ * other modern PHP frameworks just use their default config system .
+ */
+$config = [
+    'usergrid' => [
+        'url' => 'https://api.usergrid.com',
+        'version' => '1.0.1', // set manifest version
+        'orgName' => '',
+        'appName' => '',
+        'manifestPath' => null, //leave as default or change to your own custom folder
+        'clientId' => '',
+        'clientSecret' => '',
+        'username' => '',
+        'password' => '',
+        /**
+         * The Auth Type setting is the Oauth 2 end point you want to get the OAuth 2
+         * Token from.  You have two options here one is 'application' the other is 'organization'
+         *
+         *  organization will get the the token from http://example.com/management using
 client_credentials or password grant type
+         *  application will get the token from http://example.com/managment/org_name/app_name
using client_credentials or password grant type
+         */
+        'auth_type' => 'organization',
+        /** The Grant Type to use
+         *
+         * This has to be set to one of the 2 grant types that Apache Usergrid
+         * supports which at the moment is client_credentials or password but at
+         * 2 level organization or application
+         */
+        'grant_type' => 'client_credentials',
+        /**
+         * if you want to manage your own auth flow by calling the token api and setting
the token your self just set this to false
+         * */
+        'enable_oauth2_plugin' => true
+    ]
+];
+
+$bootstrapper = new UsergridBootstrapper($config);
+Usergrid::instance($bootstrapper);
+
+
+// Get organization activity
+$activity_feed = Usergrid::management()->OrgFeedGet();
+
+// get org details
+$organization_details = Usergrid::management()->OrgGet();
+
+//get organizations application
+$organization_applications  = Usergrid::management()->OrgAppsGet();
+
+//create application
+$app = ['name' => 'app name -- required'];
+$new_application = Usergrid::management()->OrgAppsJsonPost($app);
+
+// delete application
+$deleted_application = Usergrid::management()->OrgAppDelete($app);
+
+//get irg admin users
+$organization_admin_users = Usergrid::management()->OrgUsersGet();
+
+/** There are many more api calls just look at the management manifest file to get the method
name's and arguments to pass .
+ * The management manifest file is a copy of the swagger file for usergrid so you can also
run the swagger UI tool on your usergrid install as well.
+ */
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b86966ed/sdks/php5/apache-usergrid/Examples/messages/data.php
----------------------------------------------------------------------
diff --git a/sdks/php5/apache-usergrid/Examples/messages/data.php b/sdks/php5/apache-usergrid/Examples/messages/data.php
new file mode 100644
index 0000000..5d00ec4
--- /dev/null
+++ b/sdks/php5/apache-usergrid/Examples/messages/data.php
@@ -0,0 +1,17 @@
+<?php
+/**
+ * Copyright 2010-2014 baas-platform.com, Pty Ltd. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * or in the "license" file accompanying this file. This file is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+$message = [];
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b86966ed/sdks/php5/apache-usergrid/Examples/messages/messages.php
----------------------------------------------------------------------
diff --git a/sdks/php5/apache-usergrid/Examples/messages/messages.php b/sdks/php5/apache-usergrid/Examples/messages/messages.php
new file mode 100644
index 0000000..3cac534
--- /dev/null
+++ b/sdks/php5/apache-usergrid/Examples/messages/messages.php
@@ -0,0 +1,62 @@
+<?php
+/**
+ * Copyright 2010-2014 baas-platform.com, Pty Ltd. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * or in the "license" file accompanying this file. This file is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+include('vendor/autoload.php');
+
+include('data.php');
+
+use Apache\Usergrid\Native\UsergridBootstrapper;
+use Apache\Usergrid\Native\Facades\Usergrid;
+
+
+/** Source your config from file I'm using array here just for ease of use.
+ * When using Laravel Framework publish the package config file when using with
+ * other modern PHP frameworks just use their default config system .
+ */
+$config = [
+    'usergrid' => [
+        'url' => 'https://api.usergrid.com',
+        'version' => '1.0.1', // set manifest version
+        'orgName' => '',
+        'appName' => '',
+        'manifestPath' => null, //leave as default or change to your own custom folder
+        'clientId' => '',
+        'clientSecret' => '',
+        'username' => '',
+        'password' => '',
+        /**
+         * The Auth Type setting is the Oauth 2 end point you want to get the OAuth 2
+         * Token from.  You have two options here one is 'application' the other is 'organization'
+         *
+         *  organization will get the the token from http://example.com/management using
 client_credentials or password grant type
+         *  application will get the token from http://example.com/managment/org_name/app_name
using client_credentials or password grant type
+         */
+        'auth_type' => 'organization',
+        /** The Grant Type to use
+         *
+         * This has to be set to one of the 2 grant types that Apache Usergrid
+         * supports which at the moment is client_credentials or password but at
+         * 2 level organization or application
+         */
+        'grant_type' => 'client_credentials',
+        /**
+         * if you want to manage your own auth flow by calling the token api and setting
the token your self just set this to false
+         * */
+        'enable_oauth2_plugin' => true
+    ]
+];
+
+$bootstrapper = new UsergridBootstrapper($config);
+Usergrid::instance($bootstrapper);

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b86966ed/sdks/php5/apache-usergrid/Examples/notifications/data.php
----------------------------------------------------------------------
diff --git a/sdks/php5/apache-usergrid/Examples/notifications/data.php b/sdks/php5/apache-usergrid/Examples/notifications/data.php
new file mode 100644
index 0000000..0efdf85
--- /dev/null
+++ b/sdks/php5/apache-usergrid/Examples/notifications/data.php
@@ -0,0 +1,17 @@
+<?php
+/**
+ * Copyright 2010-2014 baas-platform.com, Pty Ltd. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * or in the "license" file accompanying this file. This file is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+$notification = [];
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b86966ed/sdks/php5/apache-usergrid/Examples/notifications/notifications.php
----------------------------------------------------------------------
diff --git a/sdks/php5/apache-usergrid/Examples/notifications/notifications.php b/sdks/php5/apache-usergrid/Examples/notifications/notifications.php
new file mode 100644
index 0000000..3cac534
--- /dev/null
+++ b/sdks/php5/apache-usergrid/Examples/notifications/notifications.php
@@ -0,0 +1,62 @@
+<?php
+/**
+ * Copyright 2010-2014 baas-platform.com, Pty Ltd. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * or in the "license" file accompanying this file. This file is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+include('vendor/autoload.php');
+
+include('data.php');
+
+use Apache\Usergrid\Native\UsergridBootstrapper;
+use Apache\Usergrid\Native\Facades\Usergrid;
+
+
+/** Source your config from file I'm using array here just for ease of use.
+ * When using Laravel Framework publish the package config file when using with
+ * other modern PHP frameworks just use their default config system .
+ */
+$config = [
+    'usergrid' => [
+        'url' => 'https://api.usergrid.com',
+        'version' => '1.0.1', // set manifest version
+        'orgName' => '',
+        'appName' => '',
+        'manifestPath' => null, //leave as default or change to your own custom folder
+        'clientId' => '',
+        'clientSecret' => '',
+        'username' => '',
+        'password' => '',
+        /**
+         * The Auth Type setting is the Oauth 2 end point you want to get the OAuth 2
+         * Token from.  You have two options here one is 'application' the other is 'organization'
+         *
+         *  organization will get the the token from http://example.com/management using
 client_credentials or password grant type
+         *  application will get the token from http://example.com/managment/org_name/app_name
using client_credentials or password grant type
+         */
+        'auth_type' => 'organization',
+        /** The Grant Type to use
+         *
+         * This has to be set to one of the 2 grant types that Apache Usergrid
+         * supports which at the moment is client_credentials or password but at
+         * 2 level organization or application
+         */
+        'grant_type' => 'client_credentials',
+        /**
+         * if you want to manage your own auth flow by calling the token api and setting
the token your self just set this to false
+         * */
+        'enable_oauth2_plugin' => true
+    ]
+];
+
+$bootstrapper = new UsergridBootstrapper($config);
+Usergrid::instance($bootstrapper);

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b86966ed/sdks/php5/apache-usergrid/README.md
----------------------------------------------------------------------
diff --git a/sdks/php5/apache-usergrid/README.md b/sdks/php5/apache-usergrid/README.md
index 61e8869..eb4c730 100644
--- a/sdks/php5/apache-usergrid/README.md
+++ b/sdks/php5/apache-usergrid/README.md
@@ -3,6 +3,7 @@
 This a Guzzle Web Service Client and Service Descriptor to work with the Apache Usergrid
Management and Application API . 
 
 ## Getting Started ##
+
 install as composer package by adding this to your composer.json file.
 
 ``` 
@@ -23,9 +24,10 @@ import the classes ``` include autoload.php ``` then create a new instance
of th
 For native use just create a config file.
 
 ```
-use Apache\Usergrid\UsergridBootstrapper;
+    use Apache\Usergrid\UsergridBootstrapper;
 
-    $config = [    'usergrid' => [
+    $config = [    
+    'usergrid' => [
                        'url' => 'https://api.usergrid.com',
                        'version' => '1.0.0',
                        'orgName' => '',
@@ -53,7 +55,8 @@ use Apache\Usergrid\UsergridBootstrapper;
                         * if you want to manage your own auth flow by calling the token api
and setting the token your self just set this to false
                         * */
                        'enable_oauth2_plugin' => true
-                   ]];
+                   ]
+             ];
                    
                    $bootstrap = new UsergridBootstrapper($config);
                    $usergrid = $bootstrap->createUsergrid();
@@ -64,16 +67,16 @@ use Apache\Usergrid\UsergridBootstrapper;
 Or if you like Static Facades
 
 ```
-use Apache\Usergrid\Native\Facades\Usergrid;
-
-$bootstrap = new UsergridBootstrapper($config);
-Usergrid::instance($boostraper);
-$res = Usergrid::application()->EntityGet(['collection' => 'shops']);
+    use Apache\Usergrid\Native\Facades\Usergrid;
+    $bootstrap = new UsergridBootstrapper($config);
+    Usergrid::instance($boostraper);
+    $res = Usergrid::application()->EntityGet(['collection' => 'shops']);
 
 ```
 
 
 ### Laravel ###
+
 In Laravel once you have install the composer package you then publish the config file like
```php artisan config:publish apache/usergrid ``` which will publish the config file to the
app/config/packages/apache/usergrid/config.php 
 then add your client_id and secret to the config file the set the service provider in the
app/config.php providers array ```Apache\Usergrid\Laravel\ApacheUsergridServiceProvider```
and add the alias to
 the aliases array ```'Usergrid' => 'Apache\Usergrid\Laravel\Facades\Usergrid``` to be
able to access class via a Facade. Example for Laravel
@@ -92,11 +95,14 @@ the aliases array ```'Usergrid' => 'Apache\Usergrid\Laravel\Facades\Usergrid```
  and they are cached by the Usergrid web service client. Calls on the Usergrid client are
like magic method in the sense that ```php Usergrid::Management()-> method``` call is not
  backed by a Management class or method its the Manifest that it being selected . Also by
using Facades all method are like static method and fit in with newer PHP frameworks just
like using the
  AWS PHP SDK when calling enableFacades() on the AWS factory method.
-  
+ 
  All responses are subclasses of Illuminate\Support\Collection class so all collection methods
are available to call on your response model eg: first(), get(), map(), fetch(), hasKey(),
hasValue(), etc.
  this is not to mistake this with a Usergrid collection which is like your DB table they
too are collection object but if you get a response of a single entiry then its a Collection
with a count of 1.
-  
+ 
+ 
+ 
 ### Error Handling ### 
+
 All HTTP and Server error returned by the Usergrid API have error classes attached to the
services descriptors so to handle error's that you want too, Just catch the correct exception
eg. resource not found.
 
 ```
@@ -109,13 +115,14 @@ try {
 ```
  
 ### Authentication ###
+
   You can manage your own Oauth 2 flow by setting the enable_oauth2_plugin config setting
to false then you need to call the Token api or get the token from elsewhere and then set
the token on the usergrid instance.
   By default this will manage Oauth2 flow for you and I recommend that you leave it set to
true. But if you want to do it yourself set the config setting to false and then do something
like this.
   
 ```
  $res  =  Usergrid::management()->authPasswordGet($array);
  $token = $res->get('access_token');
- Usergrid::setToken($token);
+ Usergrid::setToken($token)->users()->findById(['uuid' => '1234']);
  
 ```
  
@@ -147,19 +154,23 @@ foreach($allDevices as $device) {
 // this will have all devices. 
 }
 ```
-
 ### HTTP headers and UserAgents ###
+
  When working with http clients & server system you may want to sett additional HTTP
Headers. Ive have made this easy as well on the Usergrid class you 
  can set any http headers or access token or user agent when calling the set method it will
append new headers or replace headers already set so if you 
  have some customer analytics set up on your version of usergrid server then just pass the
headers you like in a fluent way eg:
  ``` Usergrid::setHeaders(['BAAS-PLATFORM-ANALYTICS' => 'user001'])->users()->findById(['uuid'
=> '12343']); ```
  
+
+
 ## Manifest Files (Guzzle & Swagger  Service Descriptors) ## 
+
 All the files in the manifest folder are just temp file the final Service Descriptors are
versioned so
 the real files are in the manifest/1.0.0 folder so as usergrid is updated new versions can
be added like 1.1.0 etc.
 Ill leave the other manifest file there for now but will cleanup when Apache Usergrid accepts
this library.
 
 ## designs guidelines ##
+
 The design of this is to make it easy to add to existing project and be able to map Model
objects in your project 
 to response models for example in my project I have a organization object that is saved in
a mysql database and I can
 call a Usergrid Api call on that model object just like using the Usergrid api class eg:
@@ -167,8 +178,12 @@ call a Usergrid Api call on that model object just like using the Usergrid
api c
 ``` Organization::put($data_array) ``` how to do this is beyond the scope of the SDK but
its not hard to create 
 Gateway Objects using php Traits
 
+## PHPUnit Tests ##
+Some unit tests require a internet connection and a usergrid install so they have been marked
with a phpunit @group annotation so to run the tests without a usergrid install just pass
the ```--exclude-group internet``` as a option on the command line or IDE setting
+that will exclude the few tests that require access to usergrid which I've limited to only
a few unit tests like testing if it can get a oauth2 access_token. 
 
 ## Javascript ##
+
 There is a javascript api to go with this for example I have a site that uses the javascript
sdk to login to Apache Usergrid then it send the token server side 
 to be used in api calls on behalf of the logged in user. You can find this javascript sdk
in my public git repo it requires one extra config setting and then you include
 the javascript file in your page  It's set to works with Laravel as it posts the token to
a route but it would not be hard to use else where just create uri it can post the token too.
Its not part of this SDK so think
@@ -180,4 +195,4 @@ of it as a helper as some times it good to have access to both world server
side
 * Writing tests
 * Code review
 * Code
-* Manifest files
+* Manifest files
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b86966ed/sdks/php5/apache-usergrid/src/Manifests/1.0.1/Messages.php
----------------------------------------------------------------------
diff --git a/sdks/php5/apache-usergrid/src/Manifests/1.0.1/Messages.php b/sdks/php5/apache-usergrid/src/Manifests/1.0.1/Messages.php
new file mode 100644
index 0000000..638ad24
--- /dev/null
+++ b/sdks/php5/apache-usergrid/src/Manifests/1.0.1/Messages.php
@@ -0,0 +1,19 @@
+<?php
+/**
+ * Copyright 2010-2014 baas-platform.com, Pty Ltd. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * or in the "license" file accompanying this file. This file is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+return [
+
+];
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b86966ed/sdks/php5/apache-usergrid/src/Manifests/1.0.1/Notification.php
----------------------------------------------------------------------
diff --git a/sdks/php5/apache-usergrid/src/Manifests/1.0.1/Notification.php b/sdks/php5/apache-usergrid/src/Manifests/1.0.1/Notification.php
deleted file mode 100644
index 7f65626..0000000
--- a/sdks/php5/apache-usergrid/src/Manifests/1.0.1/Notification.php
+++ /dev/null
@@ -1,154 +0,0 @@
-<?php
-/**
- * Copyright 2010-2014 baas-platform.com, Pty Ltd. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-return [
-    'ToGroup' => [
-        'httpMethod' => 'POST',
-        'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/groups/{group}/notifications',
-        'notes' => 'Create Notification for group.  See Usergrid documentation for JSON
format of body.',
-        'summary' => 'Create new app notification',
-        'responseClass' => '',
-        'responseType' => 'model',
-        'errorResponses' => $errors,
-        'parameters' => [
-            'access_token' => [
-                'description' => 'The OAuth2 access token',
-                'location' => 'query',
-                'type' => 'string',
-                'required' => false,
-            ],
-            'app_name_or_uuid' => [
-                'description' => 'app name or uuid',
-                'location' => 'uri',
-                'type' => 'string',
-                'required' => true,
-            ],
-            'org_name_or_uuid' => [
-                'location' => 'uri',
-                'type' => 'string',
-                'required' => true,
-                'description' => 'Organization name or uuid'
-            ],
-            'group' => [
-                'description' => 'group name',
-                'location' => 'uri',
-                'type' => 'string',
-                'required' => true,
-            ],
-
-        ]
-    ],
-    'ToDevice' => [
-        'httpMethod' => 'POST',
-        'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/devices/{device_uuid}/notifications',
-        'notes' => 'Create Notification for single Device.  See Usergrid documentation
for JSON format of body.',
-        'summary' => 'Create new app notification',
-        'responseClass' => '',
-        'responseType' => 'model',
-        'errorResponses' => $errors,
-        'parameters' => [
-            'access_token' => [
-                'description' => 'The OAuth2 access token',
-                'location' => 'query',
-                'type' => 'string',
-                'required' => false,
-            ],
-            'app_name_or_uuid' => [
-                'description' => 'app name or uuid',
-                'location' => 'uri',
-                'type' => 'string',
-                'required' => true,
-            ],
-            'org_name_or_uuid' => [
-                'location' => 'uri',
-                'type' => 'string',
-                'required' => true,
-                'description' => 'Organization name or uuid'
-            ],
-            'device_uuid' => [
-                'location' => 'uri',
-                'type' => 'string',
-                'required' => true,
-                'description' => 'device name or uuid'
-            ],
-
-        ]
-    ],
-    'ToDevices' => [
-        'httpMethod' => 'POST',
-        'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/devices/*/notifications',
-        'notes' => 'Create Notification all Devices.  See Usergrid documentation for JSON
format of body.',
-        'summary' => 'Create new app notification',
-        'responseClass' => '',
-        'responseType' => 'model',
-        'errorResponses' => $errors,
-        'parameters' => [
-            'access_token' => [
-                'description' => 'The OAuth2 access token',
-                'location' => 'query',
-                'type' => 'string',
-                'required' => false,
-            ],
-            'app_name_or_uuid' => [
-                'description' => 'app name or uuid',
-                'location' => 'uri',
-                'type' => 'string',
-                'required' => true,
-            ],
-            'org_name_or_uuid' => [
-                'location' => 'uri',
-                'type' => 'string',
-                'required' => true,
-                'description' => 'Organization name or uuid'
-            ]
-        ]
-    ],
-    'ToUser' => [
-        'httpMethod' => 'POST',
-        'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/users/{user_name}/notifications',
-        'notes' => 'Create Notification single User.  See Usergrid documentation for JSON
format of body.',
-        'summary' => 'Create new app notification',
-        'responseClass' => '',
-        'responseType' => 'model',
-        'errorResponses' => $errors,
-        'parameters' => [
-            'access_token' => [
-                'description' => 'The OAuth2 access token',
-                'location' => 'query',
-                'type' => 'string',
-                'required' => false,
-            ],
-            'app_name_or_uuid' => [
-                'description' => 'app name or uuid',
-                'location' => 'uri',
-                'type' => 'string',
-                'required' => true,
-            ],
-            'org_name_or_uuid' => [
-                'location' => 'uri',
-                'type' => 'string',
-                'required' => true,
-                'description' => 'Organization name or uuid'
-            ],
-            'user_name' => [
-                'location' => 'uri',
-                'type' => 'string',
-                'required' => true,
-                'description' => 'User name or uuid'
-            ],
-        ]
-    ]
-];
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b86966ed/sdks/php5/apache-usergrid/src/Manifests/1.0.1/Notifications.php
----------------------------------------------------------------------
diff --git a/sdks/php5/apache-usergrid/src/Manifests/1.0.1/Notifications.php b/sdks/php5/apache-usergrid/src/Manifests/1.0.1/Notifications.php
index a51055f..18c754d 100644
--- a/sdks/php5/apache-usergrid/src/Manifests/1.0.1/Notifications.php
+++ b/sdks/php5/apache-usergrid/src/Manifests/1.0.1/Notifications.php
@@ -15,10 +15,169 @@
  */
 
 return [
+    'ToGroup' => [
+        'httpMethod' => 'POST',
+        'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/groups/{group}/notifications',
+        'notes' => 'Create Notification for group.  See Usergrid documentation for JSON
format of body.',
+        'summary' => 'Create new app notification',
+        'responseClass' => '',
+        'responseType' => 'model',
+        'errorResponses' => $errors,
+        'parameters' => [
+            'access_token' => [
+                'description' => 'The OAuth2 access token',
+                'location' => 'query',
+                'type' => 'string',
+                'required' => false,
+            ],
+            'app_name_or_uuid' => [
+                'description' => 'app name or uuid',
+                'location' => 'uri',
+                'type' => 'string',
+                'required' => true,
+            ],
+            'org_name_or_uuid' => [
+                'location' => 'uri',
+                'type' => 'string',
+                'required' => true,
+                'description' => 'Organization name or uuid'
+            ],
+            'group' => [
+                'description' => 'group name',
+                'location' => 'uri',
+                'type' => 'string',
+                'required' => true,
+            ],
 
-    'all' => [],
-    'find' => [],
-    'create' => [],
-    'destroy' => [],
-    'update' => []
+        ]
+    ],
+    'ToGroups' => [
+        'httpMethod' => 'POST',
+        'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/groups/*/notifications',
+        'notes' => 'Create Notification for group.  See Usergrid documentation for JSON
format of body.',
+        'summary' => 'Create new app notification',
+        'responseClass' => '',
+        'responseType' => 'model',
+        'errorResponses' => $errors,
+        'parameters' => [
+            'access_token' => [
+                'description' => 'The OAuth2 access token',
+                'location' => 'query',
+                'type' => 'string',
+                'required' => false,
+            ],
+            'app_name_or_uuid' => [
+                'description' => 'app name or uuid',
+                'location' => 'uri',
+                'type' => 'string',
+                'required' => true,
+            ],
+            'org_name_or_uuid' => [
+                'location' => 'uri',
+                'type' => 'string',
+                'required' => true,
+                'description' => 'Organization name or uuid'
+            ],
+        ]
+    ],
+    'ToDevice' => [
+        'httpMethod' => 'POST',
+        'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/devices/{device_uuid}/notifications',
+        'notes' => 'Create Notification for single Device.  See Usergrid documentation
for JSON format of body.',
+        'summary' => 'Create new app notification',
+        'responseClass' => '',
+        'responseType' => 'model',
+        'errorResponses' => $errors,
+        'parameters' => [
+            'access_token' => [
+                'description' => 'The OAuth2 access token',
+                'location' => 'query',
+                'type' => 'string',
+                'required' => false,
+            ],
+            'app_name_or_uuid' => [
+                'description' => 'app name or uuid',
+                'location' => 'uri',
+                'type' => 'string',
+                'required' => true,
+            ],
+            'org_name_or_uuid' => [
+                'location' => 'uri',
+                'type' => 'string',
+                'required' => true,
+                'description' => 'Organization name or uuid'
+            ],
+            'device_uuid' => [
+                'location' => 'uri',
+                'type' => 'string',
+                'required' => true,
+                'description' => 'device name or uuid'
+            ],
+
+        ]
+    ],
+    'ToDevices' => [
+        'httpMethod' => 'POST',
+        'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/devices/*/notifications',
+        'notes' => 'Create Notification all Devices.  See Usergrid documentation for JSON
format of body.',
+        'summary' => 'Create new app notification',
+        'responseClass' => '',
+        'responseType' => 'model',
+        'errorResponses' => $errors,
+        'parameters' => [
+            'access_token' => [
+                'description' => 'The OAuth2 access token',
+                'location' => 'query',
+                'type' => 'string',
+                'required' => false,
+            ],
+            'app_name_or_uuid' => [
+                'description' => 'app name or uuid',
+                'location' => 'uri',
+                'type' => 'string',
+                'required' => true,
+            ],
+            'org_name_or_uuid' => [
+                'location' => 'uri',
+                'type' => 'string',
+                'required' => true,
+                'description' => 'Organization name or uuid'
+            ]
+        ]
+    ],
+    'ToUser' => [
+        'httpMethod' => 'POST',
+        'uri' => '/{org_name_or_uuid}/{app_name_or_uuid}/users/{user_name}/notifications',
+        'notes' => 'Create Notification single User.  See Usergrid documentation for JSON
format of body.',
+        'summary' => 'Create new app notification',
+        'responseClass' => '',
+        'responseType' => 'model',
+        'errorResponses' => $errors,
+        'parameters' => [
+            'access_token' => [
+                'description' => 'The OAuth2 access token',
+                'location' => 'query',
+                'type' => 'string',
+                'required' => false,
+            ],
+            'app_name_or_uuid' => [
+                'description' => 'app name or uuid',
+                'location' => 'uri',
+                'type' => 'string',
+                'required' => true,
+            ],
+            'org_name_or_uuid' => [
+                'location' => 'uri',
+                'type' => 'string',
+                'required' => true,
+                'description' => 'Organization name or uuid'
+            ],
+            'user_name' => [
+                'location' => 'uri',
+                'type' => 'string',
+                'required' => true,
+                'description' => 'User name or uuid'
+            ],
+        ]
+    ]
 ];
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b86966ed/sdks/php5/apache-usergrid/tests/Api/UsergridTest.php
----------------------------------------------------------------------
diff --git a/sdks/php5/apache-usergrid/tests/Api/UsergridTest.php b/sdks/php5/apache-usergrid/tests/Api/UsergridTest.php
index 5fab892..ab68633 100644
--- a/sdks/php5/apache-usergrid/tests/Api/UsergridTest.php
+++ b/sdks/php5/apache-usergrid/tests/Api/UsergridTest.php
@@ -95,7 +95,7 @@ class UsergridTest extends PHPUnit_Framework_TestCase
     public function it_can_retrieve_the_manifest_path()
     {
 
-        $this->assertEquals('/Users/admin/PhpstormProjects/Apache-Usergrid/src/Manifests',
$this->usergrid->getManifestPath());
+        $this->assertEquals('./src/Manifests', $this->usergrid->getManifestPath());
     }
 
     /** @test */

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b86966ed/sdks/php5/apache-usergrid/tests/Api/test_config.php
----------------------------------------------------------------------
diff --git a/sdks/php5/apache-usergrid/tests/Api/test_config.php b/sdks/php5/apache-usergrid/tests/Api/test_config.php
index da46e40..0959405 100644
--- a/sdks/php5/apache-usergrid/tests/Api/test_config.php
+++ b/sdks/php5/apache-usergrid/tests/Api/test_config.php
@@ -20,13 +20,13 @@ return [
 
         'url' => 'https://api.usergrid.com',
 
-        'version' => '1.0.1',
+        'version' => '1.0.0',
 
         'orgName' => "",
 
         'appName' => "",
 
-        'manifestPath' => null,
+        'manifestPath' => './src/Manifests',
 
         //its better not to set the real values here if using laravel set them in a .env
file or
         // if your not using Laravel set them as environment variable and include them here
using $_ENV global.
@@ -62,4 +62,4 @@ return [
          * */
         'enable_oauth2_plugin' => true
     ]
-];
+];
\ No newline at end of file


Mime
View raw message