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


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

has_normal_attributes %w(phone_number city state country cost callback_url)

#cityString


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


#costInteger


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


#countryString


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


#last_billed_atTime


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

has_time_attributes %w(provisioned_at last_billed_at)

#phone_numberString


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


#provisioned_atTime


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


#stateString


# 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.


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.


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.


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.


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