Sha256: aac5e4f00d0528e293b7d35b8a05a565462da7896032e10bafe63b362025d547

Contents?: true

Size: 991 Bytes

Versions: 15

Compression:

Stored size: 991 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
            request.options.merge!(options.delete(:request)) if options.key?(:request)
          end
          response.body
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
slack-ruby-client-0.14.4 lib/slack/web/faraday/request.rb
slack-ruby-client-0.14.3 lib/slack/web/faraday/request.rb
slack-ruby-client-0.14.2 lib/slack/web/faraday/request.rb
slack-ruby-client-0.14.1 lib/slack/web/faraday/request.rb
slack-ruby-client-0.14.0 lib/slack/web/faraday/request.rb
slack-ruby-client-0.13.1 lib/slack/web/faraday/request.rb
slack-ruby-client-0.13.0 lib/slack/web/faraday/request.rb
slack-ruby-client-0.12.0 lib/slack/web/faraday/request.rb
slack-ruby-client-0.11.1 lib/slack/web/faraday/request.rb
slack-ruby-client-0.11.0 lib/slack/web/faraday/request.rb
slack-ruby-client-0.10.0 lib/slack/web/faraday/request.rb
slack-ruby-client-0.9.1 lib/slack/web/faraday/request.rb
slack-ruby-client-0.9.0 lib/slack/web/faraday/request.rb
slack-ruby-client-0.8.1 lib/slack/web/faraday/request.rb
slack-ruby-client-0.8.0 lib/slack/web/faraday/request.rb