Class: Plivo::Resources::TollfreeVerificationsInterface

Inherits:
Base::ResourceInterface show all
Defined in:
lib/plivo/resources/tollfree_verification.rb

Constant Summary

Constants included from Utils

Utils::TYPE_WHITELIST

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, resource_list_json = nil) ⇒ TollfreeVerificationsInterface

Returns a new instance of TollfreeVerificationsInterface.



62
63
64
65
66
67
# File 'lib/plivo/resources/tollfree_verification.rb', line 62

def initialize(client, resource_list_json = nil)
  @_name = 'TollfreeVerification'
  @_resource_type = TollfreeVerification
  @_identifier_string = 'tollfree_verification'
  super
end

Instance Method Details

#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, terms_and_conditions_link = nil, privacy_policy_link = nil, optin_message = nil, help_message = nil) ⇒ Object

Create an TollfreeVerification return [TollfreeVerification] TollfreeVerification

Parameters:

  • number (String)
  • usecase (String)
  • usecase_summary (String)
  • profile_uuid (String)
  • optin_type (String)
  • optin_image_url (String)
  • volume (String)
  • message_sample (String)
  • callback_url (String) (defaults to: nil)
  • callback_method (String) (defaults to: nil)
  • extra_data (String) (defaults to: nil)
  • additional_information (String) (defaults to: nil)
  • terms_and_conditions_link (String) (defaults to: nil)
  • privacy_policy_link (String) (defaults to: nil)
  • optin_message (String) (defaults to: nil)
  • help_message (String) (defaults to: nil)


133
134
135
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
162
163
164
165
166
167
168
169
170
171
# File 'lib/plivo/resources/tollfree_verification.rb', line 133

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, terms_and_conditions_link = nil, privacy_policy_link = nil, optin_message = nil, help_message = 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)
  valid_param?(:terms_and_conditions_link, terms_and_conditions_link, [String, Symbol], false)
  valid_param?(:privacy_policy_link, privacy_policy_link, [String, Symbol], false)
  valid_param?(:optin_message, optin_message, [String, Symbol], false)
  valid_param?(:help_message, help_message, [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,
  terms_and_conditions_link: terms_and_conditions_link,
  privacy_policy_link: privacy_policy_link,
  optin_message: optin_message,
  help_message: help_message
  }.delete_if { |key, value| value.nil? }

  return perform_create(params)
end

#delete(uuid) ⇒ Object

Delete an TollfreeVerification.

Parameters:

  • uuid (String)


187
188
189
190
191
# File 'lib/plivo/resources/tollfree_verification.rb', line 187

def delete(uuid)
  valid_param?(:uuid, uuid, [String, Symbol], true)
  TollfreeVerification.new(@_client,
                  resource_id: uuid).delete
end

#get(uuid) ⇒ Object

Get an TollfreeVerification return [TollfreeVerification]

Parameters:

  • uuid (String)


73
74
75
76
# File 'lib/plivo/resources/tollfree_verification.rb', line 73

def get(uuid)
  valid_param?(:uuid, uuid, [String, Symbol], true)
  perform_get(uuid)
end

#list(options = nil) ⇒ Hash

List all TollfreeVerification

Parameters:

  • options (Hash) (defaults to: nil)

Options Hash (options):

  • :offset (Int)
  • :limit (Int)

Returns:

  • (Hash)


84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/plivo/resources/tollfree_verification.rb', line 84

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) ⇒ Object

Update an TollfreeVerification return [TollfreeVerification]

Parameters:

  • uuid (String)
  • options (Hash) (defaults to: nil)


178
179
180
181
182
# File 'lib/plivo/resources/tollfree_verification.rb', line 178

def update(uuid, options = nil)
  valid_param?(:uuid, uuid, [String, Symbol], true)
  TollfreeVerification.new(@_client,
                  resource_id: uuid).update(options)
end