slack-post 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ab552e2414f277c9a6d9c6b03db773f765703fb5
4
- data.tar.gz: 569aa26567a266c473681c65ff43d9d695b47836
3
+ metadata.gz: bbcc725463980506c2af9898e9d37f0b92163350
4
+ data.tar.gz: fb11f3587bc82ca8ed87f1505a323ad67b7292ae
5
5
  SHA512:
6
- metadata.gz: 76c6899182ed78424758deb4c57f017e0dd526c5456f5b39e75b03fcaf3df7cf0e14fb0082c86399441febb8f7901ff8fd101a77b806a3f4a0fbac17189d7e3c
7
- data.tar.gz: d572a25ac41807c9364e646ce7d5a5ec08ba9287ec7ddf87ef548fc2acc50707e944954343319f02d9c4777be554f043831835f3fb598a0b2e8790e7452ffd2e
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'
@@ -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
- NecessaryConfigParams = [:subdomain,:token].freeze
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
- NecessaryConfigParams.all? do |parm|
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
 
@@ -1,5 +1,5 @@
1
1
  module Slack
2
2
  module Post
3
- VERSION = "0.2.1"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
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.2.1
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-02-09 00:00:00.000000000 Z
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.0.14
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.