Skip to content
This repository has been archived by the owner on Sep 29, 2021. It is now read-only.

Commit

Permalink
Merge pull request #24 from symphonyoss/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
jonfreedman committed Nov 30, 2016
2 parents 35c5a8c + f78d44a commit bb44668
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
18 changes: 9 additions & 9 deletions package.json
Expand Up @@ -30,23 +30,23 @@
"log": "1.4.0",
"memoizee": "0.4.1",
"q": "1.4.1",
"request": "2.75.0"
"request": "2.79.0"
},
"devDependencies": {
"chai": "3.5.0",
"coffee-coverage": "1.0.1",
"coffee-script": "1.10.0",
"coveralls": "2.11.13",
"coffee-script": "1.11.1",
"coveralls": "2.11.15",
"cz-conventional-changelog": "1.2.0",
"ghooks": "1.3.2",
"hubot": "2.19.0",
"istanbul": "0.4.5",
"mocha": "3.0.2",
"nock": "8.0.0",
"node-uuid": "1.4.7",
"semantic-release": "6.3.0",
"validate-commit-msg": "2.8.0",
"yargs": "5.0.0"
"mocha": "3.2.0",
"nock": "9.0.2",
"uuid": "3.0.1",
"semantic-release": "6.3.2",
"validate-commit-msg": "2.8.2",
"yargs": "6.4.0"
},
"config": {
"commitizen": {
Expand Down
4 changes: 2 additions & 2 deletions src/adapter.coffee
Expand Up @@ -70,7 +70,7 @@ class SymphonyAdapter extends Adapter

sendDirectMessageToUsername: (username, messages...) ->
@robot.logger.debug "Sending direct message to username: #{username}"
@_userLookup({userName: username})
@_userLookup({username: username})
.then (response) =>
@_sendDirectMessageToUserId(response.id, messages...)

Expand Down Expand Up @@ -150,7 +150,7 @@ class SymphonyAdapter extends Adapter
# record basic user details in hubot's brain, setting the room causes the brain to update each time we're seen in a new conversation
userId = response.id
existing = @robot.brain.userForId(userId)
existing['name'] = response.userName
existing['name'] = response.username
existing['displayName'] = response.displayName
existing['emailAddress'] = response.emailAddress
if streamId?
Expand Down
6 changes: 3 additions & 3 deletions src/symphony.coffee
Expand Up @@ -45,11 +45,11 @@ class Symphony
whoAmI: =>
@_httpPodGet('/pod/v1/sessioninfo', true)

getUser: ({userId, userName, emailAddress}) =>
getUser: ({userId, username, emailAddress}) =>
if userId?
@_httpPodGet("/pod/v2/user?uid=#{userId}&local=true", true)
else if userName?
@_httpPodGet("/pod/v2/user?username=#{userName}&local=true", true)
else if username?
@_httpPodGet("/pod/v2/user?username=#{username}&local=true", true)
else if emailAddress?
@_httpPodGet("/pod/v2/user?email=#{emailAddress}&local=true", true)
else
Expand Down
6 changes: 3 additions & 3 deletions test/nock-server.coffee
Expand Up @@ -19,7 +19,7 @@ Log = require('log')
logger = new Log process.env.HUBOT_LOG_LEVEL or process.env.HUBOT_SYMPHONY_LOG_LEVEL or 'info'

nock = require 'nock'
uuid = require 'node-uuid'
uuid = require 'uuid'

class NockServer extends EventEmitter

Expand All @@ -41,7 +41,7 @@ class NockServer extends EventEmitter
emailAddress: @realUserEmail
firstName: 'John'
lastName: 'Doe'
userName: @realUserName
username: @realUserName
displayName: 'John Doe'
}

Expand All @@ -54,7 +54,7 @@ class NockServer extends EventEmitter
emailAddress: @botUserEmail
firstName: 'Wolfgang Amadeus'
lastName: 'Mozart'
userName: @botUserName
username: @botUserName
displayName: 'Mozart'
}

Expand Down
8 changes: 4 additions & 4 deletions test/symphony-test.coffee
Expand Up @@ -83,7 +83,7 @@ describe 'REST API test suite', () ->
symphony.getUser({userId: nock.realUserId})
.then (response) ->
assert.equal(nock.realUserId, response.id)
assert.equal(nock.realUserName, response.userName)
assert.equal(nock.realUserName, response.username)
assert.equal(nock.realUserEmail, response.emailAddress)
.fail (error) ->
assert.fail(0, 1,"Failed with error #{error}")
Expand All @@ -92,16 +92,16 @@ describe 'REST API test suite', () ->
symphony.getUser({emailAddress: nock.realUserEmail})
.then (response) ->
assert.equal(nock.realUserId, response.id)
assert.equal(nock.realUserName, response.userName)
assert.equal(nock.realUserName, response.username)
assert.equal(nock.realUserEmail, response.emailAddress)
.fail (error) ->
assert.fail(0, 1,"Failed with error #{error}")

it 'getUser by username should expose user details', () ->
symphony.getUser({userName: nock.realUserName})
symphony.getUser({username: nock.realUserName})
.then (response) ->
assert.equal(nock.realUserId, response.id)
assert.equal(nock.realUserName, response.userName)
assert.equal(nock.realUserName, response.username)
assert.equal(nock.realUserEmail, response.emailAddress)
.fail (error) ->
assert.fail(0, 1,"Failed with error #{error}")
Expand Down

0 comments on commit bb44668

Please sign in to comment.