Creating your own remote source
Starting out with a sample module:
KineticModule = require '../kinetic-module' module.exports = class MySource extends KineticModule constructor: -> # your constructor will contain all your service information.. # call super, with 3 arguments. the HOST, the PATH, and the OPTIONS to use. super('http://somesite.com/api/put', some_var: 'foo', some_other_var: 'bar' )
The Kinetic Module will then read your module, and put a respective menu item into the
Packages Menu, that will look like
Packages->Kinetic->Upload to MySource
Upload to MySource, will call the
@upload() method, which will simply use your data, and post it there.
There are times where maybe your service returns an error. In this case, you can override the
@check() method like so:
KineticModule = require '../kinetic-module' module.exports = class MySource extends KineticModule constructor: -> ... # the method needs an argument, for what the response from your service will be # Returns: # true if intercepted message needs to be edited and sent again # false if it's all good check: (resp) -> if resp.indexOf 'error' @opts['some_var'] = 'something else' return true
It will then try
@MAX_ATTEMPTS times (which defaults to
5, and of course can be overriden by the module.) to send the data back after sanitizing and validating.