slackbot-notifier 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/Gemfile +3 -0
- data/README.md +30 -0
- data/lib/slackbot_notifier.rb +29 -0
- data/slackbot-notifier.gemspec +13 -0
- metadata +51 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4e281a080d691f56fb16853971c022ca9633b5b4
|
4
|
+
data.tar.gz: d943ac522d4275a35d3c796f69737f79472626a5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7c5d2626436015cd9e2f2aca1d4fedb8400c5bd8cf6d223a7993f4a6d0dad3a0ce9fbe506a2b33b4affcf768bf16a42cdabf9c1a9b1a2bae6a92eb03c8297b43
|
7
|
+
data.tar.gz: fe457098ec88b2c48532b4e60489dcc2a7c3d5c4f01d89656b9722e9df2827c2bc4eb1968ca81b161e267edb3d0a22f210687e1a07292f9504811d586d76e0f8
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
Instalation
|
2
|
+
----
|
3
|
+
|
4
|
+
Add `gem slackbot-notifier` to your gemfile.
|
5
|
+
|
6
|
+
Configuration
|
7
|
+
-----
|
8
|
+
|
9
|
+
Create an initializer named `slackbot_notifier` that has the following stuff:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
require 'slackbot_notifier'
|
13
|
+
|
14
|
+
SlackbotNotifier.slackbot_url = YOUR_SLACKBOT_URL
|
15
|
+
```
|
16
|
+
|
17
|
+
Usage
|
18
|
+
-----
|
19
|
+
|
20
|
+
By default it will notify to the general room.
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
SlackbotNotifier.new.notify('pepe')
|
24
|
+
```
|
25
|
+
|
26
|
+
But if we pass to the initializer the room name, it will notify to that room.
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
SlackbotNotifier.new('another_room').notify('pepe')
|
30
|
+
```
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class SlackbotNotifier
|
2
|
+
attr_reader :room, :message
|
3
|
+
|
4
|
+
def initialize(room = 'general')
|
5
|
+
@room = room
|
6
|
+
end
|
7
|
+
|
8
|
+
def notify(message)
|
9
|
+
@message = message
|
10
|
+
http.request request
|
11
|
+
end
|
12
|
+
|
13
|
+
def uri
|
14
|
+
@uri ||= URI "#{SlackbotNotifier.slackbot_url}&channel=%23#{room}"
|
15
|
+
end
|
16
|
+
|
17
|
+
def http
|
18
|
+
@http ||= Net::HTTP.new(uri.host, uri.port).tap { |h| h.use_ssl = uri.scheme == 'https' }
|
19
|
+
end
|
20
|
+
|
21
|
+
def request
|
22
|
+
@request ||= Net::HTTP::Post.new(uri.request_uri).tap do |r|
|
23
|
+
r.body = message
|
24
|
+
r.content_type = 'text/xml'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class << self; attr_accessor :slackbot_url; end;
|
29
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.platform = Gem::Platform::RUBY
|
3
|
+
s.name = 'slackbot-notifier'
|
4
|
+
s.version = '1.0.0'
|
5
|
+
s.date = '2015-05-30'
|
6
|
+
s.summary = "Slackbot notifier"
|
7
|
+
s.description = "This gem wraps the notification to a slack's room by through slackbot"
|
8
|
+
s.authors = ["Mariano Matayoshi", "Ricardo Kleine Samson", "Nicolas Oga"]
|
9
|
+
s.email = 'matayoshi.mariano@gmail.com'
|
10
|
+
s.files = `git ls-files`.split("\n")
|
11
|
+
s.homepage = 'https://github.com/casapick/slackbot-notifier'
|
12
|
+
s.license = 'MIT'
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: slackbot-notifier
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mariano Matayoshi
|
8
|
+
- Ricardo Kleine Samson
|
9
|
+
- Nicolas Oga
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2015-05-30 00:00:00.000000000 Z
|
14
|
+
dependencies: []
|
15
|
+
description: This gem wraps the notification to a slack's room by through slackbot
|
16
|
+
email: matayoshi.mariano@gmail.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- ".gitignore"
|
22
|
+
- Gemfile
|
23
|
+
- README.md
|
24
|
+
- lib/slackbot_notifier.rb
|
25
|
+
- slackbot-notifier.gemspec
|
26
|
+
homepage: https://github.com/casapick/slackbot-notifier
|
27
|
+
licenses:
|
28
|
+
- MIT
|
29
|
+
metadata: {}
|
30
|
+
post_install_message:
|
31
|
+
rdoc_options: []
|
32
|
+
require_paths:
|
33
|
+
- lib
|
34
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
requirements: []
|
45
|
+
rubyforge_project:
|
46
|
+
rubygems_version: 2.4.8
|
47
|
+
signing_key:
|
48
|
+
specification_version: 4
|
49
|
+
summary: Slackbot notifier
|
50
|
+
test_files: []
|
51
|
+
has_rdoc:
|