Class: Plivo::Resources::MaskingSession
- Inherits:
-
Base::Resource
- Object
- Base::Resource
- Plivo::Resources::MaskingSession
- Defined in:
- lib/plivo/resources/maskingsession.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) ⇒ MaskingSession
constructor
A new instance of MaskingSession.
- #to_s ⇒ Object
- #update(options = nil) ⇒ Object
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) ⇒ MaskingSession
5 6 7 8 9 10 |
# File 'lib/plivo/resources/maskingsession.rb', line 5 def initialize(client, = nil) @_name = 'Masking/Session' @_identifier_string = 'session_uuid' super @_is_voice_request = true end |
Instance Method Details
#delete ⇒ Object
52 53 54 |
# File 'lib/plivo/resources/maskingsession.rb', line 52 def delete perform_delete end |
#to_s ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/plivo/resources/maskingsession.rb', line 56 def to_s { first_party: @first_party, second_party: @second_party, virtual_number: @virtual_number, status: @status, initiate_call_to_first_party: @initiate_call_to_first_party, session_uuid: @session_uuid, callback_url: @callback_url, callback_method: @callback_method, created_time: @created_time, modified_time: @modified_time, expiry_time: @expiry_time, duration: @duration, amount: @amount, call_time_limit: @call_time_limit, ring_timeout: @ring_timeout, first_party_play_url: @first_party_play_url, second_party_play_url: @second_party_play_url, record: @record, record_file_format: @record_file_format, recording_callback_url: @recording_callback_url, recording_callback_method: @recording_callback_method, interaction: @interaction, total_call_amount: @total_call_amount, total_call_count: @total_call_count, total_call_billed_duration: @total_call_billed_duration, total_session_amount: @total_session_amount, last_interaction_time: @last_interaction_time, is_pin_authentication_required: @is_pin_authentication_required, generate_pin: @generate_pin, generate_pin_length: @generate_pin_length, second_party_pin: @second_party_pin, pin_prompt_play: @pin_prompt_play, pin_retry: @pin_retry, pin_retry_wait: @pin_retry_wait, incorrect_pin_play: @incorrect_pin_play, unknown_caller_play: @unknown_caller_play, force_pin_authentication: @force_pin_authentication, virtual_number_cooloff_period: @virtual_number_cooloff_period, create_session_with_single_party: @create_session_with_single_party }.to_s end |
#update(options = nil) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/plivo/resources/maskingsession.rb', line 12 def update( = nil) return if .nil? valid_param?(:options, , Hash, true) params = {} params_expected = i[first_party second_party session_expiry call_time_limit record record_file_format recording_callback_url callback_url callback_method ring_timeout first_party_play_url second_party_play_url recording_callback_method subaccount geomatch] params_expected.each do |param| if .key?(param) && valid_param?(param, [param], [String, Symbol, TrueClass, FalseClass], true) params[param] = [param] end end updated_session = perform_masking_update(params) session_data = updated_session.instance_variables.map do |var| [var[1..-1].to_sym, updated_session.instance_variable_get(var)] end.to_h relevant_keys = i[api_id session] filtered_session_data = session_data.select { |key, _| relevant_keys.include?(key) } if filtered_session_data[:session] session_instance = filtered_session_data[:session] session_data = session_instance.map do |key, value| [key.to_sym, value] end.to_h # Extract relevant keys from session session_relevant_keys = i[first_party second_party virtual_number status initiate_call_to_first_party session_uuid callback_url callback_method created_time modified_time expiry_time duration amount call_time_limit ring_timeout first_party_play_url second_party_play_url record record_file_format recording_callback_url recording_callback_method interaction total_call_amount total_call_count total_call_billed_duration total_session_amount last_interaction_time unknown_caller_play is_pin_authentication_required generate_pin generate_pin_length first_party_pin second_party_pin pin_prompt_play pin_retry pin_retry_wait incorrect_pin_play] filtered_session_data[:session] = session_data.select { |key, _| session_relevant_keys.include?(key) } end filtered_session_data end |