Class: Plivo::Resources::Number
Instance Attribute Summary
#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) ⇒ Number
Returns a new instance of Number.
116
117
118
119
120
|
# File 'lib/plivo/resources/numbers.rb', line 116
def initialize(client, options = nil)
@_name = 'Number'
@_identifier_string = 'number'
super
end
|
Instance Method Details
#delete ⇒ Object
142
143
144
|
# File 'lib/plivo/resources/numbers.rb', line 142
def delete
perform_delete
end
|
#to_s ⇒ Object
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
# File 'lib/plivo/resources/numbers.rb', line 146
def to_s
{
api_id: @api_id,
added_on: @added_on,
alias: @alias,
application: @application,
carrier: @carrier,
monthly_rental_rate: @monthly_rental_rate,
number: @number,
number_type: @number_type,
region: @region,
resource_uri: @resource_uri,
sms_enabled: @sms_enabled,
sms_rate: @sms_rate,
sub_account: @sub_account,
voice_enabled: @voice_enabled,
voice_rate: @voice_rate
}.to_s
end
|
#update(options = nil) ⇒ Object
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
# File 'lib/plivo/resources/numbers.rb', line 122
def update(options = nil)
valid_param?(:options, options, Hash, true)
params = {}
if options.key?(:subaccount) &&
valid_subaccount?(options[:subaccount], true)
params[:subaccount] = options[:subaccount]
end
%i[alias app_id].each do |param|
if options.key?(param) &&
valid_param?(param, options[param], [String, Symbol], true)
params[param] = options[param]
end
end
perform_update(params)
end
|