Sha256: 2ccbe7f91aea6eb1ca1d49fde74522128ce41fc019d085ad8ce601786f5a67db

Contents?: true

Size: 684 Bytes

Versions: 10

Compression:

Stored size: 684 Bytes

Contents

module ExvoAuth::Autonomous::Http
  def get(*args)
    http.get(*args)
  end

  def post(*args)
    http.post(*args)
  end

  def put(path, options = {})
    # This fixes 411 responses from nginx (on heroku) 
    # when Content-Length is missing on put requests.
    options[:body] ||= ""
    http.put(path, options)
  end

  def delete(*args)
    http.delete(*args)
  end

  def head(*args)
    http.head(*args)
  end

  def options(*args)
    http.options(*args)
  end
  
  protected
  
  def http
    basement.base_uri(base_uri)
    basement.basic_auth(username, password)
    basement
  end
  
  def basement
    @basement ||= Class.new do
      include HTTParty
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
exvo-auth-0.9.6 lib/exvo_auth/autonomous/http.rb
exvo-auth-0.9.5 lib/exvo_auth/autonomous/http.rb
exvo-auth-0.9.4 lib/exvo_auth/autonomous/http.rb
exvo-auth-0.9.3 lib/exvo_auth/autonomous/http.rb
exvo-auth-0.9.2 lib/exvo_auth/autonomous/http.rb
exvo-auth-0.9.0 lib/exvo_auth/autonomous/http.rb
exvo-auth-0.8.2 lib/exvo_auth/autonomous/http.rb
exvo-auth-0.8.0 lib/exvo_auth/autonomous/http.rb
exvo-auth-0.7.16 lib/exvo_auth/autonomous/http.rb
exvo-auth-0.7.15 lib/exvo_auth/autonomous/http.rb