Class: Plivo::Resources::EndUser

Inherits:
Base::Resource show all
Defined in:
lib/plivo/resources/regulatory_compliance.rb

Constant Summary

Constants included from Utils

Utils::TYPE_WHITELIST

Instance Attribute Summary

Attributes inherited from Base::Resource

#id

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, options = nil) ⇒ EndUser

Returns a new instance of EndUser.



6
7
8
9
10
# File 'lib/plivo/resources/regulatory_compliance.rb', line 6

def initialize(client, options = nil)
  @_name = 'EndUser'
  @_identifier_string = 'end_user'
  super
end

Instance Method Details

#deleteObject



34
35
36
# File 'lib/plivo/resources/regulatory_compliance.rb', line 34

def delete
  perform_delete
end

#to_sObject



38
39
40
41
42
43
44
45
46
47
# File 'lib/plivo/resources/regulatory_compliance.rb', line 38

def to_s
  {
    api_id: @api_id,
    end_user_id: @end_user_id,
    end_user_type: @end_user_type,
    name: @name,
    last_name: @last_name,
    created_at: @created_at
  }.delete_if { |key, value| value.nil? }.to_s
end

#update(options = nil) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/plivo/resources/regulatory_compliance.rb', line 12

def update(options = nil)
  return perform_update({}) 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

  perform_update(params)
end