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 ⇒ Object
-
#initialize(client, options = nil) ⇒ Application
constructor
A new instance of Application.
- #to_s ⇒ Object
-
#update(options = nil) ⇒ Application
Application.
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) ⇒ Application
Returns a new instance of Application.
7 8 9 10 11 |
# File 'lib/plivo/resources/applications.rb', line 7 def initialize(client, = nil) @_name = 'Application' @_identifier_string = 'app_id' super end |
Instance Method Details
#delete ⇒ Object
60 61 62 |
# File 'lib/plivo/resources/applications.rb', line 60 def delete perform_delete end |
#to_s ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/plivo/resources/applications.rb', line 64 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.
27 28 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 |
# File 'lib/plivo/resources/applications.rb', line 27 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].each do |param| if .key?(param) && valid_param?(param, [param], [TrueClass, FalseClass], true) params[param] = [param] end end perform_update(params) end |