slack-post 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -0
- data/lib/slack/post/version.rb +1 -1
- data/lib/slack/post.rb +5 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6dcd9c6029e35b1040592aaf06719e1d8081485a
|
4
|
+
data.tar.gz: d51c211e8de0b212011e800da48ae186f277dc86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95e8f95dfb638777b0404a3593fe2d27bb59bf9116480f3c86c9541ce95c87eb26c9e6f88741562176527775325b00e7c07020c965a969e6f1e40d2106190f0c
|
7
|
+
data.tar.gz: c996f58af7486b68d43faf286ee3e189382e61c851709f262f5a33412b127e0cbc076d6674cf722efb5c4431bc8d97baea592419c2153759d712ac388ad275ac
|
data/README.md
CHANGED
@@ -32,6 +32,17 @@ Slack::Post.configure(
|
|
32
32
|
Slack::Post.post "Domo arigato.", '#general'
|
33
33
|
```
|
34
34
|
|
35
|
+
### Proxy support
|
36
|
+
If you need to connect to Slack via a HTTP proxy, use `proxy_host` and `proxy_port` in your `configure()` call:
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
Slack::Post.configure(
|
40
|
+
webhook_url: 'https://hooks.slack.com/services/N0TRE4LLY/AL1V3URL/fdjm89vn2bv9cvbsvHfdm8hdkl',
|
41
|
+
proxy_host: '10.0.0.1',
|
42
|
+
proxy_port: 8080
|
43
|
+
)
|
44
|
+
```
|
45
|
+
|
35
46
|
### Attachments
|
36
47
|
|
37
48
|
slack-post supports message attachments per Slack's [Attachment](https://api.slack.com/docs/attachments) specification.
|
data/lib/slack/post/version.rb
CHANGED
data/lib/slack/post.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'slack/post/version'
|
2
2
|
require 'net/http'
|
3
3
|
require 'net/https'
|
4
4
|
require 'uri'
|
@@ -30,7 +30,8 @@ module Slack
|
|
30
30
|
pkt[:attachments] = attachments.map { |a| validated_attachment(a) }
|
31
31
|
end
|
32
32
|
uri = URI.parse(post_url)
|
33
|
-
|
33
|
+
|
34
|
+
http = Net::HTTP.new(uri.host, uri.port, config[:proxy_host], config[:proxy_port])
|
34
35
|
http.use_ssl = true
|
35
36
|
http.ssl_version = :TLSv1
|
36
37
|
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
@@ -42,7 +43,7 @@ module Slack
|
|
42
43
|
when Net::HTTPSuccess
|
43
44
|
return true
|
44
45
|
else
|
45
|
-
fail "
|
46
|
+
fail "Received a #{resp.code} response while trying to post. Response body: #{resp.body}"
|
46
47
|
end
|
47
48
|
end
|
48
49
|
|
@@ -88,7 +89,7 @@ module Slack
|
|
88
89
|
@config.merge!(DefaultOpts) unless @config[:webhook_url] || @config[:channel]
|
89
90
|
end
|
90
91
|
|
91
|
-
KnownConfigParams = [:webhook_url, :username, :channel, :subdomain, :token, :icon_url, :icon_emoji].freeze
|
92
|
+
KnownConfigParams = [:webhook_url, :username, :channel, :subdomain, :token, :icon_url, :icon_emoji, :proxy_host, :proxy_port].freeze
|
92
93
|
AttachmentParams = [:fallback, :title, :title_link, :author_name, :author_link, :author_icon, :image_url, :thumb_url, :text, :pretext, :color, :fields, :footer, :footer_icon, :ts, :mrkdwn_in].freeze
|
93
94
|
FieldParams = [:title, :value, :short].freeze
|
94
95
|
|
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.3.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Bragg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|