Class: Plivo::Resources::Shortcode
- Inherits:
-
Base::Resource
- Object
- Base::Resource
- Plivo::Resources::Shortcode
- Defined in:
- lib/plivo/resources/powerpacks.rb
Constant Summary
Constants included from Utils
Instance Attribute Summary
Attributes inherited from Base::Resource
Instance Method Summary collapse
- #find(shortcode) ⇒ Object
-
#initialize(client, options = nil) ⇒ Shortcode
constructor
A new instance of Shortcode.
- #list(options = nil) ⇒ Object
Methods included from Utils
expected_type?, expected_value?, raise_invalid_request, valid_account?, valid_mainaccount?, valid_param?, valid_signature?, valid_subaccount?
Constructor Details
#initialize(client, options = nil) ⇒ Shortcode
Returns a new instance of Shortcode.
426 427 428 429 430 |
# File 'lib/plivo/resources/powerpacks.rb', line 426 def initialize(client, = nil) @_name = 'Shortcode' @_identifier_string = 'number_pool_id' super end |
Instance Method Details
#find(shortcode) ⇒ Object
454 455 456 457 |
# File 'lib/plivo/resources/powerpacks.rb', line 454 def find(shortcode) perform_custom_action_apiresponse('NumberPool/' + @number_pool_id + '/Shortcode/' + shortcode.to_s , 'GET') end |
#list(options = nil) ⇒ Object
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 |
# File 'lib/plivo/resources/powerpacks.rb', line 431 def list( = nil) return perform_custom_action_apiresponse('NumberPool/' + @number_pool_id + '/Shortcode', 'GET') 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_custom_action_apiresponse('NumberPool/' + @number_pool_id + '/Shortcode', 'GET') end |