Skip to content

Commit

Permalink
Merge pull request #2 from fredrhae/master
Browse files Browse the repository at this point in the history
Changing 'token' to 'password' and fixing cancelScheduledSms test
  • Loading branch information
jonatasfreitasv authored Jul 27, 2017
2 parents bfee8a0 + 750792e commit 45ffbe9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ zcs.events.on('event', (data)=>{
```javascript
/**
* Available methods:
* setCredentials(account, token) - Set API Credentials
* setCredentials(account, password) - Set API Credentials
* sendSMS(payload) - Send unique and multiple SMS
* getSMSStatus(sms_id) - Get SMS status by ID
* getSMSReceivedList() - Get received SMS list
Expand All @@ -39,7 +39,7 @@ zcs.events.on('event', (data)=>{

const zapi = require('@zenvia/zenvia-sms-core').api;

zapi.setCredentials('account', 'token');
zapi.setCredentials('account', 'password');

/* Send unique short and long SMS example
*/
Expand Down
4 changes: 2 additions & 2 deletions _code_examples/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Zenvia SMS API - Usage Examples
*
* Functions:
* setCredentials(account, token) - Set API Credentials
* setCredentials(account, password) - Set API Credentials
* sendSMS(payload) - Send unique and multiple SMS
* getSMSStatus(sms_id) - Get SMS status by ID
* getSMSReceivedList() - Get received SMS list
Expand All @@ -16,7 +16,7 @@

const zapi = require('../index').api;

zapi.setCredentials('account', 'token');
zapi.setCredentials('account', 'password');

/* Send unique short and long SMS example
Expand Down
18 changes: 9 additions & 9 deletions lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Zenvia SMS API
*
* Functions:
* setCredentials(account, token) - Set API Credentials
* setCredentials(account, password) - Set API Credentials
* sendSMS(payload) - Send unique and multiple SMS
* getSMSStatus(sms_id) - Get SMS status by ID
* getSMSReceivedList() - Get received SMS list
Expand Down Expand Up @@ -39,12 +39,12 @@ module.exports = {

CREDENTIALS: {
account: null,
token: null,
password: null,
},

setCredentials(account, token){
setCredentials(account, password){
this.CREDENTIALS.account = account;
this.CREDENTIALS.token = token;
this.CREDENTIALS.password = password;
},

sendSMS(payload){
Expand All @@ -62,7 +62,7 @@ module.exports = {
.send(payload)
.auth({
user: this.CREDENTIALS.account,
pass: this.CREDENTIALS.token
pass: this.CREDENTIALS.password
})
.end(function (response) {

Expand Down Expand Up @@ -91,7 +91,7 @@ module.exports = {
.headers({'Accept': 'application/octet-stream', 'Content-Type': 'application/octet-stream'})
.auth({
user: this.CREDENTIALS.account,
pass: this.CREDENTIALS.token
pass: this.CREDENTIALS.password
})
.end(function (response) {

Expand Down Expand Up @@ -120,7 +120,7 @@ module.exports = {
.headers(this.DEFAULT_HEADER)
.auth({
user: this.CREDENTIALS.account,
pass: this.CREDENTIALS.token
pass: this.CREDENTIALS.password
})
.end(function (response) {

Expand Down Expand Up @@ -149,7 +149,7 @@ module.exports = {
.headers(this.DEFAULT_HEADER)
.auth({
user: this.CREDENTIALS.account,
pass: this.CREDENTIALS.token
pass: this.CREDENTIALS.password
})
.end(function (response) {

Expand Down Expand Up @@ -177,7 +177,7 @@ module.exports = {
.headers(this.DEFAULT_HEADER)
.auth({
user: this.CREDENTIALS.account,
pass: this.CREDENTIALS.token
pass: this.CREDENTIALS.password
})
.end(function (response) {

Expand Down
4 changes: 2 additions & 2 deletions test/api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('API', ()=>{
.equal(
JSON.stringify({
account: 'abc',
token: '123',
password: '123',
})
);

Expand Down Expand Up @@ -265,7 +265,7 @@ describe('API', ()=>{
sendSmsRequest: {
from: "Zenvia API",
to: phone_number,
schedule: Date.now(),
schedule: Date.now() + 10000,
msg: "Hello from Zenvia API from NodeJS!!!",
callbackOption: "NONE",
id: sms_id,
Expand Down

0 comments on commit 45ffbe9

Please sign in to comment.