notifyou 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/notifyou.rb +26 -0
- metadata +58 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1379b98a5130d284e3bfb5eadbc50296b6412c52
|
4
|
+
data.tar.gz: 785c89bc24eb1bf02ccfd034e19c20099f844ede
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ffef03458f9bfb76907048c8f127ee268ffdc34484e843bcc983f69d6b0d2f5af1cf461383980977e05d9cd690dca9fa72eda076a5d8c2db497d4fa5fcf58e90
|
7
|
+
data.tar.gz: e013f3f7a11715f76fa618b6274ef1d1a5dea20c9be80e6d62ceb12dff257cbca8ef96e7596fc032901e9b0b8f73009f068c1ab409b9e40230d32ea8ae32e38f
|
data/lib/notifyou.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'json'
|
2
|
+
#
|
3
|
+
# @author hienvd
|
4
|
+
# @date 20151006
|
5
|
+
#
|
6
|
+
class Notifyou
|
7
|
+
#specify a slack webhook url
|
8
|
+
def initialize url
|
9
|
+
@slack_url = url
|
10
|
+
end
|
11
|
+
|
12
|
+
# Notify a message to a channel/user
|
13
|
+
def notify msg, channel
|
14
|
+
if @slack_url == ''
|
15
|
+
puts "No slack webhook url specified"
|
16
|
+
return
|
17
|
+
end
|
18
|
+
|
19
|
+
hash = {:text => msg, :channel => channel}
|
20
|
+
json = JSON.generate(hash)
|
21
|
+
payload = "payload=#{json}"
|
22
|
+
|
23
|
+
`curl -X POST --data-urlencode '#{payload}' #{@slack_url}`
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: notifyou
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Hiền Vương
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-10-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: json
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: A simple gem for posting message to Slack from your code
|
28
|
+
email: duchienvuong@gmail.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- lib/notifyou.rb
|
34
|
+
homepage: https://github.com/hienvd/notifyou
|
35
|
+
licenses:
|
36
|
+
- MIT
|
37
|
+
metadata: {}
|
38
|
+
post_install_message:
|
39
|
+
rdoc_options: []
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
requirements: []
|
53
|
+
rubyforge_project:
|
54
|
+
rubygems_version: 2.2.2
|
55
|
+
signing_key:
|
56
|
+
specification_version: 4
|
57
|
+
summary: Just a simple gem, post message to Slack
|
58
|
+
test_files: []
|