Class: Plivo::Resources::Number

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

GetSortedQueryParamString?, compute_signatureV3?, expected_type?, expected_value?, generate_url?, getMapFromQueryString?, is_one_among_string_url?, multi_valid_param?, raise_invalid_request, valid_account?, valid_date_format?, valid_mainaccount?, valid_multiple_destination_integers?, valid_multiple_destination_nos?, valid_param?, valid_range?, valid_signature?, valid_signatureV3?, valid_subaccount?, valid_url?

Constructor Details

#initialize(client, options = nil) ⇒ Number

Returns a new instance of Number.



130
131
132
133
134
# File 'lib/plivo/resources/numbers.rb', line 130

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

Instance Method Details

#deleteObject



163
164
165
# File 'lib/plivo/resources/numbers.rb', line 163

def delete
  perform_delete
end

#to_sObject



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/plivo/resources/numbers.rb', line 167

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,
    tendlc_campaign_id: @tendlc_campaign_id,
    tendlc_registration_status: @tendlc_registration_status,
    toll_free_sms_verification: @toll_free_sms_verification,
    renewal_date: @renewal_date,
    cnam_lookup: @cnam_lookup
  }.to_s
end

#update(options = nil) ⇒ Object



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/plivo/resources/numbers.rb', line 136

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 cnam_lookup].each do |param|
    if options.key?(param) &&
       valid_param?(param, options[param], [String, Symbol], true)
      params[param] = options[param]
    end
  end

  %i[verification_info].each do |param|
    if options.key?(param) &&
        valid_param?(param, options[param], Hash, true)
      params[param] = options[param]
    end
  end

  perform_update(params)
end