Skip to content

Commit

Permalink
Merge pull request #215 from plivo/VT-5519
Browse files Browse the repository at this point in the history
Added new recording params and filter
  • Loading branch information
abhishekGupta-Plivo committed May 31, 2023
2 parents 9254580 + 582fa82 commit 7cf4e76
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 11 deletions.
8 changes: 5 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## [4.43.0](https://github.com/plivo/plivo-ruby/tree/v4.43.0) (2023-05-29)
**Feature - Recording API changes**
- Added `monthly_recording_storage_amount`, `recording_storage_rate`, `rounded_recording_duration`, and `recording_storage_duration` parameters to the response for [get single recording API](https://www.plivo.com/docs/voice/api/recording#retrieve-a-recording) and [get all recordings API](https://www.plivo.com/docs/voice/api/recording#list-all-recordings)
- Added `recording_storage_duration` parameter as a filter option for [get all recordings API](https://www.plivo.com/docs/voice/api/recording#list-all-recordings)

## [4.42.0](https://github.com/plivo/plivo-ruby/tree/v4.42.0) (2023-05-04)
**Adding new attribute - 'renewalDate' in Get Number and List Number APIs**
- Add New Param `renewalDate` to the response of the [list all numbers API], [list single number API]
Expand Down Expand Up @@ -32,13 +37,10 @@
**Feature - Enhance MDR filtering capabilities **
- Added new fields on MDR object response



## [4.37.0](https://github.com/plivo/plivo-ruby/tree/v4.37.0) (2023-02-06)
**Feature - Added New Param 'source_ip' in GetCall and ListCalls**
- Add `source_ip` to the response for the [retrieve a call details API](https://www.plivo.com/docs/voice/api/call#retrieve-a-call) and the [retreive all call details API](https://www.plivo.com/docs/voice/api/call#retrieve-all-calls)


## [4.36.0](https://github.com/plivo/plivo-ruby/tree/v4.36.0) (2022-01-25)
**Adding new attribute - 'requester_ip' in Get Message and List Mssage APIs**
- Add `requester_ip` to the response for the [list all messages API](https://www.plivo.com/docs/sms/api/message/list-all-messages/) and the [get message details API](https://www.plivo.com/docs/sms/api/message#retrieve-a-message)
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.42.0'
gem 'plivo', '>= 4.43.0'
```

And then execute:
Expand Down
16 changes: 15 additions & 1 deletion lib/plivo/resources/recordings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ def to_s
api_id: @api_id,
call_uuid: @call_uuid,
conference_name: @conference_name,
monthly_recording_storage_amount: @monthly_recording_storage_amount,
recording_storage_duration: @recording_storage_duration,
recording_duration_ms: @recording_duration_ms,
recording_end_ms: @recording_end_ms,
recording_format: @recording_format,
Expand All @@ -27,6 +29,8 @@ def to_s
recording_type: @recording_type,
recording_url: @recording_url,
resource_uri: @resource_uri,
rounded_recording_duration: @rounded_recording_duration,
recording_storage_rate: @recording_storage_rate,
from_number: @from_number,
to_number: @to_number,
mpc_name: @mpc_name,
Expand Down Expand Up @@ -60,6 +64,13 @@ def initialize(client, resource_list_json = nil)
# - add_time\__lt: lt stands for lesser than. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. Eg:- To get all recordings that started before 2012-03-21 11:47, use add_time\__lt=2012-03-21 11:47
# - add_time\__gte: lte stands for lesser than or equal. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. Eg:- To get all recordings that started before or exactly at 2012-03-21 11:47[:30], use add_time\__lte=2012-03-21 11:47[:30]
# - Note: The above filters can be combined to get recordings that started in a particular time range.
# @option options [Int] :recording_storage_duration - Used to filter out recordings according to the number of days they have been stored in the DB.The recording_storage_duration filter can be used in the following five forms:
# - recording_storage_duration: Takes an integer input and returns the recordings which are as old as that value.
# - recording_storage_duration\__gt: gt stands for greater than. The format expected is an integer value. Eg:- To get all recordings that are older than 100 days, use recording_storage_duration\__gt=100
# - recording_storage_duration\__gte: gte stands for greater than or equal. The format expected is an integer value. Eg:- To get all recordings that are older than or equal to 100 days old, use recording_storage_duration\__gte=100
# - recording_storage_duration\__lt: lt stands for lesser than. The format expected is an integer value. Eg:- To get all recordings that are newer than 100 days, use recording_storage_duration\__lt=100
# - recording_storage_duration\__lte: lte stands for lesser than or equal. The format expected is an integer value. Eg:- To get all recordings that are newer than or equal to 100 days old, use recording_storage_duration\__lte=100
# - Note: The above filters can be combined to get recordings that started in a particular time range.
# @option options [Int] :limit Used to display the number of results per page. The maximum number of results that can be fetched is 20.
# @option options [Int] :offset Denotes the number of value items by which the results should be offset. Eg:- If the result contains a 1000 values and limit is set to 10 and offset is set to 705, then values 706 through 715 are displayed in the results. This parameter is also used for pagination of the results.
def list(options = nil)
Expand All @@ -72,10 +83,13 @@ def list(options = nil)
add_time__lt add_time__lte
from_number to_number conference_uuid
conference_name mpc_name mpc_uuid
recording_storage_duration
recording_storage_duration__gt recording_storage_duration__gte
recording_storage_duration__lt recording_storage_duration__lte
]

params_expected.each do |param|
if options.key?(param) && valid_param?(param, options[param], [String, Symbol], true)
if options.key?(param) && valid_param?(param, options[param], [String, Symbol, Integer], true)
params[param] = options[param]
end
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.42.0".freeze
VERSION = "4.43.0".freeze
end
6 changes: 5 additions & 1 deletion spec/mocks/recordingGetResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@
"recording_start_ms": "1407235163907.00000",
"recording_type": "conference",
"recording_url": "http://s3.amazonaws.com/recordings_2013/c2186400-1c8c-11e4-a664-0026b945b52x.mp3",
"resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Recording/c2186400-1c8c-11e4-a664-0026b945b52x/"
"resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Recording/c2186400-1c8c-11e4-a664-0026b945b52x/",
"monthly_recording_storage_amount": 0.0008,
"rounded_recording_duration": 120,
"recording_storage_duration": 209,
"recording_storage_rate": 0.0004
}
18 changes: 15 additions & 3 deletions spec/mocks/recordingListResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
"recording_start_ms": "1407235163907.00000",
"recording_type": "conference",
"recording_url": "http://s3.amazonaws.com/recordings_2013/c2186400-1c8c-1124-a664-0026b945b522.mp3",
"resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Recording/c2186400-1c8c-1124-a664-0026b945b522/"
"resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Recording/c2186400-1c8c-1124-a664-0026b945b522/",
"monthly_recording_storage_amount": 0.0008,
"rounded_recording_duration": 120,
"recording_storage_duration": 209,
"recording_storage_rate": 0.0004
},
{
"add_time": "2014-08-05 16:05:21.993853+05:30",
Expand All @@ -32,7 +36,11 @@
"recording_start_ms": "1407234829553.00000",
"recording_type": "conference",
"recording_url": "http://s3.amazonaws.com/recordings_2013/fc2716b0-1c8b-11e4-bwad-842b2b17453e.mp3",
"resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Recording/fc2716b0-1c8b-11e4-bwad-842b2b17453e/"
"resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Recording/fc2716b0-1c8b-11e4-bwad-842b2b17453e/",
"monthly_recording_storage_amount": 0.0008,
"rounded_recording_duration": 120,
"recording_storage_duration": 209,
"recording_storage_rate": 0.0004
},
{
"add_time": "2014-08-05 15:51:56.582492+05:30",
Expand All @@ -45,7 +53,11 @@
"recording_start_ms": "1407234081443.00000",
"recording_type": "conference",
"recording_url": "http://s3.amazonaws.com/recordings_2013/3e701c9e-1c8a-11e4-bwad-842b2b17453e.mp3",
"resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Recording/3e701c9e-1c8a-11e4-bwad-842b2b17453e/"
"resource_uri": "/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Recording/3e701c9e-1c8a-11e4-bwad-842b2b17453e/",
"monthly_recording_storage_amount": 0.0008,
"rounded_recording_duration": 120,
"recording_storage_duration": 209,
"recording_storage_rate": 0.0004
}
]
}
6 changes: 5 additions & 1 deletion spec/resource_recordings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ def to_json(recording)
api_id: recording.api_id,
call_uuid: recording.call_uuid,
conference_name: recording.conference_name,
monthly_recording_storage_amount: recording.monthly_recording_storage_amount,
recording_duration_ms: recording.recording_duration_ms,
recording_end_ms: recording.recording_end_ms,
recording_format: recording.recording_format,
recording_id: recording.recording_id,
recording_start_ms: recording.recording_start_ms,
recording_storage_duration: recording.recording_storage_duration,
recording_storage_rate: recording.recording_storage_rate,
recording_type: recording.recording_type,
recording_url: recording.recording_url,
resource_uri: recording.resource_uri
resource_uri: recording.resource_uri,
rounded_recording_duration: recording.rounded_recording_duration
}.to_json
end

Expand Down

0 comments on commit 7cf4e76

Please sign in to comment.