You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 19, 2019. It is now read-only.
I am getting the below error when trying to deploy this to production.
API Name: Twilio_TestPhoneNumbers
Apex Class
Line: 106
Column: 31
Error Message:
Method does not exist or incorrect signature: [TwilioAvailablePhoneNumber].getAddressRequirements()
The method in TwilioAvailablePhoneNumber is there:
Line 157
/**
* Indicates whether this number requires an Address to be on file with Twilio.
* Potential values are "any", "local", "foreign", or "none".
*
* @return the address requirements
*/
public String getAddressRequirements() {
return this.getProperty('address_requirements');
}
I was experiencing the Script Thrown error on the Twilio_TestPhoneNumbers class and added
Twilio_TestPhoneNumbers.cls
`/*
Copyright (c) 2012 Twilio, Inc.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/ @istest
private class Twilio_TestPhoneNumbers {
// register a mock Response with the Twilio_TestHTTPMock singleton service
// for the HTTP GET method and at the Twilio Account instance URI.
Twilio_TestHTTPMock.getInstance().putResponse(
'POST',
'https://api.twilio.com/2010-04-01/Accounts/AC03c2fcd60e144e7cbeee413fcbf812a3/IncomingPhoneNumbers.json',
new Twilio_TestHTTPMock.Response(accountJsonResponseBody,200)
);
map<string,string> p=new map<string,string>();
p.put('PhoneNumber','+15105647903');
p.put('FriendlyName','My Company Line');
p.put('VoiceUrl','http://mycompany.com/handleNewCall.php');
p.put('VoiceMethod','GET');
// Get an API client and request the Twilio Account
TwilioRestClient client = new TwilioRestClient('AC03c2fcd60e144e7cbeee413fcbf812a3', authToken);
TwilioIncomingPhoneNumber twinnums= client.getAccount().getIncomingPhoneNumbers().create(p);
System.assertEquals('PN2a0747eba6abf96b7e3c3ff0b4530f6e', twinnums.getSid());
System.assertEquals(Datetime.newInstanceGmt(2010,08,16,23,31,47),twinnums.getDateCreated());
System.assertEquals(Datetime.newInstanceGmt(2010,08,16,23,31,47),twinnums.getDateUpdated());
System.assertEquals('My Company Line',twinnums.getFriendlyName());
System.assertEquals('ACdc5f1e11047ebd6fe7a55f120be3a900',twinnums.getAccountSid());
System.assertEquals('+15105647903',twinnums.getPhoneNumber());
System.assertEquals(null,twinnums.getVoiceApplicationSid());
System.assertEquals(null,twinnums.getSmsApplicationSid());
System.assertEquals('2010-04-01',twinnums.getApiVersion());
System.assertEquals('http://mycompany.com/handleNewCall.php',twinnums.getVoiceUrl());
System.assertEquals('POST',twinnums.getVoiceMethod());
System.assertEquals(null,twinnums.getVoiceFallbackurl());
System.assertEquals('POST',twinnums.getVoiceFallbackMethod());
System.assertEquals(null,twinnums.getStatusCallback());
System.assertEquals(null,twinnums.getStatusCallbackMethod());
System.assertEquals(null,twinnums.getVoiceCallerIdLookup());
System.assertEquals(null,twinnums.getSmsUrl());
System.assertEquals('POST',twinnums.getSmsMethod());
System.assertEquals(null,twinnums.getSmsFallbackUrl());
System.assertEquals('GET',twinnums.getSmsFallbackMethod());
System.assertEquals(null,twinnums.getSmsStatusCallback());
}
static testmethod void testTwilioIncomingPhoneNumber_get()
{
String accountJsonResponseBody ='{"sid": "PN2a0747eba6abf96b7e3c3ff0b4530f6e","account_sid": "ACdc5f1e11047ebd6fe7a55f120be3a900","friendly_name": "My Company Line",'+
'"phone_number": "+15105647903","voice_url": "http://mycompany.com/handleNewCall.php","voice_method": "POST","voice_fallback_url": null,"voice_fallback_method": "POST",'+
'"voice_caller_id_lookup": null,"voice_application_sid": null,"date_created": "Mon, 16 Aug 2010 23:31:47 +0000","date_updated": "Mon, 16 Aug 2010 23:31:47 +0000",'+
'"sms_url": null,"sms_method": "POST","sms_fallback_url": null,"sms_fallback_method": "GET","sms_application_sid": null,"capabilities": {"voice": null,"sms": null},'+
'"status_callback": null,"status_callback_method": null,"api_version": "2010-04-01","uri": "/2010-04-01/Accounts/ACdc5f1e11047ebd6fe7a55f120be3a900/IncomingPhoneNumbers/PN2a0747eba6abf96b7e3c3ff0b4530f6e.json"}';
Twilio_TestHTTPMock.getInstance().putResponse(
'GET',
'https://api.twilio.com/2010-04-01/Accounts/AC03c2fcd60e144e7cbeed179fcbf812a3/IncomingPhoneNumbers/PN3f94c94562ac88dccf16f8859a1a8b25.json',
new Twilio_TestHTTPMock.Response(accountJsonResponseBody,200)
);
// Get an API client and request the Twilio Account
TwilioRestClient client = new TwilioRestClient('AC03c2fcd60e144e7cbeed179fcbf812a3', authToken);
TwilioIncomingPhoneNumber twinnums=client.getAccount().getIncomingPhoneNumber('PN3f94c94562ac88dccf16f8859a1a8b25');
System.assertEquals('PN3f94c94562ac88dccf16f8859a1a8b25', twinnums.getSid());
System.assertEquals('My Company Line',twinnums.getFriendlyName());
System.assertEquals(Datetime.newInstanceGmt(2010,08,16,23,31,47),twinnums.getDateCreated());
System.assertEquals(Datetime.newInstanceGmt(2010,08,16,23,31,47),twinnums.getDateUpdated());
System.assertEquals('ACdc5f1e11047ebd6fe7a55f120be3a900',twinnums.getAccountSid());
System.assertEquals('+15105647903',twinnums.getPhoneNumber());
System.assertEquals(null,twinnums.getVoiceApplicationSid());
System.assertEquals(null,twinnums.getSmsApplicationSid());
System.assertEquals('2010-04-01',twinnums.getApiVersion());
System.assertEquals('http://mycompany.com/handleNewCall.php',twinnums.getVoiceUrl());
System.assertEquals('POST',twinnums.getVoiceMethod());
System.assertEquals(null,twinnums.getVoiceFallbackurl());
System.assertEquals('POST',twinnums.getVoiceFallbackMethod());
System.assertEquals(null,twinnums.getStatusCallback());
System.assertEquals(null,twinnums.getStatusCallbackMethod());
System.assertEquals(null,twinnums.getVoiceCallerIdLookup());
System.assertEquals(null,twinnums.getSmsUrl());
System.assertEquals('POST',twinnums.getSmsMethod());
System.assertEquals(null,twinnums.getSmsFallbackUrl());
System.assertEquals('GET',twinnums.getSmsFallbackMethod());
System.assertEquals(null,twinnums.getSmsStatusCallback());
}
static testmethod void testTwilioIncomingPhoneNumber_delete()
{
String accountJsonResponseBody ='';
Twilio_TestHTTPMock.getInstance().putResponse(
'DELETE',
'https://api.twilio.com/2010-04-01/Accounts/AC03c2fcd60e144e7cbeed179fcbf812a3/IncomingPhoneNumbers/PN3f94c94562ac88dccf16f8859a1a8b25.json',
new Twilio_TestHTTPMock.Response(accountJsonResponseBody,200)
);
// Get an API client and request the Twilio Account
TwilioRestClient client = new TwilioRestClient('AC03c2fcd60e144e7cbeed179fcbf812a3', authToken);
boolean isdel=client.getAccount().getIncomingPhoneNumber('PN3f94c94562ac88dccf16f8859a1a8b25').deleteIncomingPhoneNumber();
system.assert(true,isdel);
TwilioIncomingPhoneNumber twip=new TwilioIncomingPhoneNumber(client);
TwilioIncomingPhoneNumberlist twipl=new TwilioIncomingPhoneNumberList(client);
}
static testmethod void testOutgoingCallerIDList_get()
{
String accountJsonResponseBody ='{"outgoing_caller_ids":[{"sid":"PN17c8630939e44e7e92a45c51bcdb7122",'
+'"account_sid":"AC03c2fcd60e144e7cbeee413fcbf812a3","friendly_name":"919902400323","phone_number":"+919902400323",'+
'"date_created":"Thu, 29 Dec 2011 12:22:55 +0000","date_updated":"Thu, 29 Dec 2011 12:22:55 +0000",'+
'"uri":"/2010-04-01/Accounts/AC03c2fcd60e144e7cbeee413fcbf812a3/OutgoingCallerIds/PN17c8630939e44e7e92a45c51bcdb7122.json"}],'+
'"page":0,"num_pages":1,"page_size":50,"total":1,"start":0,"end":0,"uri":'+
'"/2010-04-01/Accounts/AC03c2fcd60e144e7cbeee413fcbf812a3/OutgoingCallerIds.json","first_page_uri":"/2010-04-01/Accounts/AC03c2fcd60e144e7cbeee413fcbf812a3/OutgoingCallerIds'+
'.json?Page=0&PageSize=50","previous_page_uri":null,"next_page_uri":null,"last_page_uri":"/2010-04-01/Accounts/AC03c2fcd60e144e7cbeee413fcbf812a3/OutgoingCallerIds.json?Page=0&PageSize=50"}';
// register a mock Response with the Twilio_TestHTTPMock singleton service
// for the HTTP GET method and at the Twilio Account instance URI.
Twilio_TestHTTPMock.getInstance().putResponse(
'GET',
'https://api.twilio.com/2010-04-01/Accounts/AC03c2fcd60e144e7cbeee413fcbf812a3/OutgoingCallerIds.json',
new Twilio_TestHTTPMock.Response(accountJsonResponseBody,200)
);
// Get an API client and request the Twilio Account
TwilioRestClient client = new TwilioRestClient('AC03c2fcd60e144e7cbeee413fcbf812a3', authToken);
TwilioOutgoingCallerIdList twoutcallid=client.getAccount().getOutgoingCallerIds();
System.assertNotEquals(null, twoutcallid);
List<TwilioOutgoingCallerId> twocallidList = twoutcallid.getPageData();
System.assertNotEquals(null, twocallidList);
System.assertEquals(1, twocallidList.size());
System.assertEquals('PN17c8630939e44e7e92a45c51bcdb7122', twocallidList[0].getSid());
System.assertEquals(Datetime.newInstanceGmt(2011,12,29,12,22,55),twocallidList[0].getDateCreated());
System.assertEquals(Datetime.newInstanceGmt(2011,12,29,12,22,55),twocallidList[0].getDateUpdated());
System.assertEquals('919902400323',twocallidList[0].getFriendlyName());
System.assertEquals('AC03c2fcd60e144e7cbeee413fcbf812a3',twocallidList[0].getAccountSid());
System.assertEquals('+919902400323',twocallidList[0].getPhoneNumber());
Twilio_TestHTTPMock.getInstance().putResponse(
'GET',
'https://api.twilio.com/2010-04-01/Accounts/AC03c2fcd60e144e7cbeee413fcbf812a3/OutgoingCallerIds.json?PhoneNumber=%2B919902400323',
new Twilio_TestHTTPMock.Response(accountJsonResponseBody,200)
);
map<string,string> params=new map<String,string>();
params.put('PhoneNumber','+919902400323');
twoutcallid=client.getAccount().getOutgoingCallerIds(params);
Iterator<TwilioOutgoingCallerId> it = twoutcallid.iterator();
System.assertEquals(true, it.hasNext());
TwilioOutgoingCallerId twocallid=it.next();
System.assertEquals('PN17c8630939e44e7e92a45c51bcdb7122', twocallid.getSid());
System.assertEquals(Datetime.newInstanceGmt(2011,12,29,12,22,55),twocallid.getDateCreated());
System.assertEquals(Datetime.newInstanceGmt(2011,12,29,12,22,55),twocallid.getDateUpdated());
System.assertEquals('919902400323',twocallid.getFriendlyName());
System.assertEquals('AC03c2fcd60e144e7cbeee413fcbf812a3',twocallid.getAccountSid());
System.assertEquals('+919902400323',twocallid.getPhoneNumber());
System.assertEquals(false, it.hasNext());
}
static testmethod void testOutgoingCallerID_create()
{
String accountJsonResponseBody ='{"account_sid":"AC03c2fcd60e144e7cbeee413fcbf812a3","phone_number":"+918722266012",'+
'"friendly_name":"harsha","validation_code":844863}';
// register a mock Response with the Twilio_TestHTTPMock singleton service
// for the HTTP GET method and at the Twilio Account instance URI.
Twilio_TestHTTPMock.getInstance().putResponse(
'POST',
'https://api.twilio.com/2010-04-01/Accounts/AC03c2fcd60e144e7cbeee413fcbf812a3/OutgoingCallerIds.json',
new Twilio_TestHTTPMock.Response(accountJsonResponseBody,200)
);
map<string,string> p=new map<string,string>();
p.put('PhoneNumber','+9187222660');
p.put('FriendlyName','harsha');
// Get an API client and request the Twilio Account
TwilioRestClient client = new TwilioRestClient('AC03c2fcd60e144e7cbeee413fcbf812a3', authToken);
TwilioCallerIdValidation twoutcallid = client.getAccount().getOutgoingCallerIds().create(p);
System.assertEquals('harsha',twoutcallid.getFriendlyName());
System.assertEquals('AC03c2fcd60e144e7cbeee413fcbf812a3',twoutcallid.getAccountSid());
System.assertEquals('+918722266012',twoutcallid.getPhoneNumber());
System.assertEquals('844863',twoutcallid.getValidationCode());
}
static testmethod void testOutgoingCallerID_get()
{
String accountJsonResponseBody ='{"sid":"PN17c8630939e44e7e92a45c51bcdb7122","account_sid":"AC03c2fcd60e144e7cbeee413fcbf812a3",'
+'"friendly_name":"919902400323","phone_number":"+919902400323","date_created":"Thu, 29 Dec 2011 12:22:55 +0000","date_updated":'+
'"Thu, 29 Dec 2011 12:22:55 +0000","uri":'+
'"/2010-04-01/Accounts/AC03c2fcd60e144e7cbeee413fcbf812a3/OutgoingCallerIds/PN17c8630939e44e7e92a45c51bcdb7122.json"}';
// register a mock Response with the Twilio_TestHTTPMock singleton service
// for the HTTP GET method and at the Twilio Account instance URI.
Twilio_TestHTTPMock.getInstance().putResponse(
'GET',
'https://api.twilio.com/2010-04-01/Accounts/AC03c2fcd60e144e7cbeee413fcbf812a3/OutgoingCallerIds/PN17c8630939e44e7e92a45c51bcdb7122.json',
new Twilio_TestHTTPMock.Response(accountJsonResponseBody,200)
);
// Get an API client and request the Twilio Account
TwilioRestClient client = new TwilioRestClient('AC03c2fcd60e144e7cbeee413fcbf812a3', authToken);
TwilioOutgoingCallerId twoutcallid=client.getAccount().getOutgoingCallerId('PN17c8630939e44e7e92a45c51bcdb7122');
System.assertEquals('PN17c8630939e44e7e92a45c51bcdb7122', twoutcallid.getSid());
System.assertEquals(Datetime.newInstanceGmt(2011,12,29,12,22,55),twoutcallid.getDateCreated());
System.assertEquals(Datetime.newInstanceGmt(2011,12,29,12,22,55),twoutcallid.getDateUpdated());
System.assertEquals('919902400323',twoutcallid.getFriendlyName());
System.assertEquals('AC03c2fcd60e144e7cbeee413fcbf812a3',twoutcallid.getAccountSid());
System.assertEquals('+919902400323',twoutcallid.getPhoneNumber());
TwilioOutgoingCallerId tci=new TwilioOutgoingCallerId(client);
}
static testmethod void testOutgoingCallerID_delete()
{
String accountJsonResponseBody ='';
// register a mock Response with the Twilio_TestHTTPMock singleton service
// for the HTTP GET method and at the Twilio Account instance URI.
Twilio_TestHTTPMock.getInstance().putResponse(
'DELETE',
'https://api.twilio.com/2010-04-01/Accounts/AC03c2fcd60e144e7cbeee413fcbf812a3/OutgoingCallerIds/PN17c8630939e44e7e92a45c51bcdb7122.json',
new Twilio_TestHTTPMock.Response(accountJsonResponseBody,204)
);
// Get an API client and request the Twilio Account
TwilioRestClient client = new TwilioRestClient('AC03c2fcd60e144e7cbeee413fcbf812a3', authToken);
boolean isdel=client.getAccount().getOutgoingCallerId('PN17c8630939e44e7e92a45c51bcdb7122').deleteOutgoingCallerid();
system.assertEquals(true,isdel);
}
}`
TwilioAvailablePhoneNumber.cls
`/*
Copyright (c) 2012 Twilio, Inc.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. /
/*
@param properties the properties
*/
public TwilioAvailablePhoneNumber(TwilioRestClient client, Map<String, Object> properties) {
super(client, properties);
}
public override String getResourceLocation() {
throw new TwilioRestException('AvailablePhoneNumbers do not have an instance resource location');
}
/*
Property getters
*/
/**
Gets the friendly name.
@return the friendly name
*/
public String getFriendlyName() {
return this.getProperty('friendly_name');
}
/**
Gets the phone number.
@return the phone number
*/
public String getPhoneNumber() {
return this.getProperty('phone_number');
}
/**
Gets the lata.
@return the lata
*/
public String getLata() {
return this.getProperty('lata');
}
/**
Gets the rate center.
@return the rate center
*/
public String getRateCenter() {
return this.getProperty('rate_center');
}
/**
Gets the latitude.
@return the latitude
*/
public String getLatitude() {
return this.getProperty('latitude');
}
/**
Gets the longitude.
@return the longitude
*/
public String getLongitude() {
return this.getProperty('longitude');
}
/**
Gets the region.
@return the region
*/
public String getRegion() {
return this.getProperty('region');
}
/**
Gets the postal code.
@return the postal code
*/
public String getPostalCode() {
return this.getProperty('postal_code');
}
/**
Gets the iso country.
@return the iso country
*/
public String getIsoCountry() {
return this.getProperty('iso_country');
}
/**
Gets the number capabilities.
@return the number capabilities
*/
public map<string,object> getCapabilities() {
return (Map<String,Object>)this.getObject('capabilities');
}
/**
Whether this number is new to the Twilio platform.
@return Beta status
*/
public boolean getBeta() {
return this.getPropertyBoolean('beta');
}
/**
Indicates whether this number requires an Address to be on file with Twilio.
Potential values are "any", "local", "foreign", or "none".
@return the address requirements
*/
public String getAddressRequirements() {
return this.getProperty('address_requirements');
}
/* Convenience Methods */
private boolean purchased = false;
public TwilioIncomingPhoneNumber purchase() {
if (this.purchased) {
throw new AlreadyPurchasedException('You have already purchased this number: '+getPhoneNumber());
}
Map<String,String> props = new Map<String,String>();
props.put('PhoneNumber', getPhoneNumber());
I am getting the below error when trying to deploy this to production.
API Name: Twilio_TestPhoneNumbers
Apex Class
Line: 106
Column: 31
Error Message:
Method does not exist or incorrect signature: [TwilioAvailablePhoneNumber].getAddressRequirements()
Line 106 of Twilio_TestPhoneNumbers is:
System.assertEquals('none', phnumber0.getAddressRequirements());
The method in TwilioAvailablePhoneNumber is there:
Line 157
/**
* Indicates whether this number requires an Address to be on file with Twilio.
* Potential values are "any", "local", "foreign", or "none".
*
* @return the address requirements
*/
public String getAddressRequirements() {
return this.getProperty('address_requirements');
}
I was experiencing the Script Thrown error on the Twilio_TestPhoneNumbers class and added
map<string,string> params=new map<string,string>();
params.put('AreaCode','510');
params.put('Contains','51034*****');
To that class.
Now I get the above error.
Any help is appreciated!
Twilio_TestPhoneNumbers.cls
`/*
Copyright (c) 2012 Twilio, Inc.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
@istest
private class Twilio_TestPhoneNumbers {
'"phone_number": "+15105647903","voice_url": "http://mycompany.com/handleNewCall.php","voice_method": "POST","voice_fallback_url": null,"voice_fallback_method": "POST",'+
'"voice_caller_id_lookup": null,"voice_application_sid": null,"date_created": "Mon, 16 Aug 2010 23:31:47 +0000","date_updated": "Mon, 16 Aug 2010 23:31:47 +0000",'+
'"sms_url": null,"sms_method": "POST","sms_fallback_url": null,"sms_fallback_method": "GET","sms_application_sid": null,"capabilities": {"voice": null,"sms": null},'+
'"status_callback": null,"status_callback_method": null,"api_version": "2010-04-01","uri": "/2010-04-01/Accounts/ACdc5f1e11047ebd6fe7a55f120be3a900/IncomingPhoneNumbers/PN2a0747eba6abf96b7e3c3ff0b4530f6e.json"}';
}`
TwilioAvailablePhoneNumber.cls
`/*
Copyright (c) 2012 Twilio, Inc.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
/
/*
The Class AvailablePhoneNumber.
For more information see see http://www.twilio.com/docs/api/rest/available-phone-numbers
*/
global class TwilioAvailablePhoneNumber extends TwilioResource.InstanceResource {
/**
*/
public TwilioAvailablePhoneNumber(TwilioRestClient client) {
super(client);
}
/**
*/
public TwilioAvailablePhoneNumber(TwilioRestClient client, Map<String, Object> properties) {
super(client, properties);
}
public override String getResourceLocation() {
throw new TwilioRestException('AvailablePhoneNumbers do not have an instance resource location');
}
/*
*/
/**
*/
public String getFriendlyName() {
return this.getProperty('friendly_name');
}
/**
*/
public String getPhoneNumber() {
return this.getProperty('phone_number');
}
/**
*/
public String getLata() {
return this.getProperty('lata');
}
/**
*/
public String getRateCenter() {
return this.getProperty('rate_center');
}
/**
*/
public String getLatitude() {
return this.getProperty('latitude');
}
/**
*/
public String getLongitude() {
return this.getProperty('longitude');
}
/**
*/
public String getRegion() {
return this.getProperty('region');
}
/**
*/
public String getPostalCode() {
return this.getProperty('postal_code');
}
/**
*/
public String getIsoCountry() {
return this.getProperty('iso_country');
}
/**
*/
public map<string,object> getCapabilities() {
return (Map<String,Object>)this.getObject('capabilities');
}
/**
*/
public boolean getBeta() {
return this.getPropertyBoolean('beta');
}
/**
*/
public String getAddressRequirements() {
return this.getProperty('address_requirements');
}
/* Convenience Methods */
private boolean purchased = false;
public TwilioIncomingPhoneNumber purchase() {
if (this.purchased) {
throw new AlreadyPurchasedException('You have already purchased this number: '+getPhoneNumber());
}
Map<String,String> props = new Map<String,String>();
props.put('PhoneNumber', getPhoneNumber());
}
private class AlreadyPurchasedException extends Exception {}
}`
The text was updated successfully, but these errors were encountered: