EmmyHttp::Client

This gem is part of Emmy framework

gem install emmy

Usage

response = Emmy.request(url: "http://httpbin.org/get").sync

or,

request = Emmy.request(url: "http://httpbin.org/post", form: {param: 'foo'}).post.sync

Long way,

request = EmmyHttp::Request.new(url: "http://google.com")
operation = EmmyHttp::Operation.new(request, EmmyHttp::Client::Adapter)
response = operation.sync

Asynchronous requests

Emmy.run_block {
  responses = {
      get_request:  Emmy.request!(url: "http://httpbin.org/get")
      post_request: Emmy.request!(url: "http://httpbin.org/post", type: "POST", form: {param: 'foo'})
  }.sync

  p responses[:get_request]
  p responses[:post_request]
}