-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PLTFRS-7737 - Handle oauth v2 + cleanup + format with prettier
- Loading branch information
sgaestel
committed
Oct 27, 2017
1 parent
2fcff11
commit 28aa2da
Showing
15 changed files
with
274 additions
and
438 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,17 @@ | ||
var BPromise = require("bluebird"); | ||
var got = require("got"); | ||
var _ = require("lodash"); | ||
var got = require('got'); | ||
|
||
module.exports = function(zuoraClient) { | ||
|
||
|
||
function getContact(id) { | ||
return zuoraClient.authenticate().then(authCookie => { | ||
var url = zuoraClient.serverUrl + "/object/contact/" + id; | ||
var query = { | ||
headers: { | ||
"Content-type": "application/json", | ||
"cookie": authCookie | ||
}, | ||
json: true | ||
}; | ||
return got.get(url, query) | ||
.then(res => { | ||
return res.body; | ||
}); | ||
return { | ||
get: contactId => | ||
zuoraClient.authenticate().then(headers => { | ||
var url = zuoraClient.serverUrl + '/object/contact/' + contactId; | ||
var query = { | ||
headers, | ||
json: true | ||
}; | ||
return got.get(url, query).then(res => { | ||
return res.body; | ||
}); | ||
} | ||
|
||
return { | ||
get: contactId => { | ||
return getContact(contactId); | ||
} | ||
}; | ||
}) | ||
}; | ||
}; |
Oops, something went wrong.