0.0
No commit activity in last 3 years
No release in over 3 years
Simple code for simple HTTP requests
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

~> 1.1, >= 1.1.1
 Project Readme

simple-http

A really simple HTTP client

  • GET, POST, PUT, DELETE

      require "simple/http"
      http_client = Simple::HTTP.new
      http_client.get "http://google.com" # returns a string
    
  • Exceptions on errors: because, after all, when you consume a HTTP endpoint and don't get a success (20x), then this is an error. Handle it!

      require "simple/http"
      http_client = Simple::HTTP.new
      begin
        http_client.get "http://google.com" # returns a string
      rescue Simple::HTTP::Error
        STDERR.puts "Ooops! #{$!}"
      end
    
  • Caching

      require "simple/http"
      http_client = Simple::HTTP.new
    
      require "active_support/cache"
      require "active_support/cache/file_store"
      http_client.cache = ActiveSupport::Cache::FileStore.new("var/cache")
      http_client.get "http://google.com" # returns a, potentially, cached string
    
  • Automatic de/encoding of JSON payloads

  • Does not requires anything except core ruby classes.