Sha256: 52dc1a1c7b69d9e05eb4d0aed297cca2f065462c8c2b8ba9e5627c54b8e3d6d8
Contents?: true
Size: 768 Bytes
Versions: 11
Compression:
Stored size: 768 Bytes
Contents
require 'httparty' module Moocher module Domain def domain_blacklisted?(domain_name, details: false) return "Domain doesn't seem to be valid." if (domain_name =~ /^((http|https):\/\/)?[a-z0-9]*(\.?[a-z0-9]+)\.[a-z]{2,5}(:[0-9]{1,5})?(\/.)?$/ix).nil? base_url = 'https://api.moocher.io/baddomain/' unless details response = HTTParty.get(base_url + domain_name) response.success? else if details == true response = HTTParty.get("https://api.moocher.io/baddomain/#{domain_name}", headers: {"Content-Type": "application/json"}) return response.parsed_response else "'details:' is by default set to false. You can only be set it to true." end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems