Sha256: c542478abda7beee6108714d01f37ca2a7b843b905b5ffd2fea9d6e2db292cf0
Contents?: true
Size: 1.03 KB
Versions: 4
Compression:
Stored size: 1.03 KB
Contents
# typed: strict # frozen_string_literal: true module WhatsappSdk module Resource class InteractiveBody extend T::Sig # Returns Text string if the parameter object type is text. # For the body interactive, the character limit is 1024 characters. # # @returns text [String] sig { returns(String) } attr_accessor :text sig do params(text: String).void end def initialize(text:) @text = text validate end sig { returns(T::Hash[T.untyped, T.untyped]) } def to_json { text: text } end MAXIMUM_LENGTH = 1024 private sig { void } def validate validate_text end sig { void } def validate_text text_length = text.length return if text_length <= MAXIMUM_LENGTH raise WhatsappSdk::Resource::Error::InvalidInteractiveBody, "Invalid length #{text_length} for text in body. Maximum length: #{MAXIMUM_LENGTH} characters." end end end end
Version data entries
4 entries across 4 versions & 1 rubygems