Sha256: 08bd155f4bfe6418226ebe5c1a9ee57f1559b64dad22d42323ca179e0c4f5b02

Contents?: true

Size: 1.61 KB

Versions: 9

Compression:

Stored size: 1.61 KB

Contents

#!/usr/bin/env ruby
#####################################################################################
# Copyright (c) 2011, Cohesive Flexible Technologies, Inc.
# This copyrighted material is the property of Cohesive Flexible Technologies and
# is subject to the license terms of the product it is contained within, whether 
# in text or compiled form.  It is licensed under the terms expressed in the 
# accompanying README and LICENSE files.
# 
# This program is AS IS and WITHOUT ANY WARRANTY; without even the implied warranty 
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#####################################################################################

# Enables modification of timeout in RestClient
module RestClient

  class << self
    attr_accessor :timeout
  end

  def self.get(url, headers={}, &block)
    Request.execute(:method => :get, :url => url, :headers => headers, :timeout => @timeout, &block)
  end

  def self.post(url, payload, headers={}, &block)
    Request.execute(:method => :post, :url => url, :payload => payload, :headers => headers, :timeout => @timeout, &block)
  end

  def self.patch(url, payload, headers={}, &block)
    Request.execute(:method => :patch, :url => url, :payload => payload, :headers => headers, :timeout => @timeout, &block)
  end

  def self.put(url, payload, headers={}, &block)
    Request.execute(:method => :put, :url => url, :payload => payload, :headers => headers, :timeout => @timeout, &block)
  end

  def self.delete(url, headers={}, &block)
    Request.execute(:method => :delete, :url => url, :headers => headers, :timeout => @timeout, &block)
  end
  
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cft_smartcloud-0.3.3 lib/restclient_fix.rb
cft_smartcloud-0.3.2 lib/restclient_fix.rb
cft_smartcloud-0.3.1 lib/restclient_fix.rb
cft_smartcloud-0.3.0 lib/restclient_fix.rb
cft_smartcloud-0.2.2 lib/restclient_fix.rb
cft_smartcloud-0.1.9 lib/restclient_fix.rb
cft_smartcloud-0.1.8 lib/restclient_fix.rb
cft_smartcloud-0.1.5 lib/restclient_fix.rb
cft_smartcloud-0.1.4 lib/restclient_fix.rb