Class: AlchemyLanguage::UrlService

Inherits:
ActiveMethod::Base show all
Defined in:
lib/alchemy_language/url_service.rb

Instance Attribute Summary collapse

Attributes inherited from ActiveMethod::Base

#json_res

Instance Method Summary collapse

Methods inherited from ActiveMethod::Base

authenticate!, authenticate_successfully?, before_request, define_model, json_parser, valid_api_key?

Constructor Details

#initialize(path) ⇒ UrlService

Returns a new instance of UrlService.



27
28
29
30
31
# File 'lib/alchemy_language/url_service.rb', line 27

def initialize(path)
  is_url?
  @path = path
  @type = "url"
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



3
4
5
# File 'lib/alchemy_language/url_service.rb', line 3

def path
  @path
end

#typeObject

Returns the value of attribute type.



3
4
5
# File 'lib/alchemy_language/url_service.rb', line 3

def type
  @type
end

Instance Method Details

#check_urlObject



37
38
39
# File 'lib/alchemy_language/url_service.rb', line 37

def check_url
  @path =~ URI::regexp(["ftp", "http", "https"])
end

#is_url?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/alchemy_language/url_service.rb', line 33

def is_url?
  "params is not url" if check_url.nil?
end