Browse files

Add another few examples

  • Loading branch information...
1 parent aab1281 commit 461956e7d432f8f8b291ba951357ba290d69088f @meritt committed Aug 16, 2011
Showing with 33 additions and 0 deletions.
  1. +11 −0 example/plain-auth.coffee
  2. +11 −0 example/public-access.coffee
  3. +11 −0 example/token-auth.coffee
View
11 example/plain-auth.coffee
@@ -0,0 +1,11 @@
+###
+ Retrieve starred gist with plain authenticate
+###
+
+Gisty = require('./../lib/gisty').Gisty
+
+gist = new Gisty login: 'login', password: 'password'
+
+gist.starred (error, gists) ->
+ throw new Error error if error
+ console.log gists
View
11 example/public-access.coffee
@@ -0,0 +1,11 @@
+###
+ Retrieve public gist
+###
+
+Gisty = require('./../lib/gisty').Gisty
+
+gist = new Gisty username: 'meritt'
+
+gist.fetch '1111422', (error, gist) ->
+ throw new Error error if error
+ console.log "#{filename}\n--------------\n\n#{file.content}\n\n" for filename, file of gist.files
View
11 example/token-auth.coffee
@@ -0,0 +1,11 @@
+###
+ Retrieve all users gist with OAuth2 access token
+###
+
+Gisty = require('./../lib/gisty').Gisty
+
+gist = new Gisty token: 'oauth access token', username: 'meritt'
+
+gist.all (error, gists) ->
+ throw new Error error if error
+ console.log gists

0 comments on commit 461956e

Please sign in to comment.