class Phaxio::Resources::PhoneNumber
Provides functionality for viewing and managing phone numbers.
Constants
- PHONE_NUMBERS_PATH
Private Class Methods
Provision a new phone number. @param params [Hash]
A hash of parameters to send to Phaxio: - *country_code* [Integer] - The country code (E.164) of the number you'd like to provision. - *area_code* [Integer] - The area code of the number you'd like to provision. - *callback_url* [String] - A callback URL that we'll post to when a fax is received by this number. This will override the global receive callback URL, if you have one specified.
@return [Phaxio::Resources::PhoneNumber] The newly provisioned number. @raise [Phaxio::Error::PhaxioError] @see www.phaxio.com/docs/api/v2/phone_numbers/provision
# File lib/phaxio/resources/phone_number.rb, line 48 def create params = {} response = Client.request :post, phone_numbers_endpoint, params response_record response end
Release a phone number that you no longer need. Once a phone number is released you will no longer be charged for it. @param phone_number [String]
The phone number itself, in E.164 format, which you want to release.
@param params [Hash]
A hash of parameters to send to Phaxio. This action has no unique parameters.
@return true @raise [Phaxio::Error::PhaxioError] @see www.phaxio.com/docs/api/v2/phone_numbers/release
# File lib/phaxio/resources/phone_number.rb, line 94 def delete phone_number, params = {} Client.request :delete, phone_number_endpoint(phone_number), params true end
Get information about a specific phone number. @param phone_number [String]
The phone number itself, in E.164 format, which you want to get information about.
@param params [Hash]
A hash of parameters to send to Phaxio. This action has no unique parameters.
@return [Phaxio::Resources::PhoneNumber] The requested number. @raise [Phaxio::Error::PhaxioError] @see www.phaxio.com/docs/api/v2/phone_numbers/get_number
# File lib/phaxio/resources/phone_number.rb, line 62 def get phone_number, params = {} response = Client.request :get, phone_number_endpoint(phone_number), params response_record response end
@macro paging Get a list of phone numbers that you currently own on Phaxio
. @param params [Hash]
A hash of parameters to send to Phaxio. - *country_code* [Integer] - An E.164 country code that you'd like to filter by. - *area_code* [Integer] - An area code that you'd like to filter by. If an area code is specified, then *country_code* is required.
@return [Phaxio::Resource::Collection<Phaxio::Resources::PhoneNumber>]
A collection of phone numbers.
@raise [Phaxio::Error::PhaxioError] @see www.phaxio.com/docs/api/v2/phone_numbers/list
# File lib/phaxio/resources/phone_number.rb, line 80 def list params = {} response = Client.request :get, phone_numbers_endpoint, params response_collection response end
# File lib/phaxio/resources/phone_number.rb, line 106 def phone_number_endpoint phone_number "#{phone_numbers_endpoint}/#{phone_number}" end
# File lib/phaxio/resources/phone_number.rb, line 102 def phone_numbers_endpoint PHONE_NUMBERS_PATH end