class Plivo::Resources::TollfreeVerificationsInterface

Public Class Methods

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

Public Instance Methods

create(number, usecase, usecase_summary, profile_uuid, optin_type, optin_image_url, volume, message_sample, callback_url = nil, callback_method = nil, extra_data = nil, additional_information = nil) click to toggle source

Create an TollfreeVerification @param [String] number @param [String] usecase @param [String] usecase_summary @param [String] profile_uuid @param [String] optin_type @param [String] optin_image_url @param [String] volume @param [String] message_sample @param [String] callback_url @param [String] callback_method @param [String] extra_data @param [String] additional_information return [TollfreeVerification] TollfreeVerification

# File lib/plivo/resources/tollfree_verification.rb, line 125
def create(number, usecase, usecase_summary, profile_uuid, optin_type, optin_image_url, volume, message_sample, callback_url = nil, callback_method = nil, extra_data = nil, additional_information = nil)
  valid_param?(:number, number, [String, Symbol], true)
  valid_param?(:usecase, usecase, [String, Symbol], true)
  valid_param?(:usecase_summary, usecase_summary, [String, Symbol], true)
  valid_param?(:profile_uuid, profile_uuid, [String, Symbol], true)
  valid_param?(:optin_type, optin_type, [String, Symbol], true)
  valid_param?(:optin_image_url, optin_image_url, [String, Symbol], true)
  valid_param?(:volume, volume, [String, Symbol], true)
  valid_param?(:message_sample, message_sample, [String, Symbol], true)
  valid_param?(:callback_url, callback_url, [String, Symbol], false)
  valid_param?(:callback_method, callback_method, [String, Symbol], false)
  valid_param?(:extra_data, extra_data, [String, Symbol], false)
  valid_param?(:additional_information, additional_information, [String, Symbol], false)

  params = {
  number: number,
  usecase: usecase,
  usecase_summary: usecase_summary,
  profile_uuid: profile_uuid,
  optin_type: optin_type,
  optin_image_url: optin_image_url,
  volume: volume,
  message_sample: message_sample,
  callback_url: callback_url,
  callback_method: callback_method,
  extra_data: extra_data,
  additional_information: additional_information
  }.delete_if { |key, value| value.nil? }

  return perform_create(params)
end
delete(uuid) click to toggle source

Delete an TollfreeVerification. @param [String] uuid

# File lib/plivo/resources/tollfree_verification.rb, line 171
def delete(uuid)
  valid_param?(:uuid, uuid, [String, Symbol], true)
  TollfreeVerification.new(@_client,
                  resource_id: uuid).delete
end
get(uuid) click to toggle source

Get an TollfreeVerification @param [String] uuid return [TollfreeVerification]

# File lib/plivo/resources/tollfree_verification.rb, line 69
def get(uuid)
  valid_param?(:uuid, uuid, [String, Symbol], true)
  perform_get(uuid)
end
list(options = nil) click to toggle source

List all TollfreeVerification @param [Hash] options @option options [Int] :offset @option options [Int] :limit @return [Hash]

# File lib/plivo/resources/tollfree_verification.rb, line 80
def list(options = nil)
  return perform_list if options.nil?
  valid_param?(:options, options, Hash, true)

  params = {}
  params_expected = %i[ profile_uuid number status created__lt created__gt usecase created__lte created__gte ]
  params_expected.each do |param|
    if options.key?(param) &&
       valid_param?(param, options[param], [String, Symbol], true)
      params[param] = options[param]
    end
  end

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

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

  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

  perform_list(params)
end
update(uuid, options = nil) click to toggle source

Update an TollfreeVerification @param [String] uuid @param [Hash] options return [TollfreeVerification]

# File lib/plivo/resources/tollfree_verification.rb, line 162
def update(uuid, options = nil)
  valid_param?(:uuid, uuid, [String, Symbol], true)
  TollfreeVerification.new(@_client,
                  resource_id: uuid).update(options)
end