Skip to content

Commit 16e948f

Browse files
authored
DEVX-8065/DEVX-7991: Verify2 SMS Updates (#303)
* Updating properties on SMS channel for Verify v2
1 parent 4636c34 commit 16e948f

File tree

4 files changed

+78
-2
lines changed

4 files changed

+78
-2
lines changed

Diff for: CHANGES.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 7.20.0
2+
3+
* Updates Verify v2 API SMS channel to add new parameters. [#303](https://github.com/Vonage/vonage-ruby-sdk/pull/303)
4+
15
# 7.19.0
26

37
* Adds Video API functionality. [#297](https://github.com/Vonage/vonage-ruby-sdk/pull/297)

Diff for: lib/vonage/verify2/channels/sms.rb

+15-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module Vonage
66
class Verify2::Channels::SMS
77
APP_HASH_LENGTH = 11
88

9-
attr_reader :channel, :to, :app_hash
9+
attr_reader :channel, :to, :from, :entity_id, :content_id, :app_hash
1010

1111
def initialize(to:, app_hash: nil)
1212
self.channel = 'sms'
@@ -19,6 +19,20 @@ def to=(to)
1919
@to = to
2020
end
2121

22+
def from=(from)
23+
@from = from
24+
end
25+
26+
def entity_id=(entity_id)
27+
raise ArgumentError, "Invalid 'entity_id' value #{entity_id}. Length must be between 1 and 20 characters." unless entity_id.length.between?(1, 20)
28+
@entity_id = entity_id
29+
end
30+
31+
def content_id=(content_id)
32+
raise ArgumentError, "Invalid 'content_id' value #{content_id}. Length must be between 1 and 20 characters ." unless content_id.length.between?(1, 20)
33+
@content_id = content_id
34+
end
35+
2236
def app_hash=(app_hash)
2337
raise ArgumentError, "Invalid 'app_hash' value #{app_hash}. Length must be #{APP_HASH_LENGTH}" unless app_hash.length == APP_HASH_LENGTH
2438
@app_hash = app_hash

Diff for: lib/vonage/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# typed: strong
22

33
module Vonage
4-
VERSION = '7.19.0'
4+
VERSION = '7.20.0'
55
end

Diff for: test/vonage/verify2/channels/sms_test.rb

+58
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,64 @@ def test_to_setter_method_with_invalid_number
3131
end
3232
end
3333

34+
def test_from_getter_method
35+
assert_nil sms_channel.from
36+
end
37+
38+
def test_from_setter_method
39+
channel = sms_channel
40+
new_number = '447000000002'
41+
channel.from = new_number
42+
43+
assert_equal new_number, channel.instance_variable_get(:@from)
44+
end
45+
46+
def test_entity_id_getter_method
47+
assert_nil sms_channel.entity_id
48+
end
49+
50+
def test_entity_id_setter_method
51+
channel = sms_channel
52+
channel.entity_id = '1101407360000017170'
53+
54+
assert_equal '1101407360000017170', channel.instance_variable_get(:@entity_id)
55+
end
56+
57+
def test_entity_id_setter_method_with_invalid_arg_too_short
58+
assert_raises ArgumentError do
59+
sms_channel.entity_id = ''
60+
end
61+
end
62+
63+
def test_entity_id_setter_method_with_invalid_arg_too_long
64+
assert_raises ArgumentError do
65+
sms_channel.entity_id = '110140736000001717072'
66+
end
67+
end
68+
69+
def test_content_id_getter_method
70+
assert_nil sms_channel.content_id
71+
end
72+
73+
def test_content_id_setter_method
74+
channel = sms_channel
75+
channel.content_id = '1101407360000017170'
76+
77+
assert_equal '1101407360000017170', channel.instance_variable_get(:@content_id)
78+
end
79+
80+
def test_content_id_setter_method_with_invalid_arg_too_short
81+
assert_raises ArgumentError do
82+
sms_channel.content_id = ''
83+
end
84+
end
85+
86+
def test_content_id_setter_method_with_invalid_arg_too_long
87+
assert_raises ArgumentError do
88+
sms_channel.content_id = '110140736000001717072'
89+
end
90+
end
91+
3492
def test_app_hash_getter_method
3593
assert_nil sms_channel.app_hash
3694
end

0 commit comments

Comments
 (0)