Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Converted oauth to new gallery modules

  • Loading branch information...
commit c39f2de0a505b4f0f63ad6bc483fa8ac6484d65a 1 parent 689590d
Dav Glass authored
236 build/gallery-oauth/gallery-oauth-coverage.js
View
@@ -0,0 +1,236 @@
+if (typeof _yuitest_coverage == "undefined"){
+ _yuitest_coverage = {};
+ _yuitest_coverline = function(src, line){
+ var coverage = _yuitest_coverage[src];
+ if (!coverage.lines[line]){
+ coverage.calledLines++;
+ }
+ coverage.lines[line]++;
+ };
+ _yuitest_coverfunc = function(src, name, line){
+ var coverage = _yuitest_coverage[src],
+ funcId = name + ":" + line;
+ if (!coverage.functions[funcId]){
+ coverage.calledFunctions++;
+ }
+ coverage.functions[funcId]++;
+ };
+}
+_yuitest_coverage["build/gallery-oauth/gallery-oauth.js"] = {
+ lines: {},
+ functions: {},
+ coveredLines: 0,
+ calledLines: 0,
+ coveredFunctions: 0,
+ calledFunctions: 0,
+ path: "build/gallery-oauth/gallery-oauth.js",
+ code: []
+};
+_yuitest_coverage["build/gallery-oauth/gallery-oauth.js"].code=["YUI.add('gallery-oauth', function (Y, NAME) {",""," /**"," * This module pulls in the oAuth code from googlecode and adds a couple of helper methods"," * to sign a url for standard 2-Legged oAuth"," */"," var BASE = 'http://oauth.googlecode.com/svn/code/javascript/',"," FILES = [ 'oauth', 'sha1' ], LOADED = 0;",""," if (!YUI.Env.oauthLoaded) {"," Y.each(FILES, function(v) {"," var url = BASE + v + '.js';"," Y.Get.script(url, {"," onSuccess: function() {"," LOADED++;"," if (LOADED === FILES.length) {"," YUI.Env.oauthLoaded = true;"," Y.oAuth.fire();"," }"," }"," });"," });"," }",""," Y.namespace('oAuth');",""," Y.oAuth = {"," fire: function() {"," Y.each(Y.oAuth._items, function(fn, k) {"," fn();"," delete Y.oAuth._items[k];"," });"," },"," ready: function(fn) {"," if (YUI.Env.oauthLoaded) {"," fn();"," } else {"," Y.oAuth._items.push(fn);"," }"," },"," _items: [],"," signURL: function(key, secret, url) {"," var accessor = {"," consumerSecret: secret,"," tokenSecret: \"\""," },"," finalStr = '',"," baseStr = \"\","," parameterMap = \"\","," theSig = \"\","," locString = \"\","," item, subitem, paramList,"," message = {"," action: url,"," method: \"GET\","," parameters: ["," [ 'oauth_version', '1.0' ],"," [ 'oauth_consumer_key', key ]"," ]"," };"," "," OAuth.setTimestampAndNonce(message);"," OAuth.SignatureMethod.sign(message, accessor);"," "," parameterMap = OAuth.getParameterMap(message);"," baseStr = OAuth.decodeForm(OAuth.SignatureMethod.getBaseString(message)); "," "," if (parameterMap.parameters) {"," Y.each(parameterMap.parameters, function(item) {"," Y.each(item, function(subitem) {"," if (subitem == \"oauth_signature\") {"," theSig = item[1]; "," }"," });"," });"," }"," "," paramList = baseStr[2][0].split(\"&\");"," paramList.push(\"oauth_signature=\" + encodeURIComponent(theSig));"," paramList.sort(function(a,b) {"," if (a[0] < b[0]) { return -1; }"," if (a[0] > b[0]) { return 1; }"," if (a[1] < b[1]) { return -1; }"," if (a[1] > b[1]) { return 1; }"," return 0;"," });"," "," Y.each(paramList, function(v, k) {"," locString += paramList[k] + '&'; "," });"," "," finalStr = baseStr[1][0] + '?' + locString.slice(0,locString.length - 1);"," "," return finalStr;"," "," }"," };"," "," if (Y.YQLRequest) {"," Y.YQLRequest.prototype._send = Y.YQLRequest.prototype.send;"," Y.YQLRequest.prototype.send = function() {"," if (this._params.key && this._params.secret) {"," if (!this._opts) {"," this._opts = {};"," }"," this._opts.key = this._params.key;"," this._opts.secret = this._params.secret;"," delete this._params.key;"," delete this._params.secret;"," if (this._params.base) {"," this._opts.base = this._params.base;"," delete this._params.base;"," }"," if (Y.Lang.isFunction(this._callback)) {"," this._callback = {"," on: {"," success: this._callback"," }"," };"," }"," this._callback.format = Y.bind(function(url, proxy) {"," var url = Y.oAuth.signURL(this._opts.key, this._opts.secret, (url + '&callback=' + proxy));"," return url;"," }, this);"," }"," this._send();"," };"," }","","","}, '@VERSION@');"];
+_yuitest_coverage["build/gallery-oauth/gallery-oauth.js"].lines = {"1":0,"7":0,"10":0,"11":0,"12":0,"13":0,"15":0,"16":0,"17":0,"18":0,"25":0,"27":0,"29":0,"30":0,"31":0,"35":0,"36":0,"38":0,"43":0,"62":0,"63":0,"65":0,"66":0,"68":0,"69":0,"70":0,"71":0,"72":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"88":0,"89":0,"92":0,"94":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"106":0,"107":0,"108":0,"109":0,"110":0,"111":0,"112":0,"114":0,"115":0,"121":0,"122":0,"123":0,"126":0};
+_yuitest_coverage["build/gallery-oauth/gallery-oauth.js"].functions = {"onSuccess:14":0,"(anonymous 2):11":0,"(anonymous 3):29":0,"fire:28":0,"ready:34":0,"(anonymous 5):70":0,"(anonymous 4):69":0,"(anonymous 6):80":0,"(anonymous 7):88":0,"signURL:42":0,"(anonymous 8):121":0,"send:101":0,"(anonymous 1):1":0};
+_yuitest_coverage["build/gallery-oauth/gallery-oauth.js"].coveredLines = 59;
+_yuitest_coverage["build/gallery-oauth/gallery-oauth.js"].coveredFunctions = 13;
+_yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 1);
+YUI.add('gallery-oauth', function (Y, NAME) {
+
+ /**
+ * This module pulls in the oAuth code from googlecode and adds a couple of helper methods
+ * to sign a url for standard 2-Legged oAuth
+ */
+ _yuitest_coverfunc("build/gallery-oauth/gallery-oauth.js", "(anonymous 1)", 1);
+_yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 7);
+var BASE = 'http://oauth.googlecode.com/svn/code/javascript/',
+ FILES = [ 'oauth', 'sha1' ], LOADED = 0;
+
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 10);
+if (!YUI.Env.oauthLoaded) {
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 11);
+Y.each(FILES, function(v) {
+ _yuitest_coverfunc("build/gallery-oauth/gallery-oauth.js", "(anonymous 2)", 11);
+_yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 12);
+var url = BASE + v + '.js';
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 13);
+Y.Get.script(url, {
+ onSuccess: function() {
+ _yuitest_coverfunc("build/gallery-oauth/gallery-oauth.js", "onSuccess", 14);
+_yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 15);
+LOADED++;
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 16);
+if (LOADED === FILES.length) {
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 17);
+YUI.Env.oauthLoaded = true;
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 18);
+Y.oAuth.fire();
+ }
+ }
+ });
+ });
+ }
+
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 25);
+Y.namespace('oAuth');
+
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 27);
+Y.oAuth = {
+ fire: function() {
+ _yuitest_coverfunc("build/gallery-oauth/gallery-oauth.js", "fire", 28);
+_yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 29);
+Y.each(Y.oAuth._items, function(fn, k) {
+ _yuitest_coverfunc("build/gallery-oauth/gallery-oauth.js", "(anonymous 3)", 29);
+_yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 30);
+fn();
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 31);
+delete Y.oAuth._items[k];
+ });
+ },
+ ready: function(fn) {
+ _yuitest_coverfunc("build/gallery-oauth/gallery-oauth.js", "ready", 34);
+_yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 35);
+if (YUI.Env.oauthLoaded) {
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 36);
+fn();
+ } else {
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 38);
+Y.oAuth._items.push(fn);
+ }
+ },
+ _items: [],
+ signURL: function(key, secret, url) {
+ _yuitest_coverfunc("build/gallery-oauth/gallery-oauth.js", "signURL", 42);
+_yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 43);
+var accessor = {
+ consumerSecret: secret,
+ tokenSecret: ""
+ },
+ finalStr = '',
+ baseStr = "",
+ parameterMap = "",
+ theSig = "",
+ locString = "",
+ item, subitem, paramList,
+ message = {
+ action: url,
+ method: "GET",
+ parameters: [
+ [ 'oauth_version', '1.0' ],
+ [ 'oauth_consumer_key', key ]
+ ]
+ };
+
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 62);
+OAuth.setTimestampAndNonce(message);
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 63);
+OAuth.SignatureMethod.sign(message, accessor);
+
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 65);
+parameterMap = OAuth.getParameterMap(message);
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 66);
+baseStr = OAuth.decodeForm(OAuth.SignatureMethod.getBaseString(message));
+
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 68);
+if (parameterMap.parameters) {
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 69);
+Y.each(parameterMap.parameters, function(item) {
+ _yuitest_coverfunc("build/gallery-oauth/gallery-oauth.js", "(anonymous 4)", 69);
+_yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 70);
+Y.each(item, function(subitem) {
+ _yuitest_coverfunc("build/gallery-oauth/gallery-oauth.js", "(anonymous 5)", 70);
+_yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 71);
+if (subitem == "oauth_signature") {
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 72);
+theSig = item[1];
+ }
+ });
+ });
+ }
+
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 78);
+paramList = baseStr[2][0].split("&");
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 79);
+paramList.push("oauth_signature=" + encodeURIComponent(theSig));
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 80);
+paramList.sort(function(a,b) {
+ _yuitest_coverfunc("build/gallery-oauth/gallery-oauth.js", "(anonymous 6)", 80);
+_yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 81);
+if (a[0] < b[0]) { return -1; }
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 82);
+if (a[0] > b[0]) { return 1; }
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 83);
+if (a[1] < b[1]) { return -1; }
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 84);
+if (a[1] > b[1]) { return 1; }
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 85);
+return 0;
+ });
+
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 88);
+Y.each(paramList, function(v, k) {
+ _yuitest_coverfunc("build/gallery-oauth/gallery-oauth.js", "(anonymous 7)", 88);
+_yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 89);
+locString += paramList[k] + '&';
+ });
+
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 92);
+finalStr = baseStr[1][0] + '?' + locString.slice(0,locString.length - 1);
+
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 94);
+return finalStr;
+
+ }
+ };
+
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 99);
+if (Y.YQLRequest) {
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 100);
+Y.YQLRequest.prototype._send = Y.YQLRequest.prototype.send;
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 101);
+Y.YQLRequest.prototype.send = function() {
+ _yuitest_coverfunc("build/gallery-oauth/gallery-oauth.js", "send", 101);
+_yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 102);
+if (this._params.key && this._params.secret) {
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 103);
+if (!this._opts) {
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 104);
+this._opts = {};
+ }
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 106);
+this._opts.key = this._params.key;
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 107);
+this._opts.secret = this._params.secret;
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 108);
+delete this._params.key;
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 109);
+delete this._params.secret;
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 110);
+if (this._params.base) {
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 111);
+this._opts.base = this._params.base;
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 112);
+delete this._params.base;
+ }
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 114);
+if (Y.Lang.isFunction(this._callback)) {
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 115);
+this._callback = {
+ on: {
+ success: this._callback
+ }
+ };
+ }
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 121);
+this._callback.format = Y.bind(function(url, proxy) {
+ _yuitest_coverfunc("build/gallery-oauth/gallery-oauth.js", "(anonymous 8)", 121);
+_yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 122);
+var url = Y.oAuth.signURL(this._opts.key, this._opts.secret, (url + '&callback=' + proxy));
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 123);
+return url;
+ }, this);
+ }
+ _yuitest_coverline("build/gallery-oauth/gallery-oauth.js", 126);
+this._send();
+ };
+ }
+
+
+}, '@VERSION@');
131 build/gallery-oauth/gallery-oauth-debug.js
View
@@ -0,0 +1,131 @@
+YUI.add('gallery-oauth', function (Y, NAME) {
+
+ /**
+ * This module pulls in the oAuth code from googlecode and adds a couple of helper methods
+ * to sign a url for standard 2-Legged oAuth
+ */
+ var BASE = 'http://oauth.googlecode.com/svn/code/javascript/',
+ FILES = [ 'oauth', 'sha1' ], LOADED = 0;
+
+ if (!YUI.Env.oauthLoaded) {
+ Y.each(FILES, function(v) {
+ var url = BASE + v + '.js';
+ Y.Get.script(url, {
+ onSuccess: function() {
+ LOADED++;
+ if (LOADED === FILES.length) {
+ YUI.Env.oauthLoaded = true;
+ Y.oAuth.fire();
+ }
+ }
+ });
+ });
+ }
+
+ Y.namespace('oAuth');
+
+ Y.oAuth = {
+ fire: function() {
+ Y.each(Y.oAuth._items, function(fn, k) {
+ fn();
+ delete Y.oAuth._items[k];
+ });
+ },
+ ready: function(fn) {
+ if (YUI.Env.oauthLoaded) {
+ fn();
+ } else {
+ Y.oAuth._items.push(fn);
+ }
+ },
+ _items: [],
+ signURL: function(key, secret, url) {
+ var accessor = {
+ consumerSecret: secret,
+ tokenSecret: ""
+ },
+ finalStr = '',
+ baseStr = "",
+ parameterMap = "",
+ theSig = "",
+ locString = "",
+ item, subitem, paramList,
+ message = {
+ action: url,
+ method: "GET",
+ parameters: [
+ [ 'oauth_version', '1.0' ],
+ [ 'oauth_consumer_key', key ]
+ ]
+ };
+
+ OAuth.setTimestampAndNonce(message);
+ OAuth.SignatureMethod.sign(message, accessor);
+
+ parameterMap = OAuth.getParameterMap(message);
+ baseStr = OAuth.decodeForm(OAuth.SignatureMethod.getBaseString(message));
+
+ if (parameterMap.parameters) {
+ Y.each(parameterMap.parameters, function(item) {
+ Y.each(item, function(subitem) {
+ if (subitem == "oauth_signature") {
+ theSig = item[1];
+ }
+ });
+ });
+ }
+
+ paramList = baseStr[2][0].split("&");
+ paramList.push("oauth_signature=" + encodeURIComponent(theSig));
+ paramList.sort(function(a,b) {
+ if (a[0] < b[0]) { return -1; }
+ if (a[0] > b[0]) { return 1; }
+ if (a[1] < b[1]) { return -1; }
+ if (a[1] > b[1]) { return 1; }
+ return 0;
+ });
+
+ Y.each(paramList, function(v, k) {
+ locString += paramList[k] + '&';
+ });
+
+ finalStr = baseStr[1][0] + '?' + locString.slice(0,locString.length - 1);
+
+ return finalStr;
+
+ }
+ };
+
+ if (Y.YQLRequest) {
+ Y.YQLRequest.prototype._send = Y.YQLRequest.prototype.send;
+ Y.YQLRequest.prototype.send = function() {
+ if (this._params.key && this._params.secret) {
+ if (!this._opts) {
+ this._opts = {};
+ }
+ this._opts.key = this._params.key;
+ this._opts.secret = this._params.secret;
+ delete this._params.key;
+ delete this._params.secret;
+ if (this._params.base) {
+ this._opts.base = this._params.base;
+ delete this._params.base;
+ }
+ if (Y.Lang.isFunction(this._callback)) {
+ this._callback = {
+ on: {
+ success: this._callback
+ }
+ };
+ }
+ this._callback.format = Y.bind(function(url, proxy) {
+ var url = Y.oAuth.signURL(this._opts.key, this._opts.secret, (url + '&callback=' + proxy));
+ return url;
+ }, this);
+ }
+ this._send();
+ };
+ }
+
+
+}, '@VERSION@');
1  build/gallery-oauth/gallery-oauth-min.js
View
@@ -0,0 +1 @@
+YUI.add("gallery-oauth",function(e,t){var n="http://oauth.googlecode.com/svn/code/javascript/",r=["oauth","sha1"],i=0;YUI.Env.oauthLoaded||e.each(r,function(t){var s=n+t+".js";e.Get.script(s,{onSuccess:function(){i++,i===r.length&&(YUI.Env.oauthLoaded=!0,e.oAuth.fire())}})}),e.namespace("oAuth"),e.oAuth={fire:function(){e.each(e.oAuth._items,function(t,n){t(),delete e.oAuth._items[n]})},ready:function(t){YUI.Env.oauthLoaded?t():e.oAuth._items.push(t)},_items:[],signURL:function(t,n,r){var i={consumerSecret:n,tokenSecret:""},s="",o="",u="",a="",f="",l,c,h,p={action:r,method:"GET",parameters:[["oauth_version","1.0"],["oauth_consumer_key",t]]};return OAuth.setTimestampAndNonce(p),OAuth.SignatureMethod.sign(p,i),u=OAuth.getParameterMap(p),o=OAuth.decodeForm(OAuth.SignatureMethod.getBaseString(p)),u.parameters&&e.each(u.parameters,function(t){e.each(t,function(e){e=="oauth_signature"&&(a=t[1])})}),h=o[2][0].split("&"),h.push("oauth_signature="+encodeURIComponent(a)),h.sort(function(e,t){return e[0]<t[0]?-1:e[0]>t[0]?1:e[1]<t[1]?-1:e[1]>t[1]?1:0}),e.each(h,function(e,t){f+=h[t]+"&"}),s=o[1][0]+"?"+f.slice(0,f.length-1),s}},e.YQLRequest&&(e.YQLRequest.prototype._send=e.YQLRequest.prototype.send,e.YQLRequest.prototype.send=function(){this._params.key&&this._params.secret&&(this._opts||(this._opts={}),this._opts.key=this._params.key,this._opts.secret=this._params.secret,delete this._params.key,delete this._params.secret,this._params.base&&(this._opts.base=this._params.base,delete this._params.base),e.Lang.isFunction(this._callback)&&(this._callback={on:{success:this._callback}}),this._callback.format=e.bind(function(t,n){var t=e.oAuth.signURL(this._opts.key,this._opts.secret,t+"&callback="+n);return t},this)),this._send()})},"@VERSION@");
131 build/gallery-oauth/gallery-oauth.js
View
@@ -0,0 +1,131 @@
+YUI.add('gallery-oauth', function (Y, NAME) {
+
+ /**
+ * This module pulls in the oAuth code from googlecode and adds a couple of helper methods
+ * to sign a url for standard 2-Legged oAuth
+ */
+ var BASE = 'http://oauth.googlecode.com/svn/code/javascript/',
+ FILES = [ 'oauth', 'sha1' ], LOADED = 0;
+
+ if (!YUI.Env.oauthLoaded) {
+ Y.each(FILES, function(v) {
+ var url = BASE + v + '.js';
+ Y.Get.script(url, {
+ onSuccess: function() {
+ LOADED++;
+ if (LOADED === FILES.length) {
+ YUI.Env.oauthLoaded = true;
+ Y.oAuth.fire();
+ }
+ }
+ });
+ });
+ }
+
+ Y.namespace('oAuth');
+
+ Y.oAuth = {
+ fire: function() {
+ Y.each(Y.oAuth._items, function(fn, k) {
+ fn();
+ delete Y.oAuth._items[k];
+ });
+ },
+ ready: function(fn) {
+ if (YUI.Env.oauthLoaded) {
+ fn();
+ } else {
+ Y.oAuth._items.push(fn);
+ }
+ },
+ _items: [],
+ signURL: function(key, secret, url) {
+ var accessor = {
+ consumerSecret: secret,
+ tokenSecret: ""
+ },
+ finalStr = '',
+ baseStr = "",
+ parameterMap = "",
+ theSig = "",
+ locString = "",
+ item, subitem, paramList,
+ message = {
+ action: url,
+ method: "GET",
+ parameters: [
+ [ 'oauth_version', '1.0' ],
+ [ 'oauth_consumer_key', key ]
+ ]
+ };
+
+ OAuth.setTimestampAndNonce(message);
+ OAuth.SignatureMethod.sign(message, accessor);
+
+ parameterMap = OAuth.getParameterMap(message);
+ baseStr = OAuth.decodeForm(OAuth.SignatureMethod.getBaseString(message));
+
+ if (parameterMap.parameters) {
+ Y.each(parameterMap.parameters, function(item) {
+ Y.each(item, function(subitem) {
+ if (subitem == "oauth_signature") {
+ theSig = item[1];
+ }
+ });
+ });
+ }
+
+ paramList = baseStr[2][0].split("&");
+ paramList.push("oauth_signature=" + encodeURIComponent(theSig));
+ paramList.sort(function(a,b) {
+ if (a[0] < b[0]) { return -1; }
+ if (a[0] > b[0]) { return 1; }
+ if (a[1] < b[1]) { return -1; }
+ if (a[1] > b[1]) { return 1; }
+ return 0;
+ });
+
+ Y.each(paramList, function(v, k) {
+ locString += paramList[k] + '&';
+ });
+
+ finalStr = baseStr[1][0] + '?' + locString.slice(0,locString.length - 1);
+
+ return finalStr;
+
+ }
+ };
+
+ if (Y.YQLRequest) {
+ Y.YQLRequest.prototype._send = Y.YQLRequest.prototype.send;
+ Y.YQLRequest.prototype.send = function() {
+ if (this._params.key && this._params.secret) {
+ if (!this._opts) {
+ this._opts = {};
+ }
+ this._opts.key = this._params.key;
+ this._opts.secret = this._params.secret;
+ delete this._params.key;
+ delete this._params.secret;
+ if (this._params.base) {
+ this._opts.base = this._params.base;
+ delete this._params.base;
+ }
+ if (Y.Lang.isFunction(this._callback)) {
+ this._callback = {
+ on: {
+ success: this._callback
+ }
+ };
+ }
+ this._callback.format = Y.bind(function(url, proxy) {
+ var url = Y.oAuth.signURL(this._opts.key, this._opts.secret, (url + '&callback=' + proxy));
+ return url;
+ }, this);
+ }
+ this._send();
+ };
+ }
+
+
+}, '@VERSION@');
0  src/gallery-oauth/assets/.keep
View
No changes.
11 src/gallery-oauth/build.json
View
@@ -0,0 +1,11 @@
+{
+ "name": "gallery-oauth",
+ "builds": {
+ "gallery-oauth": {
+ "jsfiles": [
+ "oauth.js"
+ ],
+ "meta": {}
+ }
+ }
+}
0  src/gallery-oauth/css/.keep
View
No changes.
10 src/gallery-oauth/docs/component.json
View
@@ -0,0 +1,10 @@
+{
+ "name" : "gallery-oauth",
+ "displayName": "Gallery: oauth",
+ "description": "Simple oAuth Module",
+ "author" : [ "davglass" ],
+
+ "tags": [ "gallery" ],
+
+ "examples": []
+}
47 src/gallery-oauth/docs/index.mustache
View
@@ -0,0 +1,47 @@
+<div class="intro">
+ <p>
+ Simple oAuth Module
+ </p>
+</div>
+
+<h2>Description</h2>
+
+<p>This simple oAuth module will allow you to create a signed url to use with a 2-Legged oAuth web service.<br>
+<br>
+It also modifies YQL, if it's on the page, and adds in support for key and secret config options.<br>
+</p>
+
+```
+YUI().use('gallery-oauth', function(Y) {
+
+ //Make sure the oAuth libs are available on the page
+ Y.oAuth.ready(function() {
+
+ //Using with YQL
+ Y.YQL('select title,abstract from search.news where query="election"', function() {
+ console.log('success: ', arguments);
+ }, {
+ key: 'dj0yJmk9Q9WVdrOVJGSlJRelpHTlRJbWNHbzlNelF6TlRjMk9EWXkmcz1jb25zdW1lcnNlY3JldCZ4PWMw',
+ secret: 'f6cbasdfsadfas68d25da294a584b541ff29da599a3f53db76',
+ base: '://query.yahooapis.com/v1/yql?'
+ });
+
+ //Using with JSONP
+ Y.jsonp('mywebservice.com/?', {
+ on: {
+ success: function() {
+ console.log('success: ', arguments);
+ }
+ },
+ format: function(url, proxy) {
+ var finalURL = url + 'callback=' + proxy;
+ return Y.oAuth.signURL("dj0yJmk9SXNaaTF2JGSlJRelpHTlRJbWNHbzlNelF6TlRjMk9EWXkmcz1jb25zdW1lcnNlY3JldCZ4PWMw", "5da294a584b5asdfasd41ff29da599a3f53db76", finalURL);
+ }
+ });
+
+ });
+
+
+});
+```
+
0  src/gallery-oauth/meta/.keep
View
No changes.
12 src/gallery-oauth/meta/gallery-oauth.json
View
@@ -0,0 +1,12 @@
+{
+ "gallery-oauth": {
+ "requires": [
+ "jsonp"
+ ],
+ "supersedes": [],
+ "optional": [
+ "yql"
+ ],
+ "skinnable": false
+ }
+}
24 src/gallery-oauth/tests/unit/index.html
View
@@ -0,0 +1,24 @@
+<!doctype html>
+<html>
+<head>
+ <title>gallery-oauth</title>
+ <script src="/build/yui/yui.js"></script>
+ <script src="js/tests.js"></script>
+</head>
+<body class="yui3-skin-sam">
+<div id="logger"></div>
+
+<script>
+YUI({
+ coverage: ['oauth'],
+ filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'raw'
+}).use('test-console', 'test', 'module-tests', function(Y) {
+
+ (new Y.Test.Console()).render('#logger');
+
+ Y.Test.Runner.setName('gallery-oauth');
+ Y.Test.Runner.run();
+});
+</script>
+</body>
+</html>
15 src/gallery-oauth/tests/unit/js/tests.js
View
@@ -0,0 +1,15 @@
+YUI.add('module-tests', function(Y) {
+
+ var suite = new Y.Test.Suite('gallery-oauth');
+
+ suite.add(new Y.Test.Case({
+ name: 'Automated Tests',
+ 'test is empty': function() {
+ Y.Assert.fail('No Tests Provided For This Module');
+ }
+ }));
+
+ Y.Test.Runner.add(suite);
+
+
+},'', { requires: [ 'test' ] });
Please sign in to comment.
Something went wrong with that request. Please try again.