Class: Vonage::Verify2::StartVerificationOptions
- Inherits:
-
Object
- Object
- Vonage::Verify2::StartVerificationOptions
- Defined in:
- lib/vonage/verify2/start_verification_options.rb
Constant Summary collapse
- VALID_OPTS =
[:locale, :channel_timeout, :client_ref, :code_length, :code, :fraud_check].freeze
Instance Method Summary collapse
- #channel_timeout=(channel_timeout) ⇒ Object
- #client_ref=(client_ref) ⇒ Object
- #code=(code) ⇒ Object
- #code_length=(code_length) ⇒ Object
- #fraud_check=(fraud_check) ⇒ Object
-
#initialize(**opts) ⇒ StartVerificationOptions
constructor
A new instance of StartVerificationOptions.
- #locale=(locale) ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(**opts) ⇒ StartVerificationOptions
Returns a new instance of StartVerificationOptions.
14 15 16 17 18 |
# File 'lib/vonage/verify2/start_verification_options.rb', line 14 def initialize(**opts) VALID_OPTS.each do |opt| send("#{opt}=", opts[opt]) unless opts[opt].nil? end end |
Instance Method Details
#channel_timeout=(channel_timeout) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/vonage/verify2/start_verification_options.rb', line 24 def channel_timeout=(channel_timeout) raise ArgumentError, "Invalid 'channel_timeout' #{channel_timeout}. Must be an integer" unless channel_timeout.is_a?(Integer) unless channel_timeout.between?(MIN_CHANNEL_TIMEOUT, MAX_CHANNEL_TIMEOUT) raise ArgumentError, "Invalid 'channel_timeout' #{channel_timeout}. Must be between #{MIN_CHANNEL_TIMEOUT} and #{MAX_CHANNEL_TIMEOUT} (inclusive)" end @channel_timeout = channel_timeout end |
#client_ref=(client_ref) ⇒ Object
33 34 35 |
# File 'lib/vonage/verify2/start_verification_options.rb', line 33 def client_ref=(client_ref) @client_ref = client_ref end |
#code=(code) ⇒ Object
45 46 47 |
# File 'lib/vonage/verify2/start_verification_options.rb', line 45 def code=(code) @code = code end |
#code_length=(code_length) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/vonage/verify2/start_verification_options.rb', line 37 def code_length=(code_length) unless code_length.between?(MIN_CODE_LENGTH, MAX_CODE_LENGTH) raise ArgumentError, "Invalid 'code_length' #{code_length}. Must be between #{MIN_CODE_LENGTH} and #{MAX_CODE_LENGTH} (inclusive)" end @code_length = code_length end |
#fraud_check=(fraud_check) ⇒ Object
49 50 51 52 53 |
# File 'lib/vonage/verify2/start_verification_options.rb', line 49 def fraud_check=(fraud_check) raise ArgumentError, "Invalid 'fraud_check' #{fraud_check}. Must be `false`" unless fraud_check == false @fraud_check = fraud_check end |
#locale=(locale) ⇒ Object
20 21 22 |
# File 'lib/vonage/verify2/start_verification_options.rb', line 20 def locale=(locale) @locale = locale end |
#to_h ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/vonage/verify2/start_verification_options.rb', line 55 def to_h hash = Hash.new self.instance_variables.each do |ivar| hash[ivar.to_s.delete("@").to_sym] = self.instance_variable_get(ivar) end hash end |