From 843bb53ff5b91635978d4dfeb6aad6412afed598 Mon Sep 17 00:00:00 2001 From: ashutoshkumar Date: Mon, 29 Jan 2024 14:58:45 +0530 Subject: [PATCH 1/4] SMS-6589: Log Redaction --- CHANGELOG.md | 5 +++++ README.md | 2 +- lib/plivo/resources/messages.rb | 7 ++++--- lib/plivo/version.rb | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad4169a6..81cd5280 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## [4.55.2](https://github.com/plivo/plivo-ruby/tree/v4.55.2) (2024-01-29) +**Feature - Log Redaction Enhancement** +- Added log attribute in GET and List MDR response +- Change log field from bool to string in send SMS + ## [4.55.1](https://github.com/plivo/plivo-ruby/tree/v4.55.1) (2024-01-08) **Feature - Added New Param 'type' for Speak Api** - Added new param "type" for speak api diff --git a/README.md b/README.md index 87ad5a22..4acb3d4c 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ The Plivo Ruby SDK makes it simpler to integrate communications into your Ruby a Add this line to your application's Gemfile: ```ruby -gem 'plivo', '>= 4.55.1' +gem 'plivo', '>= 4.55.2' ``` And then execute: diff --git a/lib/plivo/resources/messages.rb b/lib/plivo/resources/messages.rb index c13597a5..0b9b5fb6 100644 --- a/lib/plivo/resources/messages.rb +++ b/lib/plivo/resources/messages.rb @@ -45,7 +45,8 @@ def to_s carrier_fees: @carrier_fees, conversation_id: @conversation_id, conversation_origin: @conversation_origin, - conversation_expiration_timestamp: @conversation_expiration_timestamp + conversation_expiration_timestamp: @conversation_expiration_timestamp, + log: @log }.to_s end end @@ -147,7 +148,7 @@ def create(src = nil, dst = nil, text = nil, options = nil, powerpack_uuid = nil end if value.key?(:log) && - valid_param?(:log, value[:log], [TrueClass, FalseClass], true) + valid_param?(:log, value[:log], String, true) params[:log] = value[:log] end @@ -286,7 +287,7 @@ def create(src = nil, dst = nil, text = nil, options = nil, powerpack_uuid = nil end if options.key?(:log) && - valid_param?(:log, options[:log], [TrueClass, FalseClass], true) + valid_param?(:log, options[:log], String, true) params[:log] = options[:log] end diff --git a/lib/plivo/version.rb b/lib/plivo/version.rb index afc33b38..134e6a75 100644 --- a/lib/plivo/version.rb +++ b/lib/plivo/version.rb @@ -1,3 +1,3 @@ module Plivo - VERSION = "4.55.1".freeze + VERSION = "4.55.2".freeze end From 6d0411b1f526ba16622f5fcc51e14f590643cf3c Mon Sep 17 00:00:00 2001 From: ashutoshkumar Date: Mon, 29 Jan 2024 15:40:17 +0530 Subject: [PATCH 2/4] test fix --- spec/resource_messages_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/resource_messages_spec.rb b/spec/resource_messages_spec.rb index 04c4ebfa..56a39908 100644 --- a/spec/resource_messages_spec.rb +++ b/spec/resource_messages_spec.rb @@ -165,7 +165,7 @@ def to_json_list(list_object) type: 'sms', url: 'http://url.com', method: 'POST', - log: true + log: "true" )))) .to eql(JSON.parse(contents)) compare_requests(uri: '/v1/Account/MAXXXXXXXXXXXXXXXXXX/Message/', @@ -178,7 +178,7 @@ def to_json_list(list_object) type: 'sms', url: 'http://url.com', method: 'POST', - log: true + log: "true" }) end @@ -194,7 +194,7 @@ def to_json_list(list_object) type: 'sms', url: 'http://url.com', method: 'POST', - log: true + log: "true" )))) .to eql(JSON.parse(contents)) compare_requests(uri: '/v1/Account/MAXXXXXXXXXXXXXXXXXX/Message/', @@ -207,7 +207,7 @@ def to_json_list(list_object) type: 'sms', url: 'http://url.com', method: 'POST', - log: true + log: "true" }) end @@ -223,7 +223,7 @@ def to_json_list(list_object) type: 'sms', url: 'http://url.com', method: 'POST', - log: true + log: "true" ) end .to raise_error( From 1673370e9051dd48982070ad58cc1054497b9c9a Mon Sep 17 00:00:00 2001 From: ashutoshkumar Date: Thu, 22 Feb 2024 12:55:19 +0530 Subject: [PATCH 3/4] fix --- lib/plivo/resources/messages.rb | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/lib/plivo/resources/messages.rb b/lib/plivo/resources/messages.rb index 0b9b5fb6..4290ebc2 100644 --- a/lib/plivo/resources/messages.rb +++ b/lib/plivo/resources/messages.rb @@ -147,9 +147,15 @@ def create(src = nil, dst = nil, text = nil, options = nil, powerpack_uuid = nil end end - if value.key?(:log) && - valid_param?(:log, value[:log], String, true) - params[:log] = value[:log] + if value.key?(:log) + log = value[:log] + if log.is_a?(TrueClass) || log.is_a?(FalseClass) # Check if log is boolean + params[:log] = log.to_s # Convert boolean to string + elsif log.is_a?(String) # Check if log is string + params[:log] = log + else + raise ArgumentError, "Invalid type for log parameter. Expected boolean or string." + end end if value.key?(:message_expiry) && @@ -286,9 +292,15 @@ def create(src = nil, dst = nil, text = nil, options = nil, powerpack_uuid = nil params[:media_ids] = options[:media_ids] end - if options.key?(:log) && - valid_param?(:log, options[:log], String, true) - params[:log] = options[:log] + if options.key?(:log) + log = options[:log] + if log.is_a?(TrueClass) || log.is_a?(FalseClass) # Check if log is boolean + params[:log] = log.to_s # Convert boolean to string + elsif log.is_a?(String) # Check if log is string + params[:log] = log + else + raise ArgumentError, "Invalid type for log parameter. Expected boolean or string." + end end if options.key?(:media_urls) && From 1aaff80524ee7f9a8ee5ac206491ce75e3f1986e Mon Sep 17 00:00:00 2001 From: ashutoshkumar Date: Wed, 28 Feb 2024 17:50:42 +0530 Subject: [PATCH 4/4] update date --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81cd5280..85314665 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change Log -## [4.55.2](https://github.com/plivo/plivo-ruby/tree/v4.55.2) (2024-01-29) +## [4.55.2](https://github.com/plivo/plivo-ruby/tree/v4.55.2) (2024-02-28) **Feature - Log Redaction Enhancement** - Added log attribute in GET and List MDR response - Change log field from bool to string in send SMS