Skip to content

Commit

Permalink
Merge branch 'master' into addition-mdr-attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
narayana-plivo authored Sep 6, 2024
2 parents 5214dba + e3541de commit 67273f9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
**Feature - Adding more attribute on mdr object**
- Added `message_sent_time`, `message_updated_time` and `error-message` on get and list Message API

## [4.60.2](https://github.com/plivo/plivo-ruby/tree/v4.60.2) (2024-09-06)
**Feature - Adding support for brand_name and app_hash in Create,Get and List Session**
- Added new request param `brand_name`, `code_length` and `app_hash` in create Session API
- Added support for `brand_name`, `code_length` and `app_hash` param in get and list Session response

## [4.60.1](https://github.com/plivo/plivo-ruby/tree/v4.60.1) (2024-09-03)
**Feature - Adding new element for Audio Stream XML **
- Added `keepCallAlive` element in Audio Stream XML


## [4.60.0](https://github.com/plivo/plivo-ruby/tree/v4.60.0) (2024-07-11)
**Feature - Adding support for Locale param in Create, Get and List Session**
- Added new request param `locale` in create Session API
Expand Down
12 changes: 9 additions & 3 deletions lib/plivo/resources/verify_session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,27 @@ def get(session_uuid)
perform_get(session_uuid)
end

def create(app_uuid = nil, recipient = nil,channel = nil, url = nil, method = nil, locale=nil)
def create(app_uuid = nil, recipient = nil,channel = nil, url = nil, method = nil, locale=nil, brand_name=nil, app_hash=nil, code_length=nil)
valid_param?(:app_uuid, app_uuid, [String, Symbol], false)
valid_param?(:recipient, recipient, [Integer, String, Symbol], true)
valid_param?(:channel, channel, [String, Symbol], false)
valid_param?(:url, url, [String], false)
valid_param?(:method, method, String, false, %w[POST GET])
valid_param?(:locale, locale, [String, Symbol], false)
valid_param?(:brand_name, brand_name, [String, Symbol], false)
valid_param?(:app_hash, app_hash, [String, Symbol], false)
valid_param?(:code_length, code_length,[Integer,Symbol], false)

params = {
app_uuid: app_uuid,
recipient: recipient,
channel: channel,
url: url,
method: method,
locale: locale
locale: locale,
brand_name: brand_name,
app_hash: app_hash,
code_length: code_length
}
perform_create(params)
end
Expand All @@ -67,7 +73,7 @@ def list(options = nil)
params = {}
params_expected = %i[
subaccount status session_time__gt session_time__gte
session_time__lt session_time__lte session_time country alias app_uuid recipient
session_time__lt session_time__lte session_time country alias app_uuid recipient brand_name app_hash
]

params_expected.each do |param|
Expand Down
6 changes: 5 additions & 1 deletion lib/plivo/xml/stream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ module XML
class Stream < Element
@nestables = []
@valid_attributes = %w[bidirectional audioTrack streamTimeout statusCallbackUrl
statusCallbackMethod contentType extraHeaders]
statusCallbackMethod contentType extraHeaders keepCallAlive]

SUPPORTED_BIDIRECTIONAL=%w(true false)
SUPPORTED_AUDIOTRACK=%w(inbound outbound both)
SUPPORTED_CALLBACKMETHOD=%w(GET POST)
SUPPORTED_KEEPCALLALIVE=%w(true false)

def initialize(body, attributes = {})
if attributes[:bidirectional] && !SUPPORTED_BIDIRECTIONAL.include?(attributes[:bidirectional])
Expand All @@ -19,6 +20,9 @@ def initialize(body, attributes = {})
if attributes[:statusCallbackMethod] && !SUPPORTED_CALLBACKMETHOD.include?(attributes[:statusCallbackMethod].upcase)
raise PlivoXMLError, "<Stream> statusCallbackMethod #{attributes[:statusCallbackMethod]} is not valid."
end
if attributes[:keepCallAlive] && !SUPPORTED_KEEPCALLALIVE.include?(attributes[:keepCallAlive])
raise PlivoXMLError, "<Stream> keepCallAlive #{attributes[:keepCallAlive]} is not valid."
end
raise PlivoXMLError, 'No text set for Stream' unless body
super(body, attributes)
end
Expand Down

0 comments on commit 67273f9

Please sign in to comment.