flowdock-rails 0.0.3 → 0.0.4
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.
- data/lib/flowdock/rails.rb +15 -3
- data/lib/flowdock/rails/version.rb +1 -1
- metadata +13 -13
data/lib/flowdock/rails.rb
CHANGED
@@ -9,7 +9,6 @@ module Flowdock
|
|
9
9
|
module ClassMethods
|
10
10
|
def flow
|
11
11
|
api_token = (ENV["FLOWDOCK_RAILS_API_TOKEN"].try(:split, ",") || []).map(&:strip)
|
12
|
-
|
13
12
|
@flow ||= Flowdock::Flow.new(
|
14
13
|
flowdock_rails_options.reverse_merge(
|
15
14
|
api_token: api_token,
|
@@ -23,6 +22,15 @@ module Flowdock
|
|
23
22
|
)
|
24
23
|
end
|
25
24
|
|
25
|
+
def push_to_flow(options = {})
|
26
|
+
begin
|
27
|
+
flow.push_to_team_inbox(options)
|
28
|
+
rescue Exception => e
|
29
|
+
logger.fatal "[Flowdock::Rails] Something went wrong with pushing to the flow:"
|
30
|
+
logger.fatal "[Flowdock::Rails] #{e}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
26
34
|
def notify_flow(options = {})
|
27
35
|
cattr_accessor :flowdock_rails_options
|
28
36
|
self.flowdock_rails_options = options
|
@@ -35,10 +43,11 @@ module Flowdock
|
|
35
43
|
private
|
36
44
|
|
37
45
|
def push_create_notification_to_flow
|
38
|
-
self.class.
|
46
|
+
self.class.push_to_flow(
|
39
47
|
subject: "#{self.class.model_name.human} created",
|
40
48
|
content: %Q{
|
41
49
|
<h2>#{self.class.model_name.human} created</h2>
|
50
|
+
<h3>Attributes</h3>
|
42
51
|
<pre>#{JSON.pretty_generate(self.attributes)}</pre>
|
43
52
|
},
|
44
53
|
tags: [self.class.model_name.param_key, "resource", "created"]
|
@@ -46,11 +55,14 @@ module Flowdock
|
|
46
55
|
end
|
47
56
|
|
48
57
|
def push_update_notification_to_flow
|
49
|
-
self.class.
|
58
|
+
self.class.push_to_flow(
|
50
59
|
subject: "#{self.class.model_name.human} updated",
|
51
60
|
content: %Q{
|
52
61
|
<h2>#{self.class.model_name.human} updated</h2>
|
62
|
+
<h3>Changes</h3>
|
53
63
|
<pre>#{JSON.pretty_generate(self.changes)}</pre>
|
64
|
+
<h3>Attributes</h3>
|
65
|
+
<pre>#{JSON.pretty_generate(self.attributes)}</pre>
|
54
66
|
},
|
55
67
|
tags: [self.class.model_name.param_key, "resource", "updated"]
|
56
68
|
)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flowdock-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2014-12-04 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
|
-
requirement: &
|
16
|
+
requirement: &70351460266940 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '1.3'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70351460266940
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70351460266500 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70351460266500
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: flowdock
|
38
|
-
requirement: &
|
38
|
+
requirement: &70351460265960 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0.5'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70351460265960
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: activerecord
|
49
|
-
requirement: &
|
49
|
+
requirement: &70351460265300 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>'
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '3.0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70351460265300
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: activesupport
|
60
|
-
requirement: &
|
60
|
+
requirement: &70351460264840 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>'
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '3.0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70351460264840
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: json
|
71
|
-
requirement: &
|
71
|
+
requirement: &70351460264400 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70351460264400
|
80
80
|
description: Gem for notifying flows about the creation and updating of ActiveRecord
|
81
81
|
models.
|
82
82
|
email:
|