Sha256: b98771608185cc5b154f51c02271d6d3dc096d1f76b73f7a99e4f1510895d3b1

Contents?: true

Size: 526 Bytes

Versions: 3

Compression:

Stored size: 526 Bytes

Contents

module Chatbase
  class HttpService

    def connection
      @connection ||= begin
        Faraday.new(:url => 'https://chatbase.com/') do |faraday|
          faraday.response :json, :content_type => /\bjson$/
          faraday.adapter  Faraday.default_adapter  # make requests with Net::HTTP
        end
      end
    end

    def request_post(url, data)
      connection.post do |req|
        req.url url
        req.headers['Content-Type'] = 'application/json'
        req.body = data.to_json
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
chatbase-0.1.6 lib/chatbase/http_service.rb
chatbase-0.1.5 lib/chatbase/http_service.rb
chatbase-0.1.4 lib/chatbase/http_service.rb