Skip to content
This repository has been archived by the owner on Jan 3, 2018. It is now read-only.

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustavo Bazan committed Sep 27, 2015
1 parent 8a1902e commit 504c6cd
Showing 1 changed file with 50 additions and 11 deletions.
61 changes: 50 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,70 @@
Slack API Wrapper [![Build Status](https://travis-ci.org/gssbzn/slack-api-wrapper.svg)](https://travis-ci.org/gssbzn/slack-api-wrapper)[![Code Climate](https://codeclimate.com/github/gssbzn/slack-api-wrapper/badges/gpa.svg)](https://codeclimate.com/github/gssbzn/slack-api-wrapper)
=========================
# Slack API Wrapper
[![Gem Version](https://badge.fury.io/rb/slack-api-wrapper.svg)](http://badge.fury.io/rb/slack-api-wrapper)
[![Build Status](https://travis-ci.org/gssbzn/slack-api-wrapper.svg)](https://travis-ci.org/gssbzn/slack-api-wrapper)
[![Code Climate](https://codeclimate.com/github/gssbzn/slack-api-wrapper/badges/gpa.svg)](https://codeclimate.com/github/gssbzn/slack-api-wrapper)
[![Coverage Status](https://coveralls.io/repos/gssbzn/slack-api-wrapper/badge.svg?branch=master&service=github)](https://coveralls.io/github/gssbzn/slack-api-wrapper)

A library that provides a plain function-call interface to the Slack API web endpoints.

This a work in progress, many API endpoint implementations are still missing,
I expect to add them as soon as possible or you can help by making a pull request.

## Installation

Add this line to your application's Gemfile:

gem 'slack-api-wrapper'
```ruby
gem 'slack-api-wrapper'
```

And then execute:

$ bundle
```console
bundle
```

Or install it yourself as:

$ gem install slack-api-wrapper
```console
gem install 'slack-api-wrapper
```

## Usage

TODO: Write usage instructions here
You need to get an api token to use the ruby client.
You can follow Slack documentation about it (https://api.slack.com/docs/oauth),
or use [omniauth-slack](https://github.com/kmrshntr/omniauth-slack) to get one.

```ruby
# Initialize client
client = Slack::Client.new api_token

# Test user token
response = client.auth_test
puts "id: #{response['user_id']}, name: #{response['user']}"

# Get user teammates
response = client.users_list
response['members'].each do |user|
puts "id: #{user['id']}, name: #{user['name']}"
end

# Get user channels
response = client.channels_list
response['channels'].each do |channel|
puts "id: #{channel['id']}, name: #{channel['name']}"
end

You can see a demo here [slack-web-test](https://github.com/gssbzn/slack-web-test)
# Get user private groups
response = client.groups_list
response['groups'].each do |group|
puts "id: #{group['id']}, name: #{group['name']}"
end

# Posting a message
response = client.chat_post_message('channel'=> 'CXXXX', 'text'=> 'Testing Slack API', 'as_user'=> true)
```

## Additional Resources

Slack API Docs: https://api.slack.com/

## Contributing

Expand All @@ -34,7 +74,6 @@ You can see a demo here [slack-web-test](https://github.com/gssbzn/slack-web-tes
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request


## License

MIT License. Copyright 2015 Gustavo Bazan. http://gustavobazan.com
Expand Down

0 comments on commit 504c6cd

Please sign in to comment.