Class: Plivo::Resources::ProfileInterface
- Inherits:
-
Base::ResourceInterface
- Object
- Base::ResourceInterface
- Plivo::Resources::ProfileInterface
- Defined in:
- lib/plivo/resources/profile.rb
Constant Summary
Constants included from Utils
Instance Method Summary collapse
-
#create(options = nil) ⇒ Object
Create a new Profile.
-
#delete(profile_uuid) ⇒ Object
Delete an Profile.
-
#get(profile_uuid) ⇒ Profile
Get an Profile.
-
#initialize(client, resource_list_json = nil) ⇒ ProfileInterface
constructor
A new instance of ProfileInterface.
-
#list(options = nil) ⇒ Object
List all Profile.
-
#update(profile_uuid, options = nil) ⇒ Object
Update a Profile {, ‘authorized_contact’: {}, ‘entity_type’:”, ‘vertical’: ”, ‘company_name’: ”, ‘website’:”}.
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) ⇒ ProfileInterface
Returns a new instance of ProfileInterface.
19 20 21 22 23 24 |
# File 'lib/plivo/resources/profile.rb', line 19 def initialize(client, resource_list_json = nil) @_name = 'Profile' @_resource_type = Profile @_identifier_string = 'profile_uuid' super end |
Instance Method Details
#create(options = nil) ⇒ Object
Create a new Profile
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/plivo/resources/profile.rb', line 64 def create( = nil) valid_param?(:options, , Hash, true) if not [:profile_alias] raise_invalid_request("profile_alias must be provided") end if not [:customer_type] raise_invalid_request("customer_type must be provided") end if not [:entity_type] raise_invalid_request("entity_type must be provided") end if not [:company_name] raise_invalid_request("company_name must be provided") end if not [:vertical] raise_invalid_request("vertical must be provided") end perform_create() end |
#delete(profile_uuid) ⇒ Object
Delete an Profile
57 58 59 60 |
# File 'lib/plivo/resources/profile.rb', line 57 def delete(profile_uuid) valid_param?(:profile_uuid, profile_uuid, [String, Symbol], true) perform_action_with_identifier(profile_uuid, 'DELETE', nil) end |
#get(profile_uuid) ⇒ Profile
Get an Profile
30 31 32 33 |
# File 'lib/plivo/resources/profile.rb', line 30 def get(profile_uuid) valid_param?(:profile_uuid, profile_uuid, [String, Symbol], true) perform_get(profile_uuid) end |
#list(options = nil) ⇒ Object
List all Profile
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/plivo/resources/profile.rb', line 36 def list( = nil) return perform_list_without_object if .nil? params = {} %i[offset limit].each do |param| if .key?(param) && valid_param?(param, [param], [Integer, Integer], true) params[param] = [param] end end if .key?(:limit) && ([:limit] > 20 || [: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 if .key?(:offset) && [:offset] < 0 raise_invalid_request("Offset can't be negative") end perform_list_without_object(params) end |
#update(profile_uuid, options = nil) ⇒ Object
Update a Profile {, ‘authorized_contact’: {}, ‘entity_type’:”, ‘vertical’: ”, ‘company_name’: ”, ‘website’:”}
87 88 89 90 |
# File 'lib/plivo/resources/profile.rb', line 87 def update(profile_uuid, = nil) valid_param?(:options, , Hash, true) perform_action_with_identifier(profile_uuid, "POST", ) end |