From fa23c0268c297d0d880f746c744a59de1794da59 Mon Sep 17 00:00:00 2001 From: ajay-plivo Date: Mon, 6 May 2024 14:33:17 +0530 Subject: [PATCH] masking --- lib/plivo/base/resource_interface.rb | 8 ++++++++ lib/plivo/resources/maskingsession.rb | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/plivo/base/resource_interface.rb b/lib/plivo/base/resource_interface.rb index 5b21313c..25644493 100644 --- a/lib/plivo/base/resource_interface.rb +++ b/lib/plivo/base/resource_interface.rb @@ -46,6 +46,14 @@ def perform_get(identifier, params = nil) @_resource_type.new(@_client, resource_json: response_json) end + def perform_get_with_response(identifier, params = nil) + valid_param?(:identifier, identifier, [String, Symbol], true) + response_json = @_client.send_request(@_resource_uri + identifier.to_s + '/', 'GET', params, nil, false, is_voice_request: @_is_voice_request) + resource_json = response_json["response"] + # Pass the parsed JSON to initialize the resource object + @_resource_type.new(@_client, resource_json: resource_json) + end + def perform_get_without_identifier(params) valid_param?(:params, params, Hash, true) response_json = @_client.send_request(@_resource_uri, 'GET', params, nil, false, is_voice_request: @_is_voice_request) diff --git a/lib/plivo/resources/maskingsession.rb b/lib/plivo/resources/maskingsession.rb index 385cdb77..551736e6 100644 --- a/lib/plivo/resources/maskingsession.rb +++ b/lib/plivo/resources/maskingsession.rb @@ -88,7 +88,7 @@ def initialize(client, resource_list_json = nil) # @param [String] session_uuid def get(session_uuid) valid_param?(:session_uuid, session_uuid, [String, Symbol], true) - perform_get_without_identifier(session_uuid) + perform_get_with_response(session_uuid) end def create(first_party, second_party, session_expiry=nil, call_time_limit=nil, record=nil, record_file_format=nil,