lib/base.rb in sendgrid_webapi-0.0.3 vs lib/base.rb in sendgrid_webapi-0.0.4

- old
+ new

@@ -1,8 +1,8 @@ -module SendGridWebApi - autoload :Faraday, 'middlewares/sendgrid_response' - +require 'faraday_middleware' + +module SendGridWebApi class Base attr_accessor :api_user, :api_key def initialize api_user, api_key @api_user = api_user @@ -31,10 +31,13 @@ Faraday::Utils.build_nested_query(options) end def session @connection ||= ::Faraday.new base_url do |conn| - conn.use Faraday::Response::SendGridWebApi + # Forces the connection request and response to be JSON even though + # Sendgrids API headers do not specify the content type is JSON + conn.request :json + conn.response :json #, :content_type => /\bjson$/ conn.adapter Faraday.default_adapter end end end end