Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Forward options to stream

  • Loading branch information...
commit 21ccf79843cfe3898601866bb08ce53e34f723b1 1 parent d14efc5
@lautis lautis authored
Showing with 8 additions and 4 deletions.
  1. +1 −1  Readme.md
  2. +7 −3 src/flowdock.coffee
View
2  Readme.md
@@ -24,7 +24,7 @@ var session = new Session(username, password);
var stream = session.stream('example/main');
stream.end();
```
-The argument(s) for stream() can be a string ('subdomain/flow'), an array (['subdomain/flow', 'subdomain/anotherflow']) or a list of strings ('subdomain/flow', 'subdomain/anotherflow').
+The argument(s) for stream() can be a string ('subdomain/flow') or an array (['subdomain/flow', 'subdomain/anotherflow']).
session.stream() returns an instance of EventEmitter. Currently it emits two types of events:
View
10 src/flowdock.coffee
@@ -2,6 +2,7 @@ url = require 'url'
events = require 'events'
request = require 'request'
Stream = require './stream'
+util = require 'util'
baseURL = ->
url.parse(process.env.FLOWDOCK_API_URL || 'https://api.flowdock.com')
@@ -33,10 +34,13 @@ class Session extends process.EventEmitter
# Start streaming flows given as argument using authentication credentials
#
+ # flows - Flow id (String <subdomain>:<flow> or <subdomain>/</flow>) or array of flow ids
+ # options - query string hash
+ #
# Returns Stream object
- stream: (flows...) ->
- flows = flows[0] if flows[0] instanceof Array && flows.length == 1
- return Stream.connect @auth, flows
+ stream: (flows, options = {}) ->
+ flows = [flows] unless util.isArray(flows)
+ Stream.connect @auth, flows, options
# Send message to flowdock
send: (flow, message, callback) ->
Please sign in to comment.
Something went wrong with that request. Please try again.