slack-post 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/lib/slack/post.rb +7 -4
- data/lib/slack/post/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbcc725463980506c2af9898e9d37f0b92163350
|
4
|
+
data.tar.gz: fb11f3587bc82ca8ed87f1505a323ad67b7292ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8b7b559d66708268f01c54f7b0cc5edde281029be145da1971d79f6a0d3f5ad2a02695a00940aa4c23987e418dd74350041ad8aa118deb0912a4a26cb736f0d
|
7
|
+
data.tar.gz: e63c4596bcb406078bd0e15dfb236461ce575338f43bef9765bdcf6098b152090a7692bcf56eb2e4e1f248dd4f34a2ecbae1e6bafa91b7d6d530e742aff26555
|
data/README.md
CHANGED
@@ -18,8 +18,13 @@ Example:
|
|
18
18
|
```ruby
|
19
19
|
require 'slack/post'
|
20
20
|
Slack::Post.configure(
|
21
|
+
# you may provide a webhook URL (recommended)
|
22
|
+
webhook_url: 'https://hooks.slack.com/services/N0TRE4LLY/AL1V3URL/fdjm89vn2bv9cvbsvHfdm8hdkl'
|
23
|
+
|
24
|
+
# OR a subdomain/token combo, which will use Slack's legacy team-specific webhook URL (not recommended)
|
21
25
|
subdomain: 'myslack',
|
22
26
|
token: 'abc1234567890def',
|
27
|
+
|
23
28
|
username: 'roboto, mr.'
|
24
29
|
)
|
25
30
|
Slack::Post.post "Domo arigato.", '#general'
|
data/lib/slack/post.rb
CHANGED
@@ -59,14 +59,17 @@ module Slack
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def self.post_url
|
62
|
-
"https://#{config[:subdomain]}.slack.com/services/hooks/incoming-webhook?token=#{config[:token]}"
|
62
|
+
config[:webhook_url] || "https://#{config[:subdomain]}.slack.com/services/hooks/incoming-webhook?token=#{config[:token]}"
|
63
63
|
end
|
64
64
|
|
65
|
-
|
65
|
+
LegacyConfigParams = [:subdomain,:token].freeze
|
66
66
|
|
67
67
|
def self.configured?(needs_channel=true)
|
68
68
|
return false if needs_channel and !config[:channel]
|
69
|
-
|
69
|
+
|
70
|
+
# we need _either_ a webhook url or all LegacyConfigParams
|
71
|
+
return true if config[:webhook_url]
|
72
|
+
LegacyConfigParams.all? do |parm|
|
70
73
|
config[parm]
|
71
74
|
end
|
72
75
|
end
|
@@ -79,7 +82,7 @@ module Slack
|
|
79
82
|
@config = config.merge(prune(opts))
|
80
83
|
end
|
81
84
|
|
82
|
-
KnownConfigParams = [:username,:channel,:subdomain,:token,:icon_url,:icon_emoji].freeze
|
85
|
+
KnownConfigParams = [:webhook_url,:username,:channel,:subdomain,:token,:icon_url,:icon_emoji].freeze
|
83
86
|
AttachmentParams = [:fallback,:text,:pretext,:color,:fields].freeze
|
84
87
|
FieldParams = [:title,:value,:short].freeze
|
85
88
|
|
data/lib/slack/post/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack-post
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Bragg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
90
|
version: '0'
|
91
91
|
requirements: []
|
92
92
|
rubyforge_project:
|
93
|
-
rubygems_version: 2.
|
93
|
+
rubygems_version: 2.4.5
|
94
94
|
signing_key:
|
95
95
|
specification_version: 4
|
96
96
|
summary: It's for posting messages to your slack.
|