class Plivo::Resources::VerifyCallerIdInterface

Public Class Methods

new(client, resource_list_json = nil) click to toggle source
Calls superclass method Plivo::Base::ResourceInterface::new
# File lib/plivo/resources/verify_caller_id.rb, line 25
def initialize(client, resource_list_json = nil)
  @_name = 'VerifiedCallerId'
  @_resource_type = Verify
  @_identifier_string = 'api_id'
  super
end

Public Instance Methods

delete(phone_number) click to toggle source
# File lib/plivo/resources/verify_caller_id.rb, line 105
def delete(phone_number)
  perform_delete(phone_number, nil)
end
get(phone_number = nil) click to toggle source
# File lib/plivo/resources/verify_caller_id.rb, line 68
def get(phone_number = nil)
  valid_param?(:phone_number, phone_number, [String], true)
  perform_get(phone_number)
end
initiate(phone_number = nil, channel = nil, alias_ = nil, subaccount = nil) click to toggle source
# File lib/plivo/resources/verify_caller_id.rb, line 32
def initiate(phone_number = nil, channel = nil, alias_ = nil, subaccount = nil)
  valid_param?(:phone_number, phone_number, [String], true)
  valid_param?(:channel, channel, [String], false)
  valid_param?(:alias, alias_, [String], false)
  valid_param?(:subaccount, subaccount, [String], false)

  params = {
    phone_number: phone_number,
    channel: channel,
    alias: alias_,
    subaccount: subaccount
  }
  perform_create(params)
end
list(options = nil) click to toggle source
# File lib/plivo/resources/verify_caller_id.rb, line 73
def list(options = nil)
  return perform_list_without_object if options.nil?
  valid_param?(:options, options, Hash, false)

  params = {}
  params_expected = %i[subaccount country alias]

  params_expected.each do |param|
    if options.key?(param) &&
      valid_param?(param, options[param], [String, Symbol], false)
      params[param] = options[param]
    end
  end

  %i[offset limit].each do |param|
    if options.key?(param) &&
      valid_param?(param, options[param], [Integer, Integer], false)
      params[param] = options[param]
    end
  end

  if options.key?(:limit) &&
    (options[:limit] > 20 || options[:limit] <= 0)
    raise_invalid_request('The maximum number of results that can be '\
                            "fetched is 20. limit can't be more than 20 or less than 1")
  end

  raise_invalid_request("Offset can't be negative") if options.key?(:offset) && options[:offset] < 0

  perform_list_without_object(params)
end
update(phone_number = nil, subaccount = nil, alias_ = nil) click to toggle source
# File lib/plivo/resources/verify_caller_id.rb, line 57
def update(phone_number = nil, subaccount = nil, alias_ = nil)
  valid_param?(:phone_number, phone_number, [String], true)
  valid_param?(:subaccount, subaccount, [String], false)
  valid_param?(:alias, alias_, [String], false)
  params = {
    subaccount: subaccount,
    alias: alias_
  }
  perform_action_with_identifier(phone_number, 'POST', params)
end
verify(verification_uuid = nil, otp = nil) click to toggle source
# File lib/plivo/resources/verify_caller_id.rb, line 47
def verify(verification_uuid = nil, otp = nil)
  valid_param?(:verification_uuid, verification_uuid, [String], true)
  valid_param?(:otp, otp, [String], true)
  id = 'Verification/' + verification_uuid
  params = {
    otp: otp
  }
  perform_action_with_identifier(id, 'POST', params)
end