class Plivo::Resources::SessionInterface
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_session.rb, line 33 def initialize(client, resource_list_json = nil) @_name = 'Verify/Session' @_resource_type = Session @_identifier_string = 'session_uuid' super end
Public Instance Methods
create(app_uuid = nil, recipient = nil,channel = nil, url = nil, method = nil, locale=nil, brand_name=nil, app_hash=nil, code_length=nil, dtmf=nil, fraud_check=nil)
click to toggle source
# File lib/plivo/resources/verify_session.rb, line 45 def create(app_uuid = nil, recipient = nil,channel = nil, url = nil, method = nil, locale=nil, brand_name=nil, app_hash=nil, code_length=nil, dtmf=nil, fraud_check=nil) valid_param?(:app_uuid, app_uuid, [String, Symbol], false) valid_param?(:recipient, recipient, [Integer, String, Symbol], true) valid_param?(:channel, channel, [String, Symbol], false) valid_param?(:url, url, [String], false) valid_param?(:method, method, String, false, %w[POST GET]) valid_param?(:locale, locale, [String, Symbol], false) valid_param?(:brand_name, brand_name, [String, Symbol], false) valid_param?(:app_hash, app_hash, [String, Symbol], false) valid_param?(:code_length, code_length,[Integer,Symbol], false) valid_param?(:dtmf, dtmf,[Integer,Symbol], false) valid_param?(:fraud_check, fraud_check, [String, Symbol], false) params = { app_uuid: app_uuid, recipient: recipient, channel: channel, url: url, method: method, locale: locale, brand_name: brand_name, app_hash: app_hash, code_length: code_length, dtmf:dtmf, fraud_check:fraud_check } perform_create(params) end
get(session_uuid)
click to toggle source
@param [String] session_uuid
# File lib/plivo/resources/verify_session.rb, line 41 def get(session_uuid) perform_get(session_uuid) end
list(options = nil)
click to toggle source
# File lib/plivo/resources/verify_session.rb, line 74 def list(options = nil) return perform_list if options.nil? valid_param?(:options, options, Hash, true) params = {} params_expected = %i[ subaccount status session_time__gt session_time__gte session_time__lt session_time__lte session_time country alias app_uuid recipient brand_name app_hash ] 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, Integer], true) 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
validate(session_uuid = nil, otp = nil)
click to toggle source
# File lib/plivo/resources/verify_session.rb, line 108 def validate(session_uuid = nil, otp = nil) valid_param?(:session_uuid, session_uuid, [String, Symbol], true) valid_param?(:otp, otp, [String], true) id = session_uuid params = { otp: otp } perform_action_with_identifier(id, 'POST', params) end