Sha256: 9842eff7045d475594af11f458d58e857431386adcb6b3b4acd0a1cd91a3b064
Contents?: true
Size: 607 Bytes
Versions: 3
Compression:
Stored size: 607 Bytes
Contents
require 'uri' require "manifique/web_client" module Manifique class Agent def initialize(options={}) @options = options if url_valid?(options[:url]) @url = options[:url] else raise "No valid URL specified" end end def fetch_metadata web_client = WebClient.new(url: @url) web_client.fetch_metadata end private def url_valid?(str) return false unless str.class == String url = URI.parse(str) url.kind_of?(URI::HTTP) || url.kind_of?(URI::HTTPS) rescue URI::InvalidURIError false end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
manifique-1.1.0 | lib/manifique/agent.rb |
manifique-1.0.1 | lib/manifique/agent.rb |
manifique-1.0.0 | lib/manifique/agent.rb |