class Payhere::Validate
Public Instance Methods
validate(phone_number, amount)
click to toggle source
# File lib/payhere-sdk/validate.rb, line 9 def validate(phone_number, amount) validate_string?(phone_number, 'Phone number') validate_numeric?(amount, 'Amount') end
validate_numeric?(num, field)
click to toggle source
# File lib/payhere-sdk/validate.rb, line 14 def validate_numeric?(num, field) return true if num.is_a? Numeric raise Payhere::ValidationError, "#{field} should be a number" end
validate_string?(str, field)
click to toggle source
# File lib/payhere-sdk/validate.rb, line 20 def validate_string?(str, field) return true if str.is_a? String raise Payhere::ValidationError, "#{field} should be a string" end