Sha256: a124c522a91899c4843f1720bfbcf97406cb8426f0a11c625a19a22308375967

Contents?: true

Size: 707 Bytes

Versions: 5

Compression:

Stored size: 707 Bytes

Contents

module Net
  class << self
    def build(base_url, &block)
      Session.build(base_url, &block)
    end

    def reachable?(hostname = 'www.google.com', &block)
      Reachability.new(hostname, &block)
    end

    def stub(base_url)
      expectation = Expectation.all.find{ |e| e.base_url == base_url }
      if expectation.nil?
        expectation = Expectation.new(base_url)
        Expectation.all << expectation
      end
      expectation
    end

    [:get, :post, :put, :delete, :patch, :options, :head].each do |http_method|
      define_method(http_method) do |base_url, *options, &callback|
        Request.send(http_method, base_url, options.shift || {}, callback)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
motion-flow-0.1.8 flow/net/net.rb
motion-flow-0.1.7 flow/net/net.rb
motion-flow-0.1.6 flow/net/net.rb
motion-flow-0.1.5 flow/net/net.rb
motion-flow-0.1.4 flow/net/net.rb