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

Version Path
moocher-0.3.2 lib/moocher/domains.rb
moocher-0.2.2 lib/moocher/domains.rb
moocher-0.2.1.3 lib/moocher/domains.rb
moocher-0.2.1.2 lib/moocher/domains.rb
moocher-0.2.1.1 lib/moocher/domains.rb
moocher-0.2.1 lib/moocher/domains.rb
moocher-0.2 lib/moocher/domains.rb
moocher-0.1.1.7pre lib/moocher/domains.rb
moocher-0.1.1.6pre lib/moocher/domains.rb
moocher-0.1.1.5pre lib/moocher/domains.rb
moocher-0.1.1.4pre lib/moocher/domains.rb