MessageExchange Code Climate Build Status

Use MessageExchange to simplify the passing of JSON-based messages between HTTP based applications.

Installation

Add this line to your application's Gemfile:

gem 'message_exchange', git: '[email protected]:onthebeach/message_exchange.git'

And then execute:

$ bundle

Or install it yourself as:

$ gem install message_exchange

Usage

Craft your request, replacing the class with one of Get, Post, Put or Delete.

request = MessageExchange::Get.new(url_string, params_hash)

Consume the response:

response = request.response

response.status # => the HTTP response code

response.success? # => Boolean (based on 20x response code)

response.body # => some stuff you probably wanted

Todo

  • Implement other HTTP v1.1 methods: Patch, Options, Head, Trace or Connect.
  • Better error handling; currently only catches request timeouts.
  • Configurable timeouts.
  • Configurable headers.
  • Configurable ports (instead of just port 80).
  • HTTP/HTTPS support.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b feature/my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin feature/my-new-feature)
  5. Create new Pull Request