class Plivo::Resources::EndUsersInterface
Public Class Methods
new(client, resource_list_json = nil)
click to toggle source
Calls superclass method
Plivo::Base::ResourceInterface::new
# File lib/plivo/resources/regulatory_compliance.rb, line 51 def initialize(client, resource_list_json = nil) @_name = 'EndUser' @_resource_type = EndUser @_identifier_string = 'end_user' super end
Public Instance Methods
create(name, last_name = nil , end_user_type)
click to toggle source
Create an EndUser
@param [String] name @param [String] last_name @param [String] end_user_type return [EndUser] EndUser
# File lib/plivo/resources/regulatory_compliance.rb, line 114 def create(name, last_name = nil , end_user_type) valid_param?(:name, name, [String, Symbol], true) valid_param?(:last_name, last_name, [String, Symbol], false) valid_param?(:end_user_type, end_user_type.capitalize, [String, Symbol], true, %w[Business Individual]) params = { name: name, last_name: last_name, end_user_type: end_user_type.capitalize } return perform_create(params) end
delete(end_user_id)
click to toggle source
Delete an EndUser
. @param [String] end_user_id
# File lib/plivo/resources/regulatory_compliance.rb, line 142 def delete(end_user_id) valid_param?(:end_user_id, end_user_id, [String, Symbol], true) EndUser.new(@_client, resource_id: end_user_id).delete end
get(end_user_id)
click to toggle source
Get an EndUser
@param [String] end_user_id return [EndUser]
# File lib/plivo/resources/regulatory_compliance.rb, line 62 def get(end_user_id) valid_param?(:end_user_id, end_user_id, [String, Symbol], true) perform_get(end_user_id) end
list(options = nil)
click to toggle source
List all EndUser
@param [Hash] options @option options [Int] :offset @option options [Int] :limit @return [Hash]
# File lib/plivo/resources/regulatory_compliance.rb, line 73 def list(options = nil) return perform_list if options.nil? valid_param?(:options, options, Hash, true) params = {} params_expected = %i[ name last_name ] params_expected.each do |param| if options.key?(param) && valid_param?(param, options[param], [String, Symbol], false) params[param] = options[param] end end if options.key?(:end_user_type) && valid_param?(:end_user_type, options[:end_user_type].capitalize,[String, Symbol], false, %w[Business Individual]) params[:end_user_type] = options[:end_user_type].capitalize 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(end_user_id, options = nil)
click to toggle source
Update an EndUser
@param [String] end_user_id @param [Hash] options return [EndUser]
# File lib/plivo/resources/regulatory_compliance.rb, line 133 def update(end_user_id, options = nil) valid_param?(:end_user_id, end_user_id, [String, Symbol], true) EndUser.new(@_client, resource_id: end_user_id).update(options) end