lib/termii_ruby/termii.rb in termii_ruby-0.1.0 vs lib/termii_ruby/termii.rb in termii_ruby-0.1.1

- old
+ new

@@ -1,16 +1,41 @@ # frozen_string_literal: true -# Base Class - require_relative "mixins/endpoints" module TermiiRuby + # + # @author Collins Ugwu + # Base Termii Class + # class Termii include TermiiRuby::Mixins::Endpoints - attr_accessor :message_text, :pin_type, :channel, :pin_attempts, :pin_length, :pin_time_to_live, :pin_placeholder + # @return [Stiring] Enum: "NUMERIC" "ALPHANUMERIC" Type of message that will be generated and sent as part of the OTP message. You can set message type to numeric or alphanumeric + attr_accessor :message_type + + # @return [String] "NUMERIC" + attr_accessor :pin_type + + # @return [String] This is the route through which the message is sent. It is either dnd, WhatsApp, or generic or email + attr_accessor :channel + + # @return [Integer] Example: 3 Represents the number of times the PIN can be attempted before expiration. It has a minimum of one attempt + attr_accessor :pin_attempts + + # @return [Integer] The length of the PIN code.It has a minimum of 4 and maximum of 8. + attr_accessor :pin_length + + # @return [Interger] Represents how long the PIN is valid before expiration. The time is in minutes. The minimum time value is 0 and the maximum time value is 60 + attr_accessor :pin_time_to_live + + # @return [String] Example: "< 1234 >" PIN placeholder. Right before sending the message, PIN code placeholder will be replaced with generate PIN code. + attr_accessor :pin_placeholder + + # @return [String] Represents short alphabetic codes developed to represent countries + attr_accessor :country_code + def initialize @message_type = "NUMERIC" @pin_type = "NUMERIC" @channel = "generic" @pin_attempts = 3 @@ -18,13 +43,25 @@ @pin_time_to_live = 10 @pin_placeholder = "< 1234 >" @country_code = "NG" end + # + # Subclasses must implement the verify method + # + # @return [Object] NotImplementedError + # def verify raise NotImplementedError, "Subclasses must implement the verify method" end + # + # <Description> + # + # @param [<Type>] attrs <description> + # + # @return [<Type>] <description> + # def update_attributes(attrs) attrs.each do |key, value| self[key.to_s] = value end end