Skip to content

Commit

Permalink
Merge pull request #1 from twilio/sip-in
Browse files Browse the repository at this point in the history
LGTM - ran some basic local tests and the endpoints look good.  Will include test specs int he rewrite of the suite I am working on (to run offline).
  • Loading branch information
kwhinnery committed Sep 6, 2013
2 parents a8cbf13 + 0115b33 commit f6383bd
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/resources/Accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@ module.exports = function (client) {
['GET','POST','DELETE',{update:'POST'}],
['GET','POST',{create:'POST'}]
)
},
sip:{
domains:require('./sip/Domains')(client, sid),
ipAccessControlLists:require('./sip/IpAccessControlLists')(client,sid),
credentialLists:require('./sip/CredentialLists')(client,sid)
}

};

//Add resources to Accounts.* or Accounts(sid).*
Expand Down
36 changes: 36 additions & 0 deletions lib/resources/sip/CredentialLists.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
@module resources/sip/CredentialLists
The Twilio "CredentialLists" Resource.
*/
var generate = require('../generate'),
ListInstanceResource = require('../ListInstanceResource');

module.exports = function (client, accountSid) {
var baseResourceUrl = '/Accounts/' + accountSid + '/SIP/CredentialLists';

//Instance requests
function CredentialLists(sid) {
var resourceApi = {}

generate.restFunctions(resourceApi, client,
['GET', 'POST', 'DELETE', {update: 'POST'}],
baseResourceUrl + '/' + sid
);

resourceApi.credentials = ListInstanceResource(client, accountSid,
'SIP/CredentialLists/' + sid + '/Credentials',
['GET', 'POST', 'DELETE', {update: 'POST'}],
['GET', 'POST', {list: 'GET'}, {create: 'POST'}]
);

return resourceApi;
}

generate.restFunctions(CredentialLists, client,
['GET', 'POST', {create: 'POST'}, {list: 'GET'}],
baseResourceUrl
);

return CredentialLists;

}
41 changes: 41 additions & 0 deletions lib/resources/sip/Domains.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
@module resources/sip/Domains
The Twilio "Domains" Resource.
*/
var generate = require('../generate'),
ListInstanceResource = require('../ListInstanceResource');

module.exports = function (client, accountSid) {
var baseResourceUrl = '/Accounts/' + accountSid + '/SIP/Domains';

//Instance requests
function Domains(sid) {
var resourceApi = {}

generate.restFunctions(resourceApi, client,
['GET', 'POST', 'DELETE', {update: 'POST'}],
baseResourceUrl + '/' + sid
);

resourceApi.ipAccessControlListMappings = ListInstanceResource(client, accountSid,
'SIP/Domains/' + sid + '/IpAccessControlListMappings',
['GET', 'DELETE'],
['GET', 'POST', {create:'POST'}, {list: 'GET'}]
);

resourceApi.credentialListMappings = ListInstanceResource(client, accountSid,
'SIP/Domains/' + sid + '/CredentialListMappings',
['GET', 'DELETE'],
['GET', 'POST', {create:'POST'}, {list: 'GET'}]
);

return resourceApi;
};

generate.restFunctions(Domains, client,
['GET', 'POST', {create: 'POST'}, {list: 'GET'}],
baseResourceUrl
);

return Domains;
}
37 changes: 37 additions & 0 deletions lib/resources/sip/IpAccessControlLists.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
@module resources/sip/IpAccessControlLists
The Twilio "IpAccessControlLists" Resource.
*/
var generate = require('../generate'),
ListInstanceResource = require('../ListInstanceResource');

module.exports = function (client, accountSid) {
var baseResourceUrl = '/Accounts/' + accountSid + '/SIP/IpAccessControlLists';

//Instance requests
function IpAccessControlLists(sid) {
var resourceApi = {}

generate.restFunctions(resourceApi, client,
['GET', 'POST', 'DELETE', {update: 'POST'}],
baseResourceUrl + '/' + sid
);

resourceApi.ipAddresses = ListInstanceResource(client, accountSid,
'SIP/IpAccessControlLists/' + sid + '/IpAddresses',
['GET', 'POST', 'DELETE', {update: 'POST'}],
['GET', 'POST', {list: 'GET'}, {create: 'POST'}]
);

return resourceApi;
}

generate.restFunctions(IpAccessControlLists, client,
['GET', 'POST', {create: 'POST'}, {list: 'GET'}],
baseResourceUrl
);


return IpAccessControlLists;

}

0 comments on commit f6383bd

Please sign in to comment.