slacked 0.8.0 → 0.9.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: 027523f726fd684d6909a412d61902470dbb92d7
4
- data.tar.gz: 4a232e9ac8a3309edbd697df6c3eac4cfa71db7b
3
+ metadata.gz: 7a1a1d2a0342dcc169bf1ea68a8a93e93a7e1466
4
+ data.tar.gz: 462e6bde658b0f7ac277c5895a36620f5d20050e
5
5
  SHA512:
6
- metadata.gz: d589ec0319595fa27d317422f7e55da02635cc22d0a28ce8d5b72348cc08b573f8a478b5740e242c8a13b801662c3a487b5bc9a2c90237609e460d2a2a2fa490
7
- data.tar.gz: b99fdac4d6fe27a5f5e3dc8250f2a8cc768ad86f7fb1444b324c07d0fe579b10dbeec79b2c28c7cdb970d3ee6b729259d5e35f097f2b83f9489c31ffa37cfb1b
6
+ metadata.gz: a6a590fd1678e841b587a61ff394fb273864a4a481482494d157278aa92b89aa940c0f69d0fe928265ebaff7280008d9aa2276172bb1fd05afd88027ca0d2538
7
+ data.tar.gz: 5bea4f9d061cf488066fb590860e9aa3c61eca9fd62c32a22451d3452429c5210acd8015d31c649310205d9fe60df83d88dfd37460ede31fcee49cc12e041a97
data/README.md CHANGED
@@ -1,9 +1,13 @@
1
+ [![Gem Version](https://badge.fury.io/rb/slacked.svg)](https://badge.fury.io/rb/slacked) [![Circle CI](https://circleci.com/gh/codelittinc/slacked.svg?style=svg)](https://circleci.com/gh/codelittinc/slacked)
2
+
1
3
  # Slacked
2
4
 
3
5
  This is a super simple Slack integration for Rails. A use case for this would be to post a notification in Slack when a new User is created or a certain action has been taken in your application.
4
6
 
5
7
  Are there other gems that provide similar functionality? Yes. Do some of them provide more flexibility? Yes. The point of this was to make installing and integrating a 30 second process.
6
8
 
9
+ This gem can be used with a rails application and enabled/disabled based on the environment config as you may see below
10
+
7
11
  ## Getting Started
8
12
 
9
13
  Add this line to your application's Gemfile:
@@ -73,6 +77,15 @@ class Post < ActiveRecord::Base
73
77
  end
74
78
  ```
75
79
 
80
+ ## Using with rails
81
+ If you are using this gem inside a rails application you can enable or disable it based on your environment, to do it you only need to add the code below in your config file.
82
+
83
+ ```ruby
84
+ config.slacked_disabled = true
85
+ ```
86
+
87
+ The default value is false
88
+
76
89
  ## Contributors
77
90
 
78
91
  - [Sean H.](https://github.com/seathony)
@@ -8,7 +8,7 @@ module Slacked
8
8
 
9
9
  class << self
10
10
  def post message = ENV[SLACK_DEFAULT_MESSAGE_KEY]
11
- return false if message.nil? || message.empty?
11
+ return false if message.nil? || message.empty? || disabled?
12
12
  notifier = slack_notifier
13
13
  notifier.ping message, SLACK_CONFIG
14
14
  end
@@ -21,9 +21,19 @@ module Slacked
21
21
  end
22
22
  end
23
23
 
24
+ def disabled?
25
+ return false unless rails?
26
+ rails_config = Rails.application.config
27
+ rails_config.respond_to?(:slacked_disabled) && rails_config.slacked_disabled
28
+ end
29
+
24
30
  private
25
31
  def slack_notifier webhook_url = ENV[SLACK_WEBHOOK_URL_KEY]
26
32
  Slack::Notifier.new webhook_url
27
33
  end
34
+
35
+ def rails?
36
+ defined?(Rails)
37
+ end
28
38
  end
29
39
  end
@@ -1,3 +1,3 @@
1
1
  module Slacked
2
- VERSION = "0.8.0"
2
+ VERSION = "0.9.0"
3
3
  end
@@ -6,7 +6,7 @@ require 'slacked/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "slacked"
8
8
  spec.version = Slacked::VERSION
9
- spec.authors = ["sean"]
9
+ spec.authors = ["Sean", "Kaio Magalhães", "Locky"]
10
10
  spec.email = ["seathony@gmail.com"]
11
11
 
12
12
  spec.summary = %q{A super simple and easy way to send notifications to Slack from your Rails application.}
metadata CHANGED
@@ -1,14 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slacked
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
- - sean
7
+ - Sean
8
+ - Kaio Magalhães
9
+ - Locky
8
10
  autorequire:
9
11
  bindir: exe
10
12
  cert_chain: []
11
- date: 2015-12-07 00:00:00.000000000 Z
13
+ date: 2015-12-08 00:00:00.000000000 Z
12
14
  dependencies:
13
15
  - !ruby/object:Gem::Dependency
14
16
  name: bundler