lib/plivo/resources/brand.rb in plivo-4.29.0 vs lib/plivo/resources/brand.rb in plivo-4.30.0
- old
+ new
@@ -36,27 +36,46 @@
##
# List all Brand
# @param [Hash] options
# @option options [String] :type
# @option options [Status] :status
+ # @option options [Status] :limit
+ # @option options [Status] :offset
# @return [Hash]
def list(options=nil)
return perform_list_without_object if options.nil?
params = {}
- %i[status type].each do |param|
+ %i[status type limit offset].each do |param|
if options.key?(param) && valid_param?(param, options[param],
- [String], true)
+ [String, Integer], true)
params[param] = options[param]
end
- end
+ end
+ 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
+ if options.key?(:offset) && options[:offset] < 0
+ raise_invalid_request("Offset can't be negative")
+ end
perform_list_without_object(params)
end
##
# Create a new brand
- def create(params)
- perform_create(params)
+ def create(options=nil)
+ valid_param?(:options, options, Hash, true)
+ if not options[:brand_alias]
+ raise_invalid_request("brand_alias must be provided")
+ end
+ if not options[:brand_type]
+ raise_invalid_request("brand_type must be provided")
+ end
+ if not options[:profile_uuid]
+ raise_invalid_request("profile_uuid must be provided")
+ end
+ perform_create(options)
end
end
end
end
\ No newline at end of file