Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixing #154 & #155 (#156)
* safeguarding against null response. fixes #154

* adding app_id to docs for ad & an. fixes #155

* bumping version for release

* adding app_id in the example for an

* updating changelog for 0.3.11
  • Loading branch information
AlexLakatos committed Jan 22, 2018
1 parent a2ac61a commit fc981b9
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,12 @@

All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).

## [0.3.11][]

* FIXED: `application:delete` was returning a null response and throwing a validation error.
* FIXED: `application:numbers` example was missing the required `app_id` parameter.


## [0.3.10][]

* FIXED: `number:update` had been duplicated resulting in multiple executions per `number:update` command. One version has now been renamed to `numbers:update`.
Expand Down
10 changes: 9 additions & 1 deletion README.md
Expand Up @@ -425,6 +425,10 @@ Alias: `nexmo au`.

#### Delete an application

Parameters:

- `app_id` - the UUID of your application.

```
> nexmo app:delete asdasdas-asdd-2344-2344-asdasdasd345
This is operation can not be reversed.
Expand All @@ -441,6 +445,10 @@ Alias: `nexmo ad`.

#### Show numbers for an application

Parameters:

- `app_id` - the UUID of your application.

- Optional flags:

- `--size` the amount of results to return
Expand All @@ -452,7 +460,7 @@ Alias: `nexmo ad`.
44655555555
44555555555
> nexmo app:numbers --verbose
> nexmo app:numbers asdasdas-asdd-2344-2344-asdasdasd345 --verbose
Item 1-3 of 3
msisdn | country | type | features | voiceCallbackType | voiceCallbackValue | moHttpUrl | voiceStatusCallbackUrl
Expand Down
4 changes: 2 additions & 2 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "nexmo-cli",
"version": "0.3.10",
"version": "0.3.11",
"description": "Nexmo Command Line Interface",
"main": "lib/request.js",
"scripts": {
Expand Down Expand Up @@ -49,6 +49,6 @@
"colors": "^1.1.2",
"commander": "^2.9.0",
"ini": "^1.3.4",
"nexmo": "^2.0.2"
"nexmo": "^2.1.1"
}
}
4 changes: 2 additions & 2 deletions src/validator.js
Expand Up @@ -10,9 +10,9 @@ class Validator {
this.emitter.error(error.message);
} else if (error && error.body && error.body['error-code']) {
this.emitter.error(error.body['error-code-label']);
} else if (response['error-code'] && response['error-code'] !== '200') {
} else if (response && response['error-code'] && response['error-code'] !== '200') {
this.emitter.error(response['error-code-label']);
} else if (response['status'] && response['status'] !== '0') {
} else if (response && response['status'] && response['status'] !== '0') {
this.emitter.error(response['status_message']);
}
}
Expand Down
7 changes: 7 additions & 0 deletions tests/validator.js
Expand Up @@ -21,6 +21,13 @@ describe('Validator', () => {
});
});

describe('when no response is present', () => {
it('should fall through quietely', () => {
let validator = new Validator(new Emitter());
expect(validator.response(null, null)).to.be.undefined;
});
});

describe('when errors are present', () => {
describe('due to error objects', () => {
it('should emit an error', sinon.test(function() {
Expand Down

0 comments on commit fc981b9

Please sign in to comment.