Class: Plivo::Resources::Application
- Inherits:
-
Base::Resource
- Object
- Base::Resource
- Plivo::Resources::Application
- Defined in:
- lib/plivo/resources/applications.rb
Constant Summary
Constants included from Utils
Instance Attribute Summary
Attributes inherited from Base::Resource
Instance Method Summary collapse
- #delete(options = nil) ⇒ Object
-
#initialize(client, options = nil) ⇒ Application
constructor
A new instance of Application.
- #to_s ⇒ Object
-
#update(options = nil) ⇒ Application
Application.
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, options = nil) ⇒ Application
Returns a new instance of Application.
7 8 9 10 11 12 |
# File 'lib/plivo/resources/applications.rb', line 7 def initialize(client, = nil) @_name = 'Application' @_identifier_string = 'app_id' super @_is_voice_request = true end |
Instance Method Details
#delete(options = nil) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/plivo/resources/applications.rb', line 65 def delete( = nil) return perform_delete if .nil? params = {} if .key?(:cascade) && valid_param?(:cascade, [:cascade], [TrueClass, FalseClass], false, [true, false]) params[:cascade] = [:cascade] end if .key?(:new_endpoint_application) && valid_param?(:new_endpoint_application, [:new_endpoint_application], [String, Symbol]) params[:new_endpoint_application] = [:new_endpoint_application] end perform_delete(params) end |
#to_s ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/plivo/resources/applications.rb', line 80 def to_s { answer_method: @answer_method, answer_url: @answer_url, app_id: @app_id, api_id: @api_id, app_name: @app_name, default_app: @default_app, default_endpoint_app: @default_endpoint_app, enabled: @enabled, fallback_answer_url: @fallback_answer_url, fallback_method: @fallback_method, hangup_method: @hangup_method, hangup_url: @hangup_url, message_method: @message_method, message_url: @message_url, public_uri: @public_uri, resource_uri: @resource_uri, sip_uri: @sip_uri, sub_account: @sub_account, log_incoming_messages: @log_incoming_messages }.to_s end |
#update(options = nil) ⇒ Application
Returns Application.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/plivo/resources/applications.rb', line 29 def update( = nil) return perform_update({}) if .nil? valid_param?(:options, , Hash, true) params = {} %i[answer_url hangup_url fallback_answer_url message_url subaccount] .each do |param| if .key?(param) && valid_param?(param, [param], [String, Symbol], true) params[param] = [param] end end %i[answer_method hangup_method fallback_method message_method] .each do |param| if .key?(param) && valid_param?(param, [param], [String, Symbol], true, %w[GET POST]) params[param] = [param] end end %i[default_number_app default_endpoint_app log_incoming_messages public_uri].each do |param| if .key?(param) && valid_param?(param, [param], [TrueClass, FalseClass], true) params[param] = [param] end end perform_update(params) end |