public static PhoneNumber create ( final BandwidthClient client , final Map < String , Object > params ) throws Exception { final String uri = client . getUserResourceUri ( BandwidthConstants . PHONE_NUMBER_URI_PATH ) ; final RestResponse createResponse = client . post ( uri , params ) ; final RestResponse getResponse = client . get ( createResponse . getLocation ( ) , null ) ; final JSONObject jsonObject = toJSONObject ( getResponse ) ; return new PhoneNumber ( client , jsonObject ) ; }
Factory method to allocate a phone number given a set of params . Note that this assumes that the phone number has been previously search for as an AvailableNumber