Skip to content

Commit 08b8811

Browse files
committed
Merge sections in README and add promisifcation comments
- Merge "Usage" and "Library Method Conventions" sections into one section because the extra section was unecessary - Comments about promisifying the API go after basic usage with an example using bluebird.js
1 parent da51a50 commit 08b8811

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

README.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,30 @@ Installation
1111
Usage
1212
=====
1313

14-
Require and Instantiate OKCupidjs
15-
```
14+
All methods are asynchronous, and will return a standard `(err, res, body)` params to your callback. The body will already be json parsed into a json object for easy handling. The following demonstrates how to require and instantiate OKCupidjs.
15+
16+
```javascript
1617
var OKCupid = require('okcupidjs')
1718

1819
var okc = new OKCupid()
20+
21+
okc.login("username", "password", function(err, res, body) {
22+
console.log("done!");
23+
});
1924
```
2025

21-
Library Method Conventions
22-
==========================
23-
NOTE:
24-
All methods are Asynchronous, and will return a standard `(err, res, body)` params to your callback.
25-
Body will already be json parsed into a json object for easy handling.
26+
The library may be converted to a promise-style API by using a promise library like [bluebird.js](http://bluebirdjs.com/docs/features.html#promisification-on-steroids). This is an example using bluebird:
2627

28+
```javascript
29+
var OKCupid = require('okcupidjs');
30+
var Promise = require('bluebird');
31+
32+
var okc = Promise.promisifyAll(new OKCupid());
33+
34+
okc.loginAsync("username", "password").then(function(done) {
35+
console.log("done!");
36+
});
37+
```
2738

2839
Methods
2940
=======

0 commit comments

Comments
 (0)