File tree 2 files changed +13
-2
lines changed
2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ class Verify2 < Namespace
17
17
# )
18
18
#
19
19
# @param [required, String] :brand The brand that is sending the verification request
20
+ # - Must be between 1 and 16 characters in length
20
21
#
21
22
# @param [required, Array<Hash>] :workflow An array of hashes for channels in the workflow
22
23
#
@@ -32,6 +33,8 @@ class Verify2 < Namespace
32
33
# @see https://developer.vonage.com/en/api/verify.v2#newRequest
33
34
#
34
35
def start_verification ( brand :, workflow :, **opts )
36
+ raise ArgumentError , ':workflow must be a String' unless brand . is_a? ( String )
37
+ raise ArgumentError , "Invalid 'brand' value #{ brand } . Length must be between 1 and 16 characters." unless brand . length . between? ( 1 , 16 )
35
38
raise ArgumentError , ':workflow must be an Array' unless workflow . is_a? ( Array )
36
39
raise ArgumentError , ':workflow must not be empty' if workflow . empty?
37
40
Original file line number Diff line number Diff line change @@ -77,15 +77,23 @@ def test_start_verification_method_without_brand
77
77
end
78
78
end
79
79
80
- def test_start_verification_method_wit_brand_too_short
80
+ def test_start_verification_method_with_invalid_brand_type
81
+ workflow = [ { channel : 'sms' , to : to_number } ]
82
+
83
+ assert_raises ArgumentError do
84
+ verify2 . start_verification ( brand : 123 , workflow : workflow )
85
+ end
86
+ end
87
+
88
+ def test_start_verification_method_with_brand_too_short
81
89
workflow = [ { channel : 'sms' , to : to_number } ]
82
90
83
91
assert_raises ArgumentError do
84
92
verify2 . start_verification ( brand : '' , workflow : workflow )
85
93
end
86
94
end
87
95
88
- def test_start_verification_method_wit_brand_too_long
96
+ def test_start_verification_method_with_brand_too_long
89
97
workflow = [ { channel : 'sms' , to : to_number } ]
90
98
91
99
assert_raises ArgumentError do
You can’t perform that action at this time.
0 commit comments