Skip to content

Commit

Permalink
Merge pull request #249 from plivo/VT-8225
Browse files Browse the repository at this point in the history
Added changes for single party session
  • Loading branch information
manjunath-plivo authored Sep 30, 2024
2 parents cbb70a3 + 273f0f0 commit 7f8a800
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Change Log
## [4.61.0](https://github.com/plivo/plivo-ruby/tree/v4.61.0) (2024-09-30)
**Feature - Adding new param support for Number Masking session with single party **
- Added `create_session_with_single_party`, `virtual_number_cooloff_period` and `force_pin_authentication` attributes in Masking Session

## [4.60.3](https://github.com/plivo/plivo-ruby/tree/v4.60.3) (2024-09-06)
**Feature - Adding more attribute on mdr object**
- Added `message_sent_time`, `message_updated_time` and `error-message` on get and list Message API
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.60.3'
gem 'plivo', '>= 4.61.0'
```

And then execute:
Expand Down
23 changes: 14 additions & 9 deletions lib/plivo/resources/maskingsession.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def update(options = nil)
valid_param?(:options, options, Hash, true)

params = {}
params_expected = %i[session_expiry call_time_limit record record_file_format recording_callback_url
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|
Expand Down Expand Up @@ -90,7 +90,10 @@ def to_s
pin_retry: @pin_retry,
pin_retry_wait: @pin_retry_wait,
incorrect_pin_play: @incorrect_pin_play,
unknown_caller_play: @unknown_caller_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
end
Expand All @@ -109,18 +112,18 @@ def get(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,
def create(first_party: nil, second_party: nil, session_expiry: nil, call_time_limit: nil, record: nil, record_file_format: nil,
recording_callback_url: nil, initiate_call_to_first_party: nil, callback_url: nil, callback_method: nil, ring_timeout: nil,
first_party_play_url: nil, second_party_play_url: nil, recording_callback_method: nil, is_pin_authentication_required: nil,
generate_pin: nil, generate_pin_length: nil, first_party_pin: nil, second_party_pin: nil, pin_prompt_play: nil, pin_retry: nil,
pin_retry_wait: nil, incorrect_pin_play: nil, unknown_caller_play: nil, subaccount: nil, geomatch: nil)
pin_retry_wait: nil, incorrect_pin_play: nil, unknown_caller_play: nil, subaccount: nil, geomatch: nil, force_pin_authentication: nil, virtual_number_cooloff_period: nil, create_session_with_single_party: nil)

valid_param?(:first_party, first_party, [String, Symbol], true)
valid_param?(:second_party, second_party, [String, Symbol], true)
valid_param?(:first_party, first_party, [String, Symbol], false)
valid_param?(:second_party, second_party, [String, Symbol], false)

params = {}
params[:first_party] = first_party
params[:second_party] = second_party
params[:first_party] = first_party unless first_party.nil?
params[:second_party] = second_party unless second_party.nil?
params[:session_expiry] = session_expiry unless session_expiry.nil?
params[:call_time_limit] = call_time_limit unless call_time_limit.nil?
params[:record] = record unless record.nil?
Expand All @@ -145,7 +148,9 @@ def create(first_party:, second_party:, session_expiry: nil, call_time_limit: ni
params[:unknown_caller_play] = unknown_caller_play unless unknown_caller_play.nil?
params[:subaccount] = subaccount unless subaccount.nil?
params[:geomatch] = geomatch unless geomatch.nil?

params[:force_pin_authentication] = force_pin_authentication unless force_pin_authentication.nil?
params[:virtual_number_cooloff_period] = virtual_number_cooloff_period unless virtual_number_cooloff_period.nil?
params[:create_session_with_single_party] = create_session_with_single_party unless create_session_with_single_party.nil?
perform_create(params)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/plivo/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Plivo
VERSION = "4.60.3".freeze
VERSION = "4.61.0".freeze
end
5 changes: 4 additions & 1 deletion spec/resource_maskingsession_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ def to_json(masking_session)
pin_retry: masking_session.pin_retry,
pin_retry_wait: masking_session.pin_retry_wait,
incorrect_pin_play: masking_session.incorrect_pin_play,
unknown_caller_play: masking_session.unknown_caller_play
unknown_caller_play: masking_session.unknown_caller_play,
force_pin_authentication: masking_session.force_pin_authentication,
virtual_number_cooloff_period: masking_session.virtual_number_cooloff_period,
create_session_with_single_party: masking_session.create_session_with_single_party,
}.reject { |_, v| v.nil? }.to_json
end

Expand Down

0 comments on commit 7f8a800

Please sign in to comment.