Sha256: 84801ad89ebfe2d316e0c8d92580915ffbe26be56f30b0cdbb329b1b89972264

Contents?: true

Size: 755 Bytes

Versions: 1

Compression:

Stored size: 755 Bytes

Contents

require 'faraday_middleware'
require 'digest/md5'

module Surveygizmo
  # @private
  module Connection
    
    private

      def connection(temp_api_endpoint=nil)
        options = {
          :headers => { 'Accept' => 'application/json', 'User-Agent' => user_agent },
          :ssl => { :verify => false },
          :params => { :'user:md5' => "#{username}:#{Digest::MD5.hexdigest(password)}" }
        }

        options[:url] = temp_api_endpoint ? temp_api_endpoint : api_endpoint

        Faraday.new(options) do |builder|
          builder.use Faraday::Request::UrlEncoded
          builder.use Faraday::Response::Mashify
          builder.use Faraday::Response::ParseJson
          builder.adapter(:net_http)
        end
      end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
surveygizmo-0.0.1 lib/surveygizmo/connection.rb