Sha256: 09fa406681647bd426421826116c97c88803668939a801baecf1a88b7f8a7fef

Contents?: true

Size: 721 Bytes

Versions: 2

Compression:

Stored size: 721 Bytes

Contents

require 'faraday_middleware'
require 'faraday/response/raise_getty_connect_error'

module GettyConnect
  module Connection
    private

    def connection(use_ssl=false)
      url = "http://connect.gettyimages.com"
      if (use_ssl)
        url = "https://connect.gettyimages.com"
      end

      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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
getty_connect-0.0.4 lib/getty_connect/connection.rb
getty_connect-0.0.3 lib/getty_connect/connection.rb