Skip to content

netflower/slack.rb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Ruby toolkit for working with the Slack API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •