Sha256: 0ae4c88c5fc3d2d0b66a55fc4c1214f951a026b8563737a6ee0bc815f05b9dc0

Contents?: true

Size: 686 Bytes

Versions: 1

Compression:

Stored size: 686 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 Rubygem #{Typetalk::VERSION}"},
        :proxy => Typetalk.config.proxy,
      }
    end

    def connection(multipart:false)
      Faraday.new(connection_options) do |conn|
        conn.request :multipart if multipart
        conn.use Faraday::Request::UrlEncoded
        conn.use Faraday::Adapter::NetHttp
        # conn.use Faraday::Response::ParseJson
        # conn.use Faraday::Response::Logger
      end
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

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