Create a gist now

Instantly share code, notes, and snippets.

using Faraday with EM-Synchrony & EM-Http
require 'faraday'
require 'net/http'
require 'pp'
# Repos:
# Blog posts:
conn = => '') do |builder|
builder.use Faraday::Adapter::EMSynchrony # make http request with eventmachine and synchrony
builder.use Faraday::Response::Yajl # parse body with yajl
resp = conn.get do |req|
req.url "/v2/feed/info?appkey=demokey&format=json&"
pp resp
# Set EM-Synchrony to be default drive + parse JSON responses
Faraday.default_connection = do |builder|
builder.use Faraday::Adapter::EMSynchrony
builder.use Faraday::Response::Yajl
resp = Faraday.get ""
pp resp

If using nokogiri would setting the content type to xml and using a post request with your xml document be sufficient to get this working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment