Skip to content

Commit

Permalink
PHONUM-2777 (#217)
Browse files Browse the repository at this point in the history
* added renewal date filters in list all numbers

* updated param name

* bump version and uts fix

---------

Co-authored-by: kalyan-plivo <kalyan.sunku@plivo.com>
  • Loading branch information
kapilp93 and kalyan-plivo authored May 4, 2023
1 parent 33fc21e commit 9254580
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## [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]
- Add 3 new filters to AccountPhoneNumber - list all my numbers API:`renewal_date`, `renewal_date__gt`, `renewal_date__gte`,`renewal_date__lt` and `renewal_date__lte` (https://www.plivo.com/docs/numbers/api/account-phone-number#list-all-my-numbers)

## [4.41.0](https://github.com/plivo/plivo-ruby/tree/v4.41.0) (2023-04-25)
**Adding new attribute - 'replaced_sender' in Get Message and List Message APIs**
- Add `replaced_sender` 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.41.0'
gem 'plivo', '>= 4.42.0'
```

And then execute:
Expand Down
10 changes: 8 additions & 2 deletions lib/plivo/resources/numbers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ def to_s
voice_rate: @voice_rate,
tendlc_campaign_id: @tendlc_campaign_id,
tendlc_registration_status: @tendlc_registration_status,
toll_free_sms_verification: @toll_free_sms_verification
toll_free_sms_verification: @toll_free_sms_verification,
renewal_date: @renewal_date
}.to_s
end
end
Expand Down Expand Up @@ -220,14 +221,19 @@ def get(number)
# - unverified - Returns a list of SMS-enabled US/CA toll-free numbers that are not verified.
# - pending_verification - Returns a list of SMS-enabled US/CA toll-free numbers that are pending verification
# - verified - Returns a list of SMS-enabled US/CA toll-free numbers that are verified for enhanced outbound SMS limits.
# @option options [String] :renewal_date Returns phone numbers that will be renewed on the specified date. Format: YYYY-MM-DD
# @option options [String] :renewal_date__lt Returns phone numbers that will be renewed before the specified date. Format: YYYY-MM-DD
# @option options [String] :renewal_date__lte Returns phone numbers that will be renewed on or before the specified date. Format: YYYY-MM-DD
# @option options [String] :renewal_date__gt Returns phone numbers that will be renewed after the specified date. Format: YYYY-MM-DD
# @option options [String] :renewal_date__gte Returns phone numbers that will be renewed on or after the specified date. Format: YYYY-MM-DD
def list(options = nil)
return perform_list if options.nil?

valid_param?(:options, options, Hash, true)

params = {}

%i[number_startswith subaccount alias tendlc_campaign_id tendlc_registration_status toll_free_sms_verification].each do |param|
%i[number_startswith subaccount alias tendlc_campaign_id tendlc_registration_status toll_free_sms_verification renewal_date renewal_date__lt renewal_date__lte renewal_date__gt renewal_date__gte].each do |param|
if options.key?(param) &&
valid_param?(param, options[param], [String, Symbol], true)
params[param] = options[param]
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.41.0".freeze
VERSION = "4.42.0".freeze
end
3 changes: 2 additions & 1 deletion spec/mocks/numberGetResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
"voice_rate": "0.00850",
"tendlc_campaign_id": "ACB1234",
"tendlc_registration_status": "COMPLETED",
"toll_free_sms_verification": null
"toll_free_sms_verification": null,
"renewal_date": "2023-05-10"
}
9 changes: 6 additions & 3 deletions spec/mocks/numberListResponse.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"voice_rate": "0.00850",
"tendlc_campaign_id": "ACB1234",
"tendlc_registration_status": "COMPLETED",
"toll_free_sms_verification": null
"toll_free_sms_verification": null,
"renewal_date": "2023-05-10"
},
{
"added_on": "2013-01-01",
Expand All @@ -44,7 +45,8 @@
"voice_rate": "0.00850",
"tendlc_campaign_id": "ACB1234",
"tendlc_registration_status": "COMPLETED",
"toll_free_sms_verification": null
"toll_free_sms_verification": null,
"renewal_date": "2023-05-10"
},
{
"added_on": "2013-03-25",
Expand All @@ -63,7 +65,8 @@
"voice_rate": "0.00850",
"tendlc_campaign_id": null,
"tendlc_registration_status": null,
"toll_free_sms_verification": "verified"
"toll_free_sms_verification": "verified",
"renewal_date": "2023-05-10"
}
]
}
3 changes: 2 additions & 1 deletion spec/resource_numbers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ def to_json(number)
voice_rate: number.voice_rate,
tendlc_campaign_id: number.tendlc_campaign_id,
tendlc_registration_status: number.tendlc_registration_status,
toll_free_sms_verification: number.toll_free_sms_verification
toll_free_sms_verification: number.toll_free_sms_verification,
renewal_date: number.renewal_date
}.to_json
end

Expand Down

0 comments on commit 9254580

Please sign in to comment.