Sha256: 61a8e2abdd396fb292ddccce6a43f550dcb1459c53004d384c29cd6aa23ed6f6

Contents?: true

Size: 721 Bytes

Versions: 4

Compression:

Stored size: 721 Bytes

Contents

module Spree
  module API
    class Client
      module Connection
        def connection(options={})
          options = {
            :ssl              => { :verify => false },
            :url              => api_endpoint,
          }.merge(options)

          connection = Faraday.new(options) do |builder|
            builder.request :json

            builder.use FaradayMiddleware::FollowRedirects
            builder.use FaradayMiddleware::Mashify
            builder.use Faraday::Response::RaiseError

            builder.use FaradayMiddleware::ParseJson, :content_type => /\bjson$/

            builder.adapter  Faraday.default_adapter
          end
          connection
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cq-spree-api-client-0.0.10 lib/spree-api-client/connection.rb
cq-spree-api-client-0.0.9 lib/spree-api-client/connection.rb
cq-spree-api-client-0.0.6 lib/spree-api-client/connection.rb
cq-spree-api-client-0.0.5 lib/spree-api-client/connection.rb