Sha256: 5201166bad1c45e2eacec1750248a4a4d4828ac9f09d425cc1af9b948fbe14b5

Contents?: true

Size: 621 Bytes

Versions: 1

Compression:

Stored size: 621 Bytes

Contents

require 'faraday'

module Typetalk

  module Connection
    private

    def endpoint
      Typetalk.config.endpoint
    end

    def connection_options
      {
        :headers => {'Accept' => 'application/json; charset=utf-8', 'User-Agent' => Typetalk.config.user_agent},
        :proxy => Typetalk.config.proxy,
      }
    end

    def connection(options={})
      options = {multipart:nil}.merge(options)

      Faraday.new(connection_options) do |builder|
        builder.request :multipart if options[:multipart]
        builder.request :url_encoded
        builder.adapter :net_http
      end
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
typetalk-0.1.1 lib/typetalk/connection.rb