Class: Plivo::Resources::PhoneNumber

Inherits:
Base::Resource show all
Defined in:
lib/plivo/resources/numbers.rb

Constant Summary

Constants included from Utils

Utils::TYPE_WHITELIST

Instance Attribute Summary

Attributes inherited from Base::Resource

#id

Instance Method Summary collapse

Methods included from Utils

expected_type?, expected_value?, raise_invalid_request, valid_account?, valid_mainaccount?, valid_param?, valid_signature?, valid_subaccount?

Constructor Details

#initialize(client, options = nil) ⇒ PhoneNumber

Returns a new instance of PhoneNumber.



6
7
8
9
10
# File 'lib/plivo/resources/numbers.rb', line 6

def initialize(client, options = nil)
  @_name = 'PhoneNumber'
  @_identifier_string = 'number'
  super
end

Instance Method Details

#buy(app_id = nil, verification_info = nil) ⇒ Object



12
13
14
15
16
17
# File 'lib/plivo/resources/numbers.rb', line 12

def buy(app_id = nil, verification_info = nil)
  params = {}
  params[:app_id] = app_id unless app_id.nil?
  params[:verification_info] = verification_info unless verification_info.nil?
  perform_action(nil, 'POST', params, true)
end

#to_sObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/plivo/resources/numbers.rb', line 19

def to_s
  {
    country: @country,
    lata: @lata,
    monthly_rental_rate: @monthly_rental_rate,
    number: @number,
    type: @type,
    prefix: @prefix,
    rate_center: @rate_center,
    region: @region,
    resource_uri: @resource_uri,
    restriction: @restriction,
    restriction_text: @restriction_text,
    setup_rate: @setup_rate,
    sms_enabled: @sms_enabled,
    sms_rate: @sms_rate,
    voice_enabled: @voice_enabled,
    voice_rate: @voice_rate
  }.to_s
end