module Apilayer::Mailbox
Constants
- INVALID_OPTIONS_MSG
Public Class Methods
assign_smtp_value(opts)
click to toggle source
# File lib/apilayer/mailbox.rb, line 32 def self.assign_smtp_value(opts) if opts[:smtp] == false { smtp: 0 } else { smtp: 1 } end end
check(email, opts={})
click to toggle source
Api-Method: Calls the /check endpoint to verify the existence of an email address
Examples:
Apilayer::Mailbox.check('support@apilayer.com') Apilayer::Mailbox.check('support@apilayer.com', {smtp: false}) # If you don't want to perform smtp checks
# File lib/apilayer/mailbox.rb, line 25 def self.check(email, opts={}) validate_options(opts) opts = assign_smtp_value(opts) params = { email: email }.merge(opts) get_and_parse("check", params) end
validate_options(options)
click to toggle source
Validations
# File lib/apilayer/mailbox.rb, line 11 def self.validate_options(options) options.keys.each do |key| unless [:smtp].include? key raise Apilayer::Error.new(INVALID_OPTIONS_MSG) end end end