Open
Description
We're using the following code for almost a year, so I figured that you might want to put it in wiki or in contrib.
module Zencoder
class HTTP
module Faraday
extend self
def post(url, options={})
perform(:post, url, options)
end
def put(url, options={})
perform(:put, url, options)
end
def get(url, options={})
perform(:get, url, options)
end
def delete(url, options={})
perform(:delete, url, options)
end
def perform(method, url, options={})
body = options[:body]
headers = options[:headers]
::Faraday.send(method, url, body, headers)
end
end
end
end
module Faraday
class Response
alias_method :code, :status unless defined?(code)
end
end
Zencoder::HTTP.http_backend = Zencoder::HTTP::Faraday
Metadata
Metadata
Assignees
Labels
No labels