require 'faraday_middleware' require 'faraday/response/raise_getty_connect_error' module GettyConnect module Connection private def connection url = "https://connect.gettyimages.com" options = { :ssl => { :verify => false }, :url => url } connection = Faraday.new(options) do |builder| builder.request :json builder.use Faraday::Response::RaiseGettyConnectError builder.use FaradayMiddleware::Mashify builder.use FaradayMiddleware::ParseJson builder.adapter(Faraday.default_adapter) end connection end end end