Class: Phaxio::Resources::PhoneNumber

Inherits:
Phaxio::Resource show all
Defined in:
lib/phaxio/resources/phone_number.rb

Overview

Provides functionality for viewing and managing phone numbers.

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Phaxio::Resource

response_collection, response_record

Instance Attribute Details

#callback_urlString

Returns The callback URL associated with the phone number.

Returns:

  • (String)

    The callback URL associated with the phone number.


26
# File 'lib/phaxio/resources/phone_number.rb', line 26

has_normal_attributes %w(phone_number city state country cost callback_url)

#cityString

Returns The city associated with the phone number.

Returns:

  • (String)

    The city associated with the phone number.


# File 'lib/phaxio/resources/phone_number.rb', line 11

#costInteger

Returns The cost of the phone number in cents.

Returns:

  • (Integer)

    The cost of the phone number in cents.


# File 'lib/phaxio/resources/phone_number.rb', line 20

#countryString

Returns The country associated with the phone number.

Returns:

  • (String)

    The country associated with the phone number.


# File 'lib/phaxio/resources/phone_number.rb', line 17

#last_billed_atTime

Returns The last time the phone number was billed.

Returns:

  • (Time)

    The last time the phone number was billed.


34
# File 'lib/phaxio/resources/phone_number.rb', line 34

has_time_attributes %w(provisioned_at last_billed_at)

#phone_numberString

Returns The phone number itself, in E.164 format.

Returns:

  • (String)

    The phone number itself, in E.164 format.


# File 'lib/phaxio/resources/phone_number.rb', line 8

#provisioned_atTime

Returns The time at which the phone number was provisioned.

Returns:

  • (Time)

    The time at which the phone number was provisioned.


# File 'lib/phaxio/resources/phone_number.rb', line 28

#stateString

Returns The state associated with the phone number.

Returns:

  • (String)

    The state associated with the phone number.


# File 'lib/phaxio/resources/phone_number.rb', line 14

Class Method Details

.create(params = {}) ⇒ Phaxio::Resources::PhoneNumber Also known as: provision

Provision a new phone number.

Parameters:

  • params (Hash) (defaults to: {})

    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.

Returns:

Raises:

See Also:


48
49
50
51
# File 'lib/phaxio/resources/phone_number.rb', line 48

def create params = {}
  response = Client.request :post, phone_numbers_endpoint, params
  response_record response
end

.delete(phone_number, params = {}) ⇒ Object Also known as: release

Release a phone number that you no longer need. Once a phone number is released you will no longer be charged for it.

Parameters:

  • phone_number (String)

    The phone number itself, in E.164 format, which you want to release.

  • params (Hash) (defaults to: {})

    A hash of parameters to send to Phaxio. This action has no unique parameters.

Returns:

  • true

Raises:

See Also:


94
95
96
97
# 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(phone_number, params = {}) ⇒ Phaxio::Resources::PhoneNumber Also known as: find, retrieve

Get information about a specific phone number.

Parameters:

  • phone_number (String)

    The phone number itself, in E.164 format, which you want to get information about.

  • params (Hash) (defaults to: {})

    A hash of parameters to send to Phaxio. This action has no unique parameters.

Returns:

Raises:

See Also:


62
63
64
65
# 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

.list(params = {}) ⇒ Phaxio::Resource::Collection<Phaxio::Resources::PhoneNumber>

Note:

This action accepts paging parameters:

  • per_page [Integer] - The maximum number of results to return per call (i.e. “page”). Max 1000.

  • page [Integer] - The page number to return for the request. 1-based.

Get a list of phone numbers that you currently own on Phaxio.

Parameters:

  • params (Hash) (defaults to: {})

    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.

Returns:

Raises:

See Also:


80
81
82
83
# File 'lib/phaxio/resources/phone_number.rb', line 80

def list params = {}
  response = Client.request :get, phone_numbers_endpoint, params
  response_collection response
end