Project

slack.rb

0.0
No commit activity in last 3 years
No release in over 3 years
Ruby toolkit for working with the Slack API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.5

Runtime

~> 0.9.0
 Project Readme

Slack.rb

Ruby toolkit for working with the Slack API

Build Status Code Climate

Installation

Add this line to your application's Gemfile:

gem 'slack'

And then execute:

$ bundle

Or install it yourself as:

$ gem install slack

Usage

Making requests

# Provide authentication credentials
client = Slack::Client.new(team: 'netflower', token: 'xxxx-xxxxxxxxx-xxxx')
# Post a message
client.post_message("May the force be with you", "yoda-quotes")
# List all channels
client.channels

Configuration and defaults

Configuring module defaults

Every writable attribute in {Slack::Configurable} can be set one at a time:

Slack.api_endpoint     = 'https://slack.dev/api'
Slack.default_channel  = '#lol-cats'
Slack.username         = 'Yoda'

or in batch:

Slack.configure do |c|
  c.api_endpoint     = 'https://slack.dev/api'
  c.default_channel  = '#lol-cats'
  c.username         = 'Yoda'
end

Using ENV variables

Default configuration values are specified in {Slack::Default}. Many attributes will look for a default value from the ENV before returning Slack's default.

# Given $SLACK_API_ENDPOINT is "https://slack.dev/api"
Slack.api_endpoint

# => "https://slack.dev/api"

Contributing

  1. Fork it ( http://github.com/netflower/slack.rb/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request