Sha256: 006dc5bf3becf6c62a9837db8f2f488ce0286890366ed8199362ff0646de4046
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
module ActionTexter module Validator class Request class ProductTokenMissing < ArgumentError; end class EndpointMissing < ArgumentError; end class PathMissing < ArgumentError; end class ContentTypeMissing < ArgumentError; end def initialize @endpoint = ActionTexter.config.endpoint @path = ActionTexter.config.path @content_type = ActionTexter.config.content_type @api_key = ActionTexter.config.product_token validate end 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 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
action-texter-0.0.1 | lib/action_texter/validator/request.rb |