Class: Plivo::Resources::BrandInterface
- Inherits:
-
Base::ResourceInterface
- Object
- Base::ResourceInterface
- Plivo::Resources::BrandInterface
- Defined in:
- lib/plivo/resources/brand.rb
Constant Summary
Constants included from Utils
Instance Method Summary collapse
-
#create(options = nil) ⇒ Object
Create a new brand.
-
#delete(brand_id) ⇒ Object
Delete Brand.
-
#get(brand_id) ⇒ Brand
Get an Brand.
-
#get_usecases(brand_id) ⇒ Object
Get BrandUsecase.
-
#initialize(client, resource_list_json = nil) ⇒ BrandInterface
constructor
A new instance of BrandInterface.
-
#list(options = nil) ⇒ Hash
List all Brand.
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) ⇒ BrandInterface
Returns a new instance of BrandInterface.
20 21 22 23 24 25 |
# File 'lib/plivo/resources/brand.rb', line 20 def initialize(client, resource_list_json = nil) @_name = '10dlc/Brand' @_resource_type = Brand @_identifier_string = 'brand_id' super end |
Instance Method Details
#create(options = nil) ⇒ Object
Create a new brand
66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/plivo/resources/brand.rb', line 66 def create(=nil) valid_param?(:options, , Hash, true) if not [:brand_alias] raise_invalid_request("brand_alias must be provided") end if not [:brand_type] raise_invalid_request("brand_type must be provided") end if not [:profile_uuid] raise_invalid_request("profile_uuid must be provided") end perform_create() end |
#delete(brand_id) ⇒ Object
Delete Brand
92 93 94 95 |
# File 'lib/plivo/resources/brand.rb', line 92 def delete(brand_id) valid_param?(:brand_id, brand_id, [String, Symbol], true) perform_delete(brand_id) end |
#get(brand_id) ⇒ Brand
Get an Brand
31 32 33 34 |
# File 'lib/plivo/resources/brand.rb', line 31 def get(brand_id) valid_param?(:brand_id, brand_id, [String, Symbol], true) perform_get(brand_id) end |
#get_usecases(brand_id) ⇒ Object
Get BrandUsecase
83 84 85 86 87 |
# File 'lib/plivo/resources/brand.rb', line 83 def get_usecases(brand_id) valid_param?(:brand_id, brand_id, [String, Symbol], true) identifier = brand_id + '/usecases' perform_action_with_identifier(identifier, 'GET', nil) end |
#list(options = nil) ⇒ Hash
List all Brand
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/plivo/resources/brand.rb', line 44 def list(=nil) return perform_list_without_object if .nil? params = {} %i[status type limit offset].each do |param| if .key?(param) && valid_param?(param, [param], [String, 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 |