1.4.0 • Published 7 years ago

rantscript v1.4.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

banner image

RantScript allows you to access the whole devRant API via JS.

Install

npm install rantscript

Examples

Console logging the 10 top posts on devRant:

var devRant = require('rantscript');

devRant
  .rants('top', 10, 0)
  .then((response)=>{
    console.log(response);
  })

Enableing debug mode and compression:

var devRant = require('rantscript');
devRant.httpSettings.SET_DEBUG(true);
console.log(devrant.httpSettings.GET_DEBUG());
//Returns True

devRant.httpSettings.SET_COMPRESS(true);
console.log(devrant.httpSettings.GET_COMPRESS());
//Returns True

Logging in and posting a rant:

var devRant = require('rantscript');

//Get authentication token from devRant API
devRant
  .login('username', 'password')
  .then((response)=>{
  	//Then post a rant to devRant with token gotten from previous request.

  	devRant.postRant(
      "Rant Text",
      "Tags, Separated, By, Commas",
      response["auth_token"]
    ).then((resp)=>{
      //Then console.log the rant data.
      console.log(resp);
    })
  })

All Functions

FunctionUsageDescription
.rants.rants('sort', limit, skip, token)Load rants.
.rant.rant(rant_id)Load a single rant by id.
.search.search('search term')Search on devRant
.profile.profile('Username')Load a profile by name
.login.login('Username','Password')Get a devRant auth token
.postRant.postRant('Rant', 'Tags', token)Post a rant to devRant
.postComment.postComment('Comment', rant_id, token)Post a comment to a rant
.vote.vote(<0 = down & 1 = up>, rant_id, token)Vote on a rant
.voteComment.voteComment(<0 = down & 1 = up>, rant_id, token)Vote on a comment
.httpSettingsSee BellowChange settings for the http requests

All Settings

FunctionUsage
.GET_DEBUG()Returns the current Debug state.
.SET_DEBUG(true or false)Enable or disable console.log
.GET_COMPRESS()Returns the current Compress state.
.SET_COMPRESS(true or false)Enable or disable compression.
1.4.0

7 years ago

1.3.9

7 years ago

1.3.8

7 years ago

1.3.7

7 years ago

1.3.6

7 years ago

1.3.5

7 years ago

1.3.4

7 years ago

1.3.3

7 years ago

1.3.2

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.4

7 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago