Odnoklassniki API client
CoffeeScript JavaScript
Latest commit ed91951 Jul 5, 2016 @cre-o committed on GitHub Merge pull request #4 from Nedudi/master
Update ok_ru.js to fix exception
Permalink
Failed to load latest commit information.
lib Update ok_ru.js Jun 13, 2016
src updated dependecies Jul 31, 2014
test Not used. Dec 1, 2013
README.md Readme update. Nov 12, 2013
index.js index. Nov 4, 2013
package.json updated dependecies Jul 31, 2014

README.md

Ok.ru API with node

This npm module allows you to simplify making API requests into odnoklassniki REST API.

Example usage

ok = require("ok.ru")

# Basic configuration params
requestOptions = {
  applicationSecretKey: '{secretKey}',
  applicationKey: '{applicationKey}',
  applicationId: '{applicationId}',
}

ok.setOptions(requestOptions)
# You can specify accessToken in requestOptions or separately
# For example: if you have many users and you whant to iterate through them
ok.setAccessToken('{access_token}')

# All data passed in Object
ok.post { method: 'group.getUserGroupsV2' }, (err, data) ->
  # Some actions with data

# You can also specify types of requests
ok.post, ok.get

# Or pass in, as argument
new ok.api 'get', { method: 'users.isAppUser' }, (err, data) ->
  # some actions with data

# It properly handle errors
ok.setAccessToken('invalid_token') # Invalid token

new ok.api 'get', { method: 'users.isAppUser' }, (err, data, response) ->
  # some actions with data
  alert "Alarm! Error! #{err}" if err?
  # It can transport all response and headers
  console.log response

Refresh user token method

ok.refresh '{refresh_token}', (err, data) ->
  data.access_token # new token

Test it!

Add your params at test/settings.yml and you are ready to go!
$ mocha

Enjoy!

TODO

  • What do you need? Let me know or fork.