slack-poster 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 07c5f328765ee39ea4c597fe9448528fa872aaeb
4
- data.tar.gz: 514f7b45a00bc1399dce1765d63c9b03f452a7fe
3
+ metadata.gz: bdfa929415bb8ec5a869549cd9794e0ae9c1ce39
4
+ data.tar.gz: d6fab5adbd4df33544ffd08fe14ebfda6c2a87e8
5
5
  SHA512:
6
- metadata.gz: 3989d89a58f3ebd429d178754dca328a257324440e1f36a3f47de62aac6376cbb64533995a66159a179e849fc56e50a49099c66c5aac45c19b337efd854d67d8
7
- data.tar.gz: f249d01b5721bec98080a8eaa20d5ae28f1d0d6664de7f9a993908b24dfc25719fd100b1c12826610d0914f65b19f4e0a7ec627f59b2411fa98a60052e83d893
6
+ metadata.gz: 201a3a6f73e820ee07dc0d99fd346e08acc6db0a2de0b4d3fec40363881e09bbe8ffb0ec5e32af766c25912834e80f122255b24bc070b194b6bac08fc84eb278
7
+ data.tar.gz: ba2be307db61a287f98aa1b8c0930ac28d8f4be166d3e446763c9fbd6afc5c14728fa6450b1bae027579237c66ca95166981fe63c84602dcc8d377dcb5df360f
data/README.md CHANGED
@@ -1,4 +1,7 @@
1
+ [![Dependency Status](https://gemnasium.com/rikas/slack-poster.svg)](https://gemnasium.com/rikas/slack-poster)
2
+
1
3
  # Slack Poster
4
+ [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/rikas/slack-poster?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
2
5
 
3
6
  [Slack](https://slack.com/) is a mashup of chatrooms and collaborative sharing tools that are meant to do away with redundant conversations in multiple places.
4
7
 
@@ -9,8 +12,8 @@ slack-poster is a simple gem to make your integration with Slack easier. It supp
9
12
  Add this line to your application's Gemfile:
10
13
 
11
14
  ```console
12
- gem 'slack-poster'
13
- ``
15
+ $ gem 'slack-poster'
16
+ ```
14
17
 
15
18
  And then execute:
16
19
 
@@ -26,15 +29,17 @@ $ gem install slack-poster
26
29
 
27
30
  ## Usage
28
31
 
29
- Just create a new poster and send the message:
32
+ First, you need to create an Incoming Webhook integration at https://team-name.slack.com/services/new/incoming-webhook and take note of the generated token.
33
+
34
+ Next, create a new poster and send the message:
30
35
 
31
36
  ```ruby
32
- TEAM = 'my-test-team'
37
+ TEAM = 'team-name'
33
38
  TOKEN = 'hd7heoo2oijd0'
34
39
 
35
40
  poster = Slack::Poster.new(TEAM, TOKEN)
36
41
  poster.send_message('Hello, world!')
37
- ``
42
+ ```
38
43
 
39
44
  You can use an options array if you don't want to use the settings configured directly on Slack:
40
45
 
@@ -45,13 +50,13 @@ options = {
45
50
  username: 'Tester',
46
51
  channel: '#random'
47
52
  }
48
- ``
53
+ ```
49
54
 
50
55
  And then use it as a third parameter. Note that every option is optional (no pun intended!).
51
56
 
52
57
  ```ruby
53
58
  poster = Slack::Poster.new(TEAM, TOKEN, options)
54
- poster.send('Hi!') # will send to #random with the username 'Tester'
59
+ poster.send_message('Hi!') # will send to #random with the username 'Tester'
55
60
  ```
56
61
 
57
62
  That's it!
@@ -6,8 +6,8 @@ module Slack
6
6
 
7
7
  attr_accessor :username, :channel
8
8
 
9
- # The default format of the requests. Used on HTTP header 'Content-Type'.
10
- format :json
9
+ # The format of the response. This comes back as 'ok' from slack.
10
+ format :plain
11
11
 
12
12
  # Disable the use of rails query string format.
13
13
  #
@@ -53,9 +53,8 @@ module Slack
53
53
  # This method will post to the configured team Slack.
54
54
  def send_message(text)
55
55
  body = { text: text, channel: @channel, username: @username }.merge(avatar_hash)
56
- body = { body: "payload=#{body.to_json}" }
57
56
 
58
- response = self.class.post('/services/hooks/incoming-webhook', body)
57
+ response = self.class.post('/services/hooks/incoming-webhook', { body: { payload: body.to_json }})
59
58
 
60
59
  "#{response.body} (#{response.code})"
61
60
  end
@@ -75,4 +74,4 @@ module Slack
75
74
  emoji.empty? ? nil : ":#{emoji}:"
76
75
  end
77
76
  end
78
- end
77
+ end
@@ -1,3 +1,3 @@
1
1
  module Slack
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-poster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo Otero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-03 00:00:00.000000000 Z
11
+ date: 2015-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  version: '0'
89
89
  requirements: []
90
90
  rubyforge_project:
91
- rubygems_version: 2.2.1
91
+ rubygems_version: 2.2.2
92
92
  signing_key:
93
93
  specification_version: 4
94
94
  summary: Slack wrapper for Incoming WebHooks integrations.