diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f1c54ea..20d300c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Change Log +## [4.46.0](https://github.com/plivo/plivo-ruby/tree/v4.46.0) (2023-06-27) +**Feature - CNAM** +- Added New Param `cnam` in to the response of the [list all numbers API], [list single number API] +- Added `cnam` parameter to buy number[Buy a Phone Number] to configure CNAM while buying a US number +- Added `callback_url` parameter to buy number[Buy a Phone Number] to configure CNAM callback url while buying a US number +- Added `callback_method` parameter to buy number[Buy a Phone Number] to configure CNAM callback method while buying a US number +- Added `cnam` parameter to update number[Update an account phone number] to configure CNAM while updating a US number +- Added `callback_url` parameter to update number[Update an account phone number] to configure CNAM callback url while updating a US number +- Added `callback_method` parameter to update number[Update an account phone number] to configure CNAM callback method while updating a US number + + ## [4.45.0](https://github.com/plivo/plivo-ruby/tree/v4.45.0) (2023-05-02) **Feature - CNAM Lookup** - Added New Param `cnam_lookup` in to the response of the [list all numbers API], [list single number API] diff --git a/README.md b/README.md index 20e8b9a5..38a7c908 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.45.0' +gem 'plivo', '>= 4.46.0' ``` And then execute: diff --git a/lib/plivo/resources/numbers.rb b/lib/plivo/resources/numbers.rb index 076b34bb..b4dab8f4 100644 --- a/lib/plivo/resources/numbers.rb +++ b/lib/plivo/resources/numbers.rb @@ -9,11 +9,14 @@ def initialize(client, options = nil) super end - def buy(app_id = nil, verification_info = nil, cnam_lookup = nil) + def buy(app_id = nil, verification_info = nil, cnam_lookup = nil, cnam = nil, callback_url = nil, callback_method = nil) params = {} params[:app_id] = app_id unless app_id.nil? params[:verification_info] = verification_info unless verification_info.nil? params[:cnam_lookup] = cnam_lookup unless cnam_lookup.nil? + params[:cnam] = cnam unless cnam.nil? + params[:callback_url] = callback_url unless callback_url.nil? + params[:callback_method] = callback_method unless callback_method.nil? perform_action(nil, 'POST', params, true) end @@ -119,10 +122,10 @@ def each(country_iso) end end - def buy(number, app_id = nil, verification_info = nil, cnam_lookup = nil) + def buy(number, app_id = nil, verification_info = nil, cnam_lookup = nil, cnam = nil, callback_url = nil, callback_method = nil) valid_param?(:number, number, [Integer, String, Symbol], true) PhoneNumber.new(@_client, - resource_id: number).buy(app_id, verification_info, cnam_lookup) + resource_id: number).buy(app_id, verification_info, cnam_lookup, cnam, callback_url, callback_method) end end @@ -143,7 +146,7 @@ def update(options = nil) params[:subaccount] = options[:subaccount] end - %i[alias app_id cnam_lookup].each do |param| + %i[alias app_id cnam_lookup cnam callback_url callback_method].each do |param| if options.key?(param) && valid_param?(param, options[param], [String, Symbol], true) params[param] = options[param] @@ -185,7 +188,8 @@ def to_s tendlc_registration_status: @tendlc_registration_status, toll_free_sms_verification: @toll_free_sms_verification, renewal_date: @renewal_date, - cnam_lookup: @cnam_lookup + cnam_lookup: @cnam_lookup, + cnam: @cnam }.to_s end end @@ -231,6 +235,7 @@ def get(number) # @option options [String] :cnam_lookup The Cnam Lookup Configuration associated with that number. The following values are valid: # - enabled - Returns the list of numbers for which Cnam Lookup configuration is enabled # - disabled - Returns the list of numbers for which Cnam Lookup configuration is disabled + # @option options [String] :cnam The Cnam Configuration associated with that number. def list(options = nil) return perform_list if options.nil? @@ -238,7 +243,7 @@ def list(options = nil) params = {} - %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 cnam_lookup].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 cnam_lookup cnam].each do |param| if options.key?(param) && valid_param?(param, options[param], [String, Symbol], true) params[param] = options[param] @@ -330,6 +335,9 @@ def add_number(numbers, carrier, region, options = nil) # @option options [String] :app_id The application id of the application that is to be linked. # @option options [String] :subaccount The auth_id of the subaccount to which this number should be added. This can only be performed by a main account holder. # @option options [String] :cnam_lookup The Cnam Lookup configuration to enable/disable Cnam Lookup + # @option options [String] :cnam The Cnam configuration value. + # @option options [String] :callback_url The Cnam callback url configuration . + # @option options [String] :callback_method The Cnam callback method configuration. def update(number, options = nil) valid_param?(:number, number, [String, Symbol], true) Number.new(@_client, diff --git a/lib/plivo/version.rb b/lib/plivo/version.rb index f852a73c..ad82ace8 100644 --- a/lib/plivo/version.rb +++ b/lib/plivo/version.rb @@ -1,3 +1,3 @@ module Plivo - VERSION = "4.45.0".freeze + VERSION = "4.46.0".freeze end diff --git a/spec/mocks/numberGetResponse.json b/spec/mocks/numberGetResponse.json index 85996fe0..5ab4ba51 100644 --- a/spec/mocks/numberGetResponse.json +++ b/spec/mocks/numberGetResponse.json @@ -18,5 +18,6 @@ "tendlc_registration_status": "COMPLETED", "toll_free_sms_verification": null, "renewal_date": "2023-05-10", - "cnam_lookup": "enabled" + "cnam_lookup": "enabled", + "cnam": "test1" } \ No newline at end of file diff --git a/spec/mocks/numberListResponse.json b/spec/mocks/numberListResponse.json index 785f7d92..fd54cd97 100644 --- a/spec/mocks/numberListResponse.json +++ b/spec/mocks/numberListResponse.json @@ -27,7 +27,8 @@ "tendlc_registration_status": "COMPLETED", "toll_free_sms_verification": null, "renewal_date": "2023-05-10", - "cnam_lookup": "enabled" + "cnam_lookup": "enabled", + "cnam": "test1" }, { "added_on": "2013-01-01", @@ -48,7 +49,8 @@ "tendlc_registration_status": "COMPLETED", "toll_free_sms_verification": null, "renewal_date": "2023-05-10", - "cnam_lookup": "enabled" + "cnam_lookup": "enabled", + "cnam": "test1" }, { "added_on": "2013-03-25", @@ -69,7 +71,8 @@ "tendlc_registration_status": null, "toll_free_sms_verification": "verified", "renewal_date": "2023-05-10", - "cnam_lookup": "enabled" + "cnam_lookup": "enabled", + "cnam": "test1" } ] } \ No newline at end of file diff --git a/spec/resource_numbers_spec.rb b/spec/resource_numbers_spec.rb index b6ec913b..f118d0cf 100644 --- a/spec/resource_numbers_spec.rb +++ b/spec/resource_numbers_spec.rb @@ -22,7 +22,8 @@ def to_json(number) tendlc_registration_status: number.tendlc_registration_status, toll_free_sms_verification: number.toll_free_sms_verification, renewal_date: number.renewal_date, - cnam_lookup: number.cnam_lookup + cnam_lookup: number.cnam_lookup, + cnam: number.cnam }.to_json end