Permalink
Browse files

updated to the version 0.9.10 of SDK

  • Loading branch information...
rodsimpson committed Dec 8, 2012
1 parent 190cbdf commit 7d5937f14a7ed681c25c51b538bc1d48c1b1d00a
View
@@ -8,8 +8,10 @@
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script>
<script src="js/app.js" type="text/javascript"></script>
- <script src="js/usergrid.appSDK.js" type="text/javascript"></script>
- <script src="js/usergrid.session.js" type="text/javascript"></script>
+ <script src="js/usergrid.SDK.js" type="text/javascript"></script>
+ <script src="js/extensions/usergrid.session.js" type="text/javascript"></script>
+ <script src="js/extensions/usergrid.entity-collection.js" type="text/javascript"></script>
+ <script src="js/extensions/usergrid.curl.js" type="text/javascript"></script>
<script type="text/javascript">
try {
// first, set the org and app path.
View
@@ -289,7 +289,7 @@ $(document).ready(function () {
fullActivityFeed.clearQuery();
//get the users feed
- userFeed.get(
+ userFeed.fetch(
function(){
drawMessages(userFeed);
if (userFeed.hasPreviousPage()) {
@@ -340,7 +340,7 @@ $(document).ready(function () {
$('#btn-show-full-feed').addClass('ui-btn-up-c');
$('#btn-show-my-feed').removeClass('ui-btn-up-c');
- fullActivityFeed.get(
+ fullActivityFeed.fetch(
function(){
drawMessages(fullActivityFeed);
if (fullActivityFeed.hasPreviousPage()) {
@@ -494,7 +494,8 @@ $(document).ready(function () {
"url" : "http://www.gravatar.com/avatar/",
"width" : 80
},
- "email" : appUser.get('email')
+ "email" : appUser.get('email'),
+ "picture": "fred"
},
"verb" : "post",
"content" : content,
@@ -0,0 +1,64 @@
+
+Usergrid.Curl = (function () {
+ function buildCurlCall(Query, endpoint) {
+ var curl = 'curl';
+ try {
+ //peel the data out of the query object
+ var method = Query.getMethod().toUpperCase();
+ var path = Query.getResource();
+ var jsonObj = Query.getJsonObj() || {};
+ var params = Query.getQueryParams() || {};
+
+ //curl - add the method to the command (no need to add anything for GET)
+ if (method == "POST") {curl += " -X POST"; }
+ else if (method == "PUT") { curl += " -X PUT"; }
+ else if (method == "DELETE") { curl += " -X DELETE"; }
+ else { curl += " -X GET"; }
+
+ //curl - append the bearer token if this is not the sandbox app
+ var application_name = Usergrid.ApiClient.getApplicationName();
+ if (application_name) {
+ application_name = application_name.toUpperCase();
+ }
+ if ( ((application_name != 'SANDBOX' && Usergrid.ApiClient.getToken()) || (Usergrid.ApiClient.getQueryType() == Usergrid.M && Usergrid.ApiClient.getToken())) ) {
+ curl += ' -i -H "Authorization: Bearer ' + Usergrid.ApiClient.getToken() + '"';
+ Query.setToken(true);
+ }
+
+ path = '/' + endpoint + '/' + path;
+
+ //make sure path never has more than one / together
+ if (path) {
+ //regex to strip multiple slashes
+ while(path.indexOf('//') != -1){
+ path = path.replace('//', '/');
+ }
+ }
+
+ //curl - append the path
+ curl += ' "' + Usergrid.ApiClient.getApiUrl()+path;
+
+ //curl - append params to the path for curl prior to adding the timestamp
+ var curl_encoded_params = Usergrid.ApiClient.encodeParams(params);
+ if (curl_encoded_params) {
+ curl += "?" + curl_encoded_params;
+ }
+ curl += '"';
+
+ jsonObj = JSON.stringify(jsonObj)
+ if (jsonObj && jsonObj != '{}') {
+ //curl - add in the json obj
+ curl += " -d '" + jsonObj + "'";
+ }
+
+ } catch(e) {
+ console.log('Unable to build curl call:' + e);
+ }
+
+ return curl;
+ }
+
+ return {
+ buildCurlCall:buildCurlCall,
+ }
+})();

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 7d5937f

Please sign in to comment.