Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
razorsync / lib / razorsync / connection.rb
Size: Mime:
require 'faraday_middleware'
Dir[File.expand_path('../../faraday/*.rb', __FILE__)].each{|f| require f}

module Razorsync
  module Connection
    private

    def generate_endpoint(portal_name)
      return "https://#{portal_name}.0.razorsync.com/ApiService.svc"
    end

    def connection
      options = {
        :url => "#{generate_endpoint(portal_name)}"
      }

      # TODO: Remove or update the RazorsyncAuth middleware as needed. See the faraday/auth.rb
      # TODO: file for additional information.
      Faraday::Connection.new(options) do |connection|
        connection.use FaradayMiddleware::RazorsyncAuth, token, portal_name
        connection.use FaradayMiddleware::Mashify
        connection.use Faraday::Response::ParseJson
        connection.adapter(adapter)
        connection.response :logger if logging
      end
    end
  end
end