Skip to content

Commit

Permalink
add Number Lookup resource
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasassisrosa committed Jul 10, 2020
1 parent 2f06b8a commit 7ada0f4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
8 changes: 8 additions & 0 deletions lib/resources/NumberLookup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

var TelnyxResource = require('../TelnyxResource');

module.exports = TelnyxResource.extend({
path: 'number_lookup',
includeBasic: ['retrieve'],
});
3 changes: 2 additions & 1 deletion lib/telnyx.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ var resources = {
PhoneNumbersInboundChannels: require('./resources/PhoneNumbersInboundChannels'),
OtaUpdates: require('./resources/OtaUpdates'),
MobileOperatorNetworks: require('./resources/MobileOperatorNetworks'),
SimCardGroups: require('./resources/SimCardGroups')
SimCardGroups: require('./resources/SimCardGroups'),
NumberLookup: require('./resources/NumberLookup')
};

Telnyx.TelnyxResource = require('./TelnyxResource');
Expand Down
19 changes: 19 additions & 0 deletions test/resources/NumberLookup.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';

var telnyx = require('../../testUtils').getTelnyxMock();
var expect = require('chai').expect;

describe('NumberLookup Resource', function () {
describe('retrieve', function () {
it('Sends the correct request', function () {
return telnyx.numberLookup.retrieve('+18665552368').then(function (response) {
expect(response.data).to.include({record_type: 'number_lookup'});
expect(response.data).to.have.property('country_code');
expect(response.data).to.have.property('fraud');
expect(response.data).to.have.property('phone_number');
expect(response.data).to.have.property('national_format');
expect(response.data).to.have.property('portability');
});
});
});
});

0 comments on commit 7ada0f4

Please sign in to comment.