Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

28 lines (22 sloc) 0.652 kB
HTTPS = require "https"
class User
constructor: (@data) ->
@login = @data.login
memberOf: (name, callback) ->
path = "/api/v2/json/user/show/#{@login}/organizations"
params = { host: "github.com", path: path }
isMember = false
console.log path
req = HTTPS.request params, (res) ->
body = ""
res.setEncoding "utf8"
res.on "end", ->
orgs = JSON.parse body
orgs.organizations.forEach (element) ->
if element.login == name
isMember = true
callback null, isMember
res.on "data", (chunk) ->
body += chunk
req.end()
exports.User = User
Jump to Line
Something went wrong with that request. Please try again.