Class: FollowersNumber::Validator

Inherits:
Object
  • Object
show all
Defined in:
lib/followers_number/validator.rb

Defined Under Namespace

Classes: InvalidProfileURL

Constant Summary collapse

NETWORKS =
%w[twitter.com instagram.com youtube.com facebook.com medium.com]

Class Method Summary collapse

Class Method Details

.validate!(profile_url) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/followers_number/validator.rb', line 7

def self.validate!(profile_url)
  unless NETWORKS.include?(URI.parse(profile_url.to_s.downcase).host)
    raise InvalidProfileURL, profile_url
  end

  true
end