class Plivo::Resources::Application
Public Class Methods
Source
# File lib/plivo/resources/applications.rb, line 7 def initialize(client, options = nil) @_name = 'Application' @_identifier_string = 'app_id' super @_is_voice_request = true end
Plivo::Base::Resource::new
Public Instance Methods
Source
# File lib/plivo/resources/applications.rb, line 65 def delete(options = nil) return perform_delete if options.nil? params = {} if options.key?(:cascade) && valid_param?(:cascade, options[:cascade], [TrueClass, FalseClass], false, [true, false]) params[:cascade] = options[:cascade] end if options.key?(:new_endpoint_application) && valid_param?(:new_endpoint_application, options[:new_endpoint_application], [String, Symbol]) params[:new_endpoint_application] = options[:new_endpoint_application] end perform_delete(params) end
@param [Hash] options @option options [Boolean] :cascade - delete associated endpoints @option options [String] :new_endpoint_application - Link associated endpoints to this app
Source
# 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
Source
# File lib/plivo/resources/applications.rb, line 29 def update(options = nil) return perform_update({}) if options.nil? valid_param?(:options, options, Hash, true) params = {} %i[answer_url hangup_url fallback_answer_url message_url subaccount] .each do |param| if options.key?(param) && valid_param?(param, options[param], [String, Symbol], true) params[param] = options[param] end end %i[answer_method hangup_method fallback_method message_method] .each do |param| if options.key?(param) && valid_param?(param, options[param], [String, Symbol], true, %w[GET POST]) params[param] = options[param] end end %i[default_number_app default_endpoint_app log_incoming_messages public_uri].each do |param| if options.key?(param) && valid_param?(param, options[param], [TrueClass, FalseClass], true) params[param] = options[param] end end perform_update(params) end
@param [Hash] options @option options [String] :answer_url - The URL invoked by Plivo
when a call executes this application. @option options [String] :answer_method - The method used to call the answer_url. Defaults to POST. @option options [String] :hangup_url - The URL that will be notified by Plivo
when the call hangs up. Defaults to answer_url. @option options [String] :hangup_method - The method used to call the hangup_url. Defaults to POST. @option options [String] :fallback_answer_url - Invoked by Plivo
only if answer_url is unavailable or the XML
response is invalid. Should contain a XML
response. @option options [String] :fallback_method - The method used to call the fallback_answer_url. Defaults to POST. @option options [String] :message_url - The URL that will be notified by Plivo
when an inbound message is received. Defaults not set. @option options [String] :message_method - The method used to call the message_url. Defaults to POST. @option options [Boolean] :default_number_app - If set to true, this parameter ensures that newly created numbers, which don’t have an app_id, point to this application. @option options [Boolean] :default_endpoint_app - If set to true, this parameter ensures that newly created endpoints, which don’t have an app_id, point to this application. @option options [String] :subaccount - Id of the subaccount, in case only subaccount applications are needed. @option options [Boolean] :log_incoming_messages - If set to true, this parameter ensures that incoming messages are logged. @option options [Boolean] :public_uri - If set to true, this parameter enables public_uri. @return [Application] Application