Class: Plivo::Resources::ComplianceDocumentTypesInterface

Inherits:
Base::ResourceInterface show all
Defined in:
lib/plivo/resources/regulatory_compliance.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) ⇒ ComplianceDocumentTypesInterface



170
171
172
173
174
175
# File 'lib/plivo/resources/regulatory_compliance.rb', line 170

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

Instance Method Details

#get(document_type_id) ⇒ ComplianceDocumentType

Get a ComplianceDocumentType



180
181
182
183
# File 'lib/plivo/resources/regulatory_compliance.rb', line 180

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

#list(options = nil) ⇒ Hash

List all ComplianceDocumentTypes

Options Hash (options):

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


190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# File 'lib/plivo/resources/regulatory_compliance.rb', line 190

def list(options = nil)
  return perform_list if options.nil?
  valid_param?(:options, options, Hash, false)

  params = {}
  %i[offset limit].each do |param|
    if options.key?(param) && valid_param?(param, options[param],
                                           [Integer], false)
      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