1.2.0 • Published 10 years ago

ok.ru v1.2.0

Weekly downloads
26
License
-
Repository
github
Last release
10 years ago

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.
1.3.0

10 years ago

1.2.0

10 years ago

1.1.1

11 years ago

1.1.0

11 years ago

1.0.1

11 years ago

1.0.0

11 years ago

0.1.0

11 years ago

0.0.5

11 years ago

0.0.4-a

11 years ago

0.0.4

11 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago