Skip to content

Commit

Permalink
Merge pull request #3 from YV-Proxiad/travic-ci-integration
Browse files Browse the repository at this point in the history
Travic ci integration
  • Loading branch information
YankoVanov-SC committed Jun 12, 2018
2 parents 1e47b5b + 2d889e2 commit 1b34c64
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions mailjet-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ require('superagent-proxy')(request)
* https://www.mailjet.com/
*/
function MailjetClient (api_key, api_secret, options, perform_api_call) {
this.authStrategy(api_key, api_secret, options, perform_api_call)
return this.authStrategy(api_key, api_secret, options, perform_api_call)
}

/**
Expand All @@ -78,10 +78,10 @@ MailjetClient.prototype.authStrategy = function(api_key, api_secret, options, pe
// api_key becomes api_token
// api_secret becomes options
// options becomes perform_api_call
tokenAuthentication(api_key, api_secret, options)
return tokenAuthentication(api_key, api_secret, options)
} else {
// params are in correct order
basicAuthentication(api_key, api_secret, options, perform_api_call)
return basicAuthentication(api_key, api_secret, options, perform_api_call)
}

/**
Expand All @@ -100,6 +100,8 @@ MailjetClient.prototype.authStrategy = function(api_key, api_secret, options, pe
if (api_key && api_secret) {
self.connect(api_key, api_secret, options)
}

return self
}

/**
Expand All @@ -115,6 +117,8 @@ MailjetClient.prototype.authStrategy = function(api_key, api_secret, options, pe
if (api_token) {
self.connect(api_token, options)
}

return self
}
}

Expand Down Expand Up @@ -342,7 +346,7 @@ MailjetClient.prototype.httpRequest = function (method, url, data, callback, per
function MailjetResource (method, func, options, context) {
this.base = func
this.callUrl = func
this.options = options
this.options = options || context.options

this.resource = func.toLowerCase()

Expand Down
4 changes: 2 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ describe('Advanced API Calls', function () {
}
}

var client2 = new Mailjet(API_KEY, API_SECRET, null, true)
var client2 = new Mailjet(API_KEY, API_SECRET, emailOptions, true)

const EXAMPLES_SET = [
new Example(client2.get('contact')),
Expand Down Expand Up @@ -218,7 +218,7 @@ describe('Advanced API Calls', function () {
/* This fixture needs to run last so that it doesn't interfere with the other tests */
describe('Mocked API calls', function () {
/* Set a very short timeout */
var client = Mailjet.connect(API_KEY, API_SECRET, { timeout: 10 })
var client = Mailjet.connect(API_KEY, API_SECRET, { timeout: 10, version: 'v3' })

describe('method request', function () {
describe('get', function () {
Expand Down

0 comments on commit 1b34c64

Please sign in to comment.