Permalink
Browse files

Update README

  • Loading branch information...
meritt committed Aug 16, 2011
1 parent 903bdc8 commit 2b13922b3c4b69597039c0fe1038f4d1240d422c
Showing with 32 additions and 19 deletions.
  1. +30 −17 README.md
  2. +2 −2 examples/token-auth.coffee
View
@@ -4,32 +4,36 @@ A Node.JS wrapper for [GitHub gist API v3](http://developer.github.com/v3/gists/
<!-- [The announcement in Russian of this module in my blog.](http://nko.io/paGOx1) -->
-How to use in JavaScript
-------------------------
+How to use with JavaScript
+--------------------------
- var Gisty = require('gisty').Gisty;
+```JavaScript
+var Gisty = require('gisty').Gisty;
- var gist = new Gisty({username: meritt});
+var gist = new Gisty({username: meritt});
- gist.fetch('1111422', function(error, gist) {
- if (error) {
- throw new Error(error);
- }
- for (filename in gist.files) {
- console.log(filename + "\n" + gist.files[filename].content + "\n\n");
- }
- });
+gist.fetch('1111422', function(error, gist) {
+ if (error) {
+ throw new Error(error);
+ }
+ for (filename in gist.files) {
+ console.log(filename + "\n" + gist.files[filename].content + "\n\n");
+ }
+});
+```
Or with CoffeeScript
--------------------
- Gisty = require('gisty').Gisty
+```CoffeeScript
+Gisty = require('gisty').Gisty
- gist = new Gisty username: 'meritt'
+gist = new Gisty username: 'meritt'
- gist.fetch '1111422', (error, gist) ->
- throw new Error error if error
- console.log filename + "\n" + file.content + "\n\n" for filename, file of gist.files
+gist.fetch '1111422', (error, gist) ->
+ throw new Error error if error
+ console.log filename + "\n" + file.content + "\n\n" for filename, file of gist.files
+```
[See other examples](http://github.com/meritt/node-gisty/tree/master/examples)
@@ -38,6 +42,15 @@ Install with NPM
npm install gisty
+How to retrieve GitHub OAuth2 access_token
+------------------------------------------
+
+Grab latest source code, install all dev dependecies
+ npm link
+
+Change your host, client id, client secret in [examples/get-access-token.coffee](http://github.com/meritt/node-gisty/blob/master/examples/get-access-token.coffee) and after that run [examples/get-access-token.coffee](http://github.com/meritt/node-gisty/blob/master/examples/get-access-token.coffee)
+ coffee examples/get-access-token.coffee
+
API
---
@@ -1,10 +1,10 @@
###
- Retrieve all users gist with OAuth2 access token
+ Retrieve all users gist with OAuth2 access_token
###
Gisty = require('./../lib/gisty').Gisty
-gist = new Gisty token: 'oauth access token', username: 'meritt'
+gist = new Gisty token: 'OAuth2 access_token', username: 'meritt'
gist.all (error, gists) ->
throw new Error error if error

0 comments on commit 2b13922

Please sign in to comment.