Skip to content

Commit

Permalink
Merge d94f383 into e056b71
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasassisrosa committed Jul 8, 2020
2 parents e056b71 + d94f383 commit 83a29da
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
11 changes: 11 additions & 0 deletions lib/resources/Balance.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict';

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

module.exports = TelnyxResource.extend({
path: 'balance',

retrieve: TelnyxResource.method({
method: 'GET',
})
});
3 changes: 2 additions & 1 deletion lib/telnyx.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ var resources = {
Actions: require('./resources/Actions'),
OutboundVoiceProfiles: require('./resources/Outbound'),
CallControlApplications: require('./resources/CallControlApplications'),
PhoneNumbersInboundChannels: require('./resources/PhoneNumbersInboundChannels')
PhoneNumbersInboundChannels: require('./resources/PhoneNumbersInboundChannels'),
Balance: require('./resources/Balance'),
};

Telnyx.TelnyxResource = require('./TelnyxResource');
Expand Down
19 changes: 19 additions & 0 deletions test/resources/Balance.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('Balance Resource', function() {
describe('retrieve', function() {
it('Sends the correct request', function() {
return telnyx.balance.retrieve()
.then(function(response) {
expect(response.data).to.include({record_type: 'balance'});
expect(response.data).to.have.property('balance');
expect(response.data).to.have.property('available_credit');
expect(response.data).to.have.property('currency');
expect(response.data).to.have.property('credit_limit');
});
});
});
});

0 comments on commit 83a29da

Please sign in to comment.