class ActionTexter::Validator::Request

Public Class Methods

new() click to toggle source
# File lib/action_texter/validator/request.rb, line 9
def initialize
  @endpoint     = ActionTexter.config.endpoint
  @path         = ActionTexter.config.path
  @content_type = ActionTexter.config.content_type
  @api_key      = ActionTexter.config.product_token

  validate
end

Public Instance Methods

validate() click to toggle source
# File lib/action_texter/validator/request.rb, line 18
def validate
  fail EndpointMissing, "Please provide an valid api endpoint.\nIf you leave this config blank, the default will be set to https://rest.sms-service.org  ." if @endpoint.nil? || @endpoint.empty?
  fail ContentTypeMissing, 'Please provide a valid content_type! Defaults to application/json' if @content_type.nil? || @content_type.empty?
  fail PathMissing, "Please provide an valid api path.\nIf you leave this config blank, the default will be set to /message." if @path.nil? || @path.empty?
  fail ProductTokenMissing, "Please provide an valid product key.\nAfter signup at https://www.messagebird.com/, you will find one in your settings." if @api_key.nil?
end