diff --git a/CHANGELOG.md b/CHANGELOG.md index a01732e..7250b6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] +### Breaking Changes +- removed DIDWW::Resource::DidGroup::FEATURE_VOICE => in favor DIDWW::Resource::DidGroup::FEATURE_VOICE_IN and DIDWW::Resource::DidGroup::FEATURE_VOICE_OUT [#42](https://github.com/didww/didww-v3-ruby/pull/42) +- removed DIDWW::Resource::DidGroup::FEATURE_SMS in favor of DIDWW::Resource::DidGroup::FEATURE_SMS_IN and DIDWW::Resource::DidGroup::FEATURE_SMS_OUT [#42](https://github.com/didww/didww-v3-ruby/pull/42) + ## [4.0.0] ### Breaking Changes - /v3/did_groups removed `local_prefix` attribute diff --git a/lib/didww/resource/did_group.rb b/lib/didww/resource/did_group.rb index e1b0945..9e58daa 100644 --- a/lib/didww/resource/did_group.rb +++ b/lib/didww/resource/did_group.rb @@ -3,14 +3,19 @@ module DIDWW module Resource class DidGroup < Base # Possible values for did_group.features array - FEATURE_VOICE = 'voice' .freeze - FEATURE_T38 = 't38' .freeze - FEATURE_SMS = 'sms' .freeze + FEATURE_VOICE_IN = 'voice_in' + FEATURE_VOICE_OUT = 'voice_out' + FEATURE_T38 = 't38' + FEATURE_IN_SMS = 'sms_in' + FEATURE_OUT_SMS = 'sms_out' + FEATURES = { - FEATURE_VOICE => 'Voice' .freeze, - FEATURE_T38 => 'T.38 Fax' .freeze, - FEATURE_SMS => 'SMS' .freeze - }.freeze + FEATURE_VOICE_IN => 'Voice IN', + FEATURE_VOICE_OUT => 'Voice OUT', + FEATURE_T38 => 'T.38 Fax', + FEATURE_IN_SMS => 'SMS IN', + FEATURE_OUT_SMS => 'SMS OUT' + }.freeze has_one :country, class: Country has_one :city, class: City diff --git a/spec/didww/resources/did_group_spec.rb b/spec/didww/resources/did_group_spec.rb index 0950156..73a7f15 100644 --- a/spec/didww/resources/did_group_spec.rb +++ b/spec/didww/resources/did_group_spec.rb @@ -3,14 +3,22 @@ let (:client) { DIDWW::Client } it 'has FEATURES constant' do - expect(described_class::FEATURES).to include('t38', 'voice', 'sms') + expect(DIDWW::Resource::DidGroup::FEATURES).to match( + hash_including( + 'sms_in' => 'SMS IN', + 'sms_out' => 'SMS OUT', + 't38' => 'T.38 Fax', + 'voice_in' => 'Voice IN', + 'voice_out' => 'Voice OUT', + ) + ) end describe '#features_human' do it 'humanizes features array attribute' do expect(subject.features_human).to eq([]) - subject.features = ['t38', 'voice'] - expect(subject.features_human).to eq(['T.38 Fax', 'Voice']) + subject.features = %w[t38 voice_in] + expect(subject.features_human).to eq(['T.38 Fax', 'Voice IN']) end end diff --git a/spec/fixtures/available_dids/get/sample_2/200.json b/spec/fixtures/available_dids/get/sample_2/200.json index dc8e417..f3b10bf 100644 --- a/spec/fixtures/available_dids/get/sample_2/200.json +++ b/spec/fixtures/available_dids/get/sample_2/200.json @@ -53,8 +53,8 @@ "prefix": "77", "local_prefix": "", "features": [ - "voice", - "sms" + "voice_in", + "sms_in" ], "is_metered": false, "area_name": "National", diff --git a/spec/fixtures/available_dids/id/get/sample_2/200.json b/spec/fixtures/available_dids/id/get/sample_2/200.json index 874f6be..2ce1f0e 100644 --- a/spec/fixtures/available_dids/id/get/sample_2/200.json +++ b/spec/fixtures/available_dids/id/get/sample_2/200.json @@ -29,8 +29,8 @@ "prefix": "77", "local_prefix": "", "features": [ - "voice", - "sms" + "voice_in", + "sms_in" ], "is_metered": false, "area_name": "National", diff --git a/spec/fixtures/available_dids/id/get/sample_3/200.json b/spec/fixtures/available_dids/id/get/sample_3/200.json index 686e081..433be3b 100644 --- a/spec/fixtures/available_dids/id/get/sample_3/200.json +++ b/spec/fixtures/available_dids/id/get/sample_3/200.json @@ -24,7 +24,7 @@ "allow_additional_channels": true, "area_name": "Washington", "features": [ - "voice" + "voice_in" ], "is_metered": false, "local_prefix": "", diff --git a/spec/fixtures/did_groups/get/sample_1/200.json b/spec/fixtures/did_groups/get/sample_1/200.json index 94ce04f..500cc39 100644 --- a/spec/fixtures/did_groups/get/sample_1/200.json +++ b/spec/fixtures/did_groups/get/sample_1/200.json @@ -9,8 +9,8 @@ "attributes": { "prefix": "77", "features": [ - "voice", - "sms" + "voice_in", + "sms_in" ], "is_metered": false, "area_name": "National", @@ -62,7 +62,7 @@ "attributes": { "prefix": "3", "features": [ - "voice" + "voice_in" ], "is_metered": false, "area_name": "Tel Aviv", diff --git a/spec/fixtures/did_groups/get/sample_2/200.json b/spec/fixtures/did_groups/get/sample_2/200.json index d6211eb..d0591f0 100644 --- a/spec/fixtures/did_groups/get/sample_2/200.json +++ b/spec/fixtures/did_groups/get/sample_2/200.json @@ -9,8 +9,8 @@ "attributes": { "prefix": "77", "features": [ - "voice", - "sms" + "voice_in", + "sms_in" ], "is_metered": false, "area_name": "National", @@ -82,7 +82,7 @@ "attributes": { "prefix": "3", "features": [ - "voice" + "voice_in" ], "is_metered": false, "area_name": "Tel Aviv", diff --git a/spec/fixtures/did_groups/id/get/sample_1/200.json b/spec/fixtures/did_groups/id/get/sample_1/200.json index 51b21ba..65a410a 100644 --- a/spec/fixtures/did_groups/id/get/sample_1/200.json +++ b/spec/fixtures/did_groups/id/get/sample_1/200.json @@ -8,8 +8,8 @@ "attributes": { "prefix": "77", "features": [ - "voice", - "sms" + "voice_in", + "sms_in" ], "is_metered": false, "area_name": "National", diff --git a/spec/fixtures/did_groups/id/get/sample_2/200.json b/spec/fixtures/did_groups/id/get/sample_2/200.json index c745038..a0d35cb 100644 --- a/spec/fixtures/did_groups/id/get/sample_2/200.json +++ b/spec/fixtures/did_groups/id/get/sample_2/200.json @@ -8,8 +8,8 @@ "attributes": { "prefix": "77", "features": [ - "voice", - "sms" + "voice_in", + "sms_in" ], "is_metered": false, "area_name": "National", diff --git a/spec/fixtures/did_reservations/id/get/sample_3/200.json b/spec/fixtures/did_reservations/id/get/sample_3/200.json index 5c72103..b409bb6 100644 --- a/spec/fixtures/did_reservations/id/get/sample_3/200.json +++ b/spec/fixtures/did_reservations/id/get/sample_3/200.json @@ -45,7 +45,7 @@ "allow_additional_channels": true, "area_name": "Washington", "features": [ - "voice" + "voice_in" ], "is_metered": false, "local_prefix": "", diff --git a/spec/fixtures/did_reservations/id/get/sample_4/200.json b/spec/fixtures/did_reservations/id/get/sample_4/200.json index 363f4c7..2020daf 100644 --- a/spec/fixtures/did_reservations/id/get/sample_4/200.json +++ b/spec/fixtures/did_reservations/id/get/sample_4/200.json @@ -45,7 +45,7 @@ "allow_additional_channels": true, "area_name": "Washington", "features": [ - "voice" + "voice_in" ], "is_metered": false, "local_prefix": "", diff --git a/spec/fixtures/dids/get/sample_2/200.json b/spec/fixtures/dids/get/sample_2/200.json index 0ae2e03..7319acf 100644 --- a/spec/fixtures/dids/get/sample_2/200.json +++ b/spec/fixtures/dids/get/sample_2/200.json @@ -130,7 +130,7 @@ "prefix": "720", "local_prefix": "", "features": [ - "voice" + "voice_in" ], "is_metered": false, "area_name": "National", @@ -179,7 +179,7 @@ "prefix": "11", "local_prefix": "", "features": [ - "voice" + "voice_in" ], "is_metered": false, "area_name": "Mobile", diff --git a/spec/fixtures/dids/id/get/sample_2/200.json b/spec/fixtures/dids/id/get/sample_2/200.json index 91a20ad..b9e48d3 100644 --- a/spec/fixtures/dids/id/get/sample_2/200.json +++ b/spec/fixtures/dids/id/get/sample_2/200.json @@ -69,7 +69,7 @@ "prefix": "721", "local_prefix": "", "features": [ - "voice" + "voice_in" ], "is_metered": false, "area_name": "National",