Sha256: 8a13e09fa923502817e4f04712f210c29c83001e903667dd8b0b8b73910c10d0

Contents?: true

Size: 596 Bytes

Versions: 2

Compression:

Stored size: 596 Bytes

Contents

module Slack
  module Connection
    def get(method)
      response = connection.get method, { token: @token }

      if response.success?
        response
      else
        raise UnknownResponseCode, "Unexpected #{response.code}"
      end
    end

    def post(method, payload)
      response = connection.post do |req|
        req.url method, payload.to_hash
      end
    end

    def connection
      _connection = Faraday.new(@api_endpoint, @connection_options)
      _connection.headers = {'Accept' => @default_media_type, 'User-Agent' => @user_agent}
      _connection
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slack.rb-0.0.6 lib/slack/connection.rb
slack.rb-0.0.5 lib/slack/connection.rb