Sha256: ece96cf3532115a75be7a73919ad8f4f945e9391d2894caa594c2bb35701fb23

Contents?: true

Size: 904 Bytes

Versions: 22

Compression:

Stored size: 904 Bytes

Contents

module Slack
  module Web
    module Faraday
      module Request
        def get(path, options = {})
          request(:get, path, options)
        end

        def post(path, options = {})
          request(:post, path, options)
        end

        def put(path, options = {})
          request(:put, path, options)
        end

        def delete(path, options = {})
          request(:delete, path, options)
        end

        private

        def request(method, path, options)
          options = options.merge(token: token)
          response = connection.send(method) do |request|
            case method
            when :get, :delete
              request.url(path, options)
            when :post, :put
              request.path = path
              request.body = options unless options.empty?
            end
          end
          response.body
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
slack-ruby-client-bhe-0.5.5 lib/slack/web/faraday/request.rb
slack-ruby-client-bhe-0.5.4 lib/slack/web/faraday/request.rb
slack-ruby-client-0.7.9 lib/slack/web/faraday/request.rb
slack-ruby-client-0.7.8 lib/slack/web/faraday/request.rb
slack-ruby-client-0.7.7 lib/slack/web/faraday/request.rb
slack-ruby-client-0.7.6 lib/slack/web/faraday/request.rb
slack-ruby-client-0.7.5 lib/slack/web/faraday/request.rb
slack-ruby-client-0.7.4 lib/slack/web/faraday/request.rb
slack-ruby-client-0.7.3 lib/slack/web/faraday/request.rb
slack-ruby-client-0.7.2 lib/slack/web/faraday/request.rb
slack-ruby-client-0.7.1 lib/slack/web/faraday/request.rb
slack-ruby-client-0.7.0 lib/slack/web/faraday/request.rb
slack-ruby-client-0.6.0 lib/slack/web/faraday/request.rb
slack-ruby-client-0.5.4 lib/slack/web/faraday/request.rb
slack-ruby-client-0.5.3 lib/slack/web/faraday/request.rb
slack-ruby-client-0.5.2 lib/slack/web/faraday/request.rb
slack-ruby-client-0.5.1 lib/slack/web/faraday/request.rb
slack-ruby-client-0.5.0 lib/slack/web/faraday/request.rb
slack-ruby-client-0.4.0 lib/slack/web/faraday/request.rb
slack-ruby-client-0.3.1 lib/slack/web/faraday/request.rb