Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Vimeo module

  • Loading branch information...
commit bb88ab584cd5757607324f47f5c0a700aa71dae2 1 parent 9b49118
@slickplaid slickplaid authored
Showing with 34 additions and 0 deletions.
  1. +34 −0 lib/modules/vimeo.js
View
34 lib/modules/vimeo.js
@@ -0,0 +1,34 @@
+var oauthModule = require('./oauth')
+ , OAuth = require('oauth').OAuth;
+
+var vimeo = module.exports =
+oauthModule.submodule('vimeo')
+ .definit( function () {
+ this.oauth = new OAuth(
+ this.oauthHost() + this.requestTokenPath()
+ , this.oauthHost() + this.accessTokenPath()
+ , this.consumerKey()
+ , this.consumerSecret()
+ , '1.0', null, 'HMAC-SHA1', null
+ );
+ })
+
+ .apiHost('http://vimeo.com/api/rest/v2')
+ .oauthHost('http://vimeo.com')
+
+ .requestTokenPath('/oauth/request_token')
+ .authorizePath('/oauth/authorize')
+ .accessTokenPath('/oauth/access_token')
+
+ .entryPath('/auth/vimeo')
+ .callbackPath('/auth/vimeo/callback')
+
+ .fetchOAuthUser( function (accessToken, accessTokenSecret, params) {
+ var promise = this.Promise();
+ this.oauth.get(this.apiHost() + '?format=json&method=vimeo.people.getInfo&user_id=' + accessTokenSecret, accessToken, accessTokenSecret, function (err, data) {
+ if (err) return promise.fail(err);
+ var oauthUser = JSON.parse(data);
+ return promise.fulfill(oauthUser.person);
+ });
+ return promise;
+ });
Please sign in to comment.
Something went wrong with that request. Please try again.