Skip to content

Commit

Permalink
upgrade: v0.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
caioagiani committed Feb 17, 2021
1 parent b0544c9 commit 96a6a69
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 34 deletions.
32 changes: 13 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ Confira em [docs](https://github.com/caioagiani/mobizon-node/blob/master/docs) t
console.log(getBalance);

/** Encurtar URL */
const short = await mobizon.short({
const short = await mobizon.shortCreate({
fullLink: 'https://mobizon.com.br',
status: 1,
expirationDate: '',
comment: 'Mobizon',
comment: 'Shortened link.',
});

console.log(short);
Expand All @@ -63,7 +63,7 @@ Confira em [docs](https://github.com/caioagiani/mobizon-node/blob/master/docs) t
const sendSms = await mobizon.sendSms({
recipient: process.env.NUMBER,
from: '',
text: 'Mobizon',
text: 'SMS sent by Mobizon.',
});

console.log(sendSms);
Expand All @@ -75,24 +75,18 @@ Dê uma olhada em [example.js](https://github.com/caioagiani/mobizon-node/blob/m
## Testes

```javascript
jest --setupFiles dotenv/config --detectOpenHandles --forceExit
PASS tests/mobizon.test.js
Mobizon feature tests
✓ should receive the account balance (323 ms)
✓ should create short link (447 ms)
✓ should get short link (349 ms)
✓ should update short link (325 ms)
✓ should delete short link (390 ms)
✓ should send a test sms (610 ms)
✓ should list the sms sent by id (312 ms)
✓ should list the all sms sent (762 ms)

Test Suites: 1 passed, 1 total
Tests: 8 passed, 8 total
yarn lint && jest --setupFiles dotenv/config --detectOpenHandles --forceExit
$ eslint . --ext .js
PASS __tests__/shortlink.test.js
PASS __tests__/sms.test.js
PASS __tests__/balance.test.js

Test Suites: 3 passed, 3 total
Tests: 14 passed, 14 total
Snapshots: 0 total
Time: 4.208 s
Time: 7.013 s
Ran all test suites.
Done in 4.65s.
Done in 8.41s.
```

## Licença
Expand Down
8 changes: 4 additions & 4 deletions example.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ mobizon.setConfig({
console.log(getBalance);

/** Encurtar URL */
const short = await mobizon.short({
const short = await mobizon.shortCreate({
fullLink: 'https://mobizon.com.br',
status: 1,
expirationDate: '',
comment: 'Mobizon',
comment: 'Shortened link.',
});

console.log(short);
Expand All @@ -36,7 +36,7 @@ mobizon.setConfig({
data: {
status: 0,
expirationDate: '',
comment: 'Link atualizado.',
comment: 'Updated link.',
},
});

Expand All @@ -51,7 +51,7 @@ mobizon.setConfig({
const sendSms = await mobizon.sendSms({
recipient: process.env.NUMBER,
from: '',
text: 'Mobizon',
text: 'SMS sent by Mobizon.',
});

console.log(sendSms);
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mobizon-node",
"version": "0.2.2",
"version": "0.2.3",
"description": "Mobizon é um poderoso gateway de SMS e ferramentas de marketing online.",
"readmeFilename": "README.md",
"main": "src/index.js",
Expand All @@ -9,6 +9,8 @@
"mobizon",
"sms",
"api",
"shortcode",
"url_shortener",
"gateway",
"messaging",
"A2P"
Expand Down Expand Up @@ -40,7 +42,7 @@
"dependencies": {
"axios": "^0.21.1",
"jest": "^26.6.3",
"mobizon-node": "^0.2.2"
"mobizon-node": "^0.2.3"
},
"devDependencies": {
"dotenv": "^8.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = {
getBalance() {
return balance.get.call(this);
},
short(data) {
shortCreate(data) {
return short.create.call(this, data);
},
shortDelete(data) {
Expand Down
10 changes: 2 additions & 8 deletions src/structures/sms.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,8 @@ const { mobizon } = require('../services/mobizon');
const { urlEncode } = require('../utils/url');

module.exports = {
send({ recipient, from, text }) {
const query = {
recipient,
from,
text,
};

const queryParams = urlEncode(query);
send(query) {
const queryParams = query ? urlEncode(query) : undefined;

return mobizon.call(this, 'message', 'sendsmsmessage', null, queryParams);
},
Expand Down

0 comments on commit 96a6a69

Please sign in to comment.