diff --git a/CHANGELOG.md b/CHANGELOG.md index c5920c7f..4f1c54ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## [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] +- Added `cnam_lookup` filter to AccountPhoneNumber - list all my numbers API. +- Added `cnam_lookup` parameter to buy number[Buy a Phone Number] to configure CNAM Lookup while buying a US number +- Added `cnam_lookup` parameter to update number[Update an account phone number] to configure CNAM Lookup while buying a US number + + ## [4.44.0](https://github.com/plivo/plivo-ruby/tree/v4.38.2) (2023-03-16) **Feature : Added new param in getCallDetail api** - From now on we can see CNAM(Caller_id name) details at CDR level. diff --git a/README.md b/README.md index a49e7fb7..20e8b9a5 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.44.0' +gem 'plivo', '>= 4.45.0' ``` And then execute: diff --git a/lib/plivo/base_client.rb b/lib/plivo/base_client.rb index 5dd10fd3..90f53968 100644 --- a/lib/plivo/base_client.rb +++ b/lib/plivo/base_client.rb @@ -33,7 +33,7 @@ def process_response(method, response) raise Exceptions::PlivoRESTError, "Resource at #{response[:url]} "\ 'couldn\'t be deleted' end - elsif !([200, 201, 202, 204, 207].include? response[:status]) + elsif !([200, 201, 202, 204, 207, 206].include? response[:status]) raise Exceptions::PlivoRESTError, "Received #{response[:status]} for #{method}" end @@voice_retry_count = 0 diff --git a/lib/plivo/resources/numbers.rb b/lib/plivo/resources/numbers.rb index d6ce7948..076b34bb 100644 --- a/lib/plivo/resources/numbers.rb +++ b/lib/plivo/resources/numbers.rb @@ -9,10 +9,11 @@ def initialize(client, options = nil) super end - def buy(app_id = nil, verification_info = nil) + def buy(app_id = nil, verification_info = nil, cnam_lookup = 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? perform_action(nil, 'POST', params, true) end @@ -118,10 +119,10 @@ def each(country_iso) end end - def buy(number, app_id = nil, verification_info = nil) + def buy(number, app_id = nil, verification_info = nil, cnam_lookup = nil) valid_param?(:number, number, [Integer, String, Symbol], true) PhoneNumber.new(@_client, - resource_id: number).buy(app_id, verification_info) + resource_id: number).buy(app_id, verification_info, cnam_lookup) end end @@ -142,7 +143,7 @@ def update(options = nil) params[:subaccount] = options[:subaccount] end - %i[alias app_id].each do |param| + %i[alias app_id cnam_lookup].each do |param| if options.key?(param) && valid_param?(param, options[param], [String, Symbol], true) params[param] = options[param] @@ -183,7 +184,8 @@ def to_s tendlc_campaign_id: @tendlc_campaign_id, tendlc_registration_status: @tendlc_registration_status, toll_free_sms_verification: @toll_free_sms_verification, - renewal_date: @renewal_date + renewal_date: @renewal_date, + cnam_lookup: @cnam_lookup }.to_s end end @@ -226,6 +228,9 @@ def get(number) # @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 + # @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 def list(options = nil) return perform_list if options.nil? @@ -233,7 +238,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].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].each do |param| if options.key?(param) && valid_param?(param, options[param], [String, Symbol], true) params[param] = options[param] @@ -324,6 +329,7 @@ def add_number(numbers, carrier, region, options = nil) # @option options [String] :alias The textual name given to the number. # @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 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 8575445e..f852a73c 100644 --- a/lib/plivo/version.rb +++ b/lib/plivo/version.rb @@ -1,3 +1,3 @@ module Plivo - VERSION = "4.44.0".freeze + VERSION = "4.45.0".freeze end diff --git a/spec/mocks/numberGetResponse.json b/spec/mocks/numberGetResponse.json index 1e473643..85996fe0 100644 --- a/spec/mocks/numberGetResponse.json +++ b/spec/mocks/numberGetResponse.json @@ -17,5 +17,6 @@ "tendlc_campaign_id": "ACB1234", "tendlc_registration_status": "COMPLETED", "toll_free_sms_verification": null, - "renewal_date": "2023-05-10" + "renewal_date": "2023-05-10", + "cnam_lookup": "enabled" } \ No newline at end of file diff --git a/spec/mocks/numberListResponse.json b/spec/mocks/numberListResponse.json index 04675d0e..785f7d92 100644 --- a/spec/mocks/numberListResponse.json +++ b/spec/mocks/numberListResponse.json @@ -26,7 +26,8 @@ "tendlc_campaign_id": "ACB1234", "tendlc_registration_status": "COMPLETED", "toll_free_sms_verification": null, - "renewal_date": "2023-05-10" + "renewal_date": "2023-05-10", + "cnam_lookup": "enabled" }, { "added_on": "2013-01-01", @@ -46,7 +47,8 @@ "tendlc_campaign_id": "ACB1234", "tendlc_registration_status": "COMPLETED", "toll_free_sms_verification": null, - "renewal_date": "2023-05-10" + "renewal_date": "2023-05-10", + "cnam_lookup": "enabled" }, { "added_on": "2013-03-25", @@ -66,7 +68,8 @@ "tendlc_campaign_id": null, "tendlc_registration_status": null, "toll_free_sms_verification": "verified", - "renewal_date": "2023-05-10" + "renewal_date": "2023-05-10", + "cnam_lookup": "enabled" } ] } \ No newline at end of file diff --git a/spec/resource_numbers_spec.rb b/spec/resource_numbers_spec.rb index b87bcbe8..b6ec913b 100644 --- a/spec/resource_numbers_spec.rb +++ b/spec/resource_numbers_spec.rb @@ -21,7 +21,8 @@ def to_json(number) tendlc_campaign_id: number.tendlc_campaign_id, tendlc_registration_status: number.tendlc_registration_status, toll_free_sms_verification: number.toll_free_sms_verification, - renewal_date: number.renewal_date + renewal_date: number.renewal_date, + cnam_lookup: number.cnam_lookup }.to_json end