Class: Plivo::Resources::PhoneNumberCompliance

Inherits:
Base::Resource show all
Defined in:
lib/plivo/resources/phone_number_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) ⇒ PhoneNumberCompliance

Returns a new instance of PhoneNumberCompliance.



55
56
57
58
59
# File 'lib/plivo/resources/phone_number_compliance.rb', line 55

def initialize(client, options = nil)
  @_name = 'PhoneNumber/Compliance'
  @_identifier_string = 'compliance_id'
  super
end

Instance Method Details

#deleteObject



72
73
74
# File 'lib/plivo/resources/phone_number_compliance.rb', line 72

def delete
  perform_delete
end

#to_sObject



76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/plivo/resources/phone_number_compliance.rb', line 76

def to_s
  {
    api_id: @api_id,
    compliance_id: @compliance_id,
    alias: @alias,
    status: @status,
    country_iso: @country_iso,
    number_type: @number_type,
    user_type: @user_type,
    created_at: @created_at,
    updated_at: @updated_at
  }.delete_if { |key, value| value.nil? }.to_s
end

#update(params) ⇒ Object



61
62
63
64
65
66
67
68
69
70
# File 'lib/plivo/resources/phone_number_compliance.rb', line 61

def update(params)
  unless @id
    raise_invalid_request("Cannot update a #{@_name} resource "\
                            'without an identifier')
  end

  response_json = @_client.send_request(@_resource_uri, 'PATCH', params, nil, true, is_voice_request: false)
  parse_and_set(response_json)
  self
end