Skip to content

Commit

Permalink
Adding setters and getters for content_id and entity_id
Browse files Browse the repository at this point in the history
  • Loading branch information
superchilled committed Jan 29, 2024
1 parent dd57287 commit 058155f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/vonage/verify2/channels/sms.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Vonage
class Verify2::Channels::SMS
APP_HASH_LENGTH = 11

attr_reader :channel, :to, :from, :app_hash
attr_reader :channel, :to, :from, :entity_id, :content_id, :app_hash

def initialize(to:, app_hash: nil)
self.channel = 'sms'
Expand All @@ -24,6 +24,16 @@ def from=(from)
@from = from
end

def entity_id=(entity_id)
raise ArgumentError, "Invalid 'entity_id' value #{entity_id}. Length must be between 1 and 20 characters." unless entity_id.length.between?(1, 20)
@entity_id = entity_id
end

def content_id=(content_id)
raise ArgumentError, "Invalid 'content_id' value #{content_id}. Length must be between 1 and 20 characters ." unless content_id.length.between?(1, 20)
@content_id = content_id
end

def app_hash=(app_hash)
raise ArgumentError, "Invalid 'app_hash' value #{app_hash}. Length must be #{APP_HASH_LENGTH}" unless app_hash.length == APP_HASH_LENGTH
@app_hash = app_hash
Expand Down

0 comments on commit 058155f

Please sign in to comment.