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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad6a9a6fa3e7712ab8f8a1b0711dc6b63934e0d8
4
- data.tar.gz: 4b150f642a4e95554291d3133efa14eeb9670004
3
+ metadata.gz: 6dcd9c6029e35b1040592aaf06719e1d8081485a
4
+ data.tar.gz: d51c211e8de0b212011e800da48ae186f277dc86
5
5
  SHA512:
6
- metadata.gz: d7ef190f00ef9ed12f013d765e3873f71130024379d3b58ac79190be3359aa686c1c344d0fda6862137087b420da5c0c235a021888f4942b09757f15ee38c032
7
- data.tar.gz: 6b21f1cdebfde51c130abbba94ebd048b7b38fed9003edaf4bbb92e3afc06621614ee1d993bddabbf7b89c7a169192a805b54868b51ef47f4b51ab63acedbcdc
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.
@@ -1,5 +1,5 @@
1
1
  module Slack
2
2
  module Post
3
- VERSION = "0.3.6"
3
+ VERSION = "0.3.7"
4
4
  end
5
5
  end
data/lib/slack/post.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "slack/post/version"
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
- http = Net::HTTP.new(uri.host, uri.port)
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 "Recieved a #{resp.code} response while trying to post. Response body: #{resp.body}"
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.6
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-06-12 00:00:00.000000000 Z
11
+ date: 2017-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler