flowdock 0.2.1 → 0.2.2
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/README.md +1 -1
- data/VERSION +1 -1
- data/flowdock.gemspec +3 -3
- data/lib/flowdock.rb +8 -1
- data/lib/flowdock/capistrano.rb +11 -6
- data/spec/flowdock_spec.rb +14 -2
- metadata +60 -20
data/README.md
CHANGED
@@ -66,7 +66,7 @@ The Flowdock API Ruby Gem includes a ready task for sending deployment notificat
|
|
66
66
|
# for Flowdock Gem notifications
|
67
67
|
set :flowdock_project_name, "My project"
|
68
68
|
set :flowdock_deploy_tags, ["frontend"]
|
69
|
-
set :flowdock_api_token, "_YOUR_API_TOKEN_HERE_"
|
69
|
+
set :flowdock_api_token, ["_YOUR_API_TOKEN_HERE_"]
|
70
70
|
```
|
71
71
|
|
72
72
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/flowdock.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "flowdock"
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Antti Pitk\u{e4}nen"]
|
12
|
-
s.date = "2012-
|
12
|
+
s.date = "2012-11-19"
|
13
13
|
s.email = "team@flowdock.com"
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE",
|
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
|
|
33
33
|
s.homepage = "http://github.com/flowdock/flowdock-api"
|
34
34
|
s.licenses = ["MIT"]
|
35
35
|
s.require_paths = ["lib"]
|
36
|
-
s.rubygems_version = "1.8.
|
36
|
+
s.rubygems_version = "1.8.24"
|
37
37
|
s.summary = "Ruby Gem for using Flowdock's API"
|
38
38
|
|
39
39
|
if s.respond_to? :specification_version then
|
data/lib/flowdock.rb
CHANGED
@@ -10,7 +10,10 @@ module Flowdock
|
|
10
10
|
class InvalidParameterError < StandardError; end
|
11
11
|
class ApiError < StandardError; end
|
12
12
|
|
13
|
-
|
13
|
+
attr_reader :api_token, :source, :project, :from, :external_user_name
|
14
|
+
|
15
|
+
# Required options keys: :api_token
|
16
|
+
# Optional keys: :external_user_name, :source, :project, :from => { :name, :address }, :reply_to
|
14
17
|
def initialize(options = {})
|
15
18
|
@api_token = options[:api_token]
|
16
19
|
raise InvalidParameterError, "Flow must have :api_token attribute" if blank?(@api_token)
|
@@ -18,6 +21,7 @@ module Flowdock
|
|
18
21
|
@source = options[:source] || nil
|
19
22
|
@project = options[:project] || nil
|
20
23
|
@from = options[:from] || {}
|
24
|
+
@reply_to = options[:reply_to] || nil
|
21
25
|
@external_user_name = options[:external_user_name] || nil
|
22
26
|
end
|
23
27
|
|
@@ -33,6 +37,8 @@ module Flowdock
|
|
33
37
|
from = (params[:from].kind_of?(Hash)) ? params[:from] : @from
|
34
38
|
raise InvalidParameterError, "Message's :from attribute must have :address attribute" if blank?(from[:address])
|
35
39
|
|
40
|
+
reply_to = (!blank?(params[:reply_to])) ? params[:reply_to] : @reply_to
|
41
|
+
|
36
42
|
tags = (params[:tags].kind_of?(Array)) ? params[:tags] : []
|
37
43
|
tags.reject! { |tag| !tag.kind_of?(String) || blank?(tag) }
|
38
44
|
|
@@ -46,6 +52,7 @@ module Flowdock
|
|
46
52
|
:content => params[:content],
|
47
53
|
}
|
48
54
|
params[:from_name] = from[:name] unless blank?(from[:name])
|
55
|
+
params[:reply_to] = reply_to unless blank?(reply_to)
|
49
56
|
params[:tags] = tags.join(",") if tags.size > 0
|
50
57
|
params[:project] = @project unless blank?(@project)
|
51
58
|
params[:link] = link unless blank?(link)
|
data/lib/flowdock/capistrano.rb
CHANGED
@@ -12,7 +12,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
12
12
|
|
13
13
|
task :save_deployed_branch do
|
14
14
|
begin
|
15
|
-
run "echo '#{source.head}' > #{current_path}/BRANCH"
|
15
|
+
run "echo '#{source.head.chomp}' > #{current_path}/BRANCH"
|
16
16
|
rescue => e
|
17
17
|
puts "Flowdock: error in saving deployed branch information: #{e.to_s}"
|
18
18
|
end
|
@@ -31,9 +31,12 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
begin
|
34
|
-
|
34
|
+
flows = Array(flowdock_api_token).map do |api_token|
|
35
|
+
Flowdock::Flow.new(:api_token => api_token,
|
35
36
|
:source => "Capistrano deployment", :project => flowdock_project_name,
|
36
37
|
:from => {:name => config["user.name"], :address => config["user.email"]})
|
38
|
+
end
|
39
|
+
set :flowdock_api, flows
|
37
40
|
rescue => e
|
38
41
|
puts "Flowdock: error in configuring Flowdock API: #{e.to_s}"
|
39
42
|
end
|
@@ -42,10 +45,12 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
42
45
|
task :notify_deploy_finished do
|
43
46
|
# send message to the flow
|
44
47
|
begin
|
45
|
-
flowdock_api.
|
46
|
-
:
|
47
|
-
|
48
|
-
|
48
|
+
flowdock_api.each do |flow|
|
49
|
+
flow.push_to_team_inbox(:format => "html",
|
50
|
+
:subject => "#{flowdock_project_name} deployed with branch #{branch} on ##{rails_env}",
|
51
|
+
:content => notification_message,
|
52
|
+
:tags => ["deploy", "#{rails_env}"] | flowdock_deploy_tags)
|
53
|
+
end
|
49
54
|
rescue => e
|
50
55
|
puts "Flowdock: error in sending notification to your flow: #{e.to_s}"
|
51
56
|
end
|
data/spec/flowdock_spec.rb
CHANGED
@@ -19,7 +19,7 @@ describe Flowdock do
|
|
19
19
|
before(:each) do
|
20
20
|
@token = "test"
|
21
21
|
@flow_attributes = {:api_token => @token, :source => "myapp", :project => "myproject",
|
22
|
-
:from => {:name => "Eric Example", :address => "eric@example.com"}}
|
22
|
+
:from => {:name => "Eric Example", :address => "eric@example.com"}, :reply_to => "john@example.com" }
|
23
23
|
@flow = Flowdock::Flow.new(@flow_attributes)
|
24
24
|
@example_content = "<h1>Hello</h1>\n<p>Let's rock and roll!</p>"
|
25
25
|
@valid_attributes = {:subject => "Hello World", :content => @example_content,
|
@@ -66,6 +66,12 @@ describe Flowdock do
|
|
66
66
|
}.should raise_error(Flowdock::Flow::InvalidParameterError)
|
67
67
|
end
|
68
68
|
|
69
|
+
it "should send without reply_to address" do
|
70
|
+
lambda {
|
71
|
+
@flow.push_to_team_inbox(@valid_attributes.merge(:reply_to => ""))
|
72
|
+
}.should_not raise_error(Flowdock::Flow::InvalidParameterError)
|
73
|
+
end
|
74
|
+
|
69
75
|
it "should succeed with correct token, source and sender information" do
|
70
76
|
lambda {
|
71
77
|
stub_request(:post, push_to_team_inbox_url(@token)).
|
@@ -74,6 +80,7 @@ describe Flowdock do
|
|
74
80
|
:format => "html",
|
75
81
|
:from_name => "Eric Example",
|
76
82
|
:from_address => "eric@example.com",
|
83
|
+
:reply_to => "john@example.com",
|
77
84
|
:subject => "Hello World",
|
78
85
|
:content => @example_content,
|
79
86
|
:tags => "cool,stuff",
|
@@ -94,6 +101,7 @@ describe Flowdock do
|
|
94
101
|
:project => "myproject",
|
95
102
|
:format => "html",
|
96
103
|
:from_address => "eric@example.com",
|
104
|
+
:reply_to => "john@example.com",
|
97
105
|
:subject => "Hello World",
|
98
106
|
:content => @example_content,
|
99
107
|
:tags => "cool,stuff",
|
@@ -114,6 +122,7 @@ describe Flowdock do
|
|
114
122
|
:format => "html",
|
115
123
|
:from_name => "Eric Example",
|
116
124
|
:from_address => "eric@example.com",
|
125
|
+
:reply_to => "john@example.com",
|
117
126
|
:subject => "Hello World",
|
118
127
|
:content => @example_content,
|
119
128
|
:tags => "cool,stuff",
|
@@ -134,6 +143,7 @@ describe Flowdock do
|
|
134
143
|
:format => "html",
|
135
144
|
:from_name => "Eric Example",
|
136
145
|
:from_address => "eric@example.com",
|
146
|
+
:reply_to => "john@example.com",
|
137
147
|
:subject => "Hello World",
|
138
148
|
:content => @example_content,
|
139
149
|
:tags => "cool,stuff",
|
@@ -155,6 +165,7 @@ describe Flowdock do
|
|
155
165
|
:format => "html",
|
156
166
|
:from_name => "Test",
|
157
167
|
:from_address => "invalid@nodeta.fi",
|
168
|
+
:reply_to => "foobar@example.com",
|
158
169
|
:subject => "Hello World",
|
159
170
|
:content => @example_content,
|
160
171
|
:tags => "cool,stuff",
|
@@ -162,7 +173,7 @@ describe Flowdock do
|
|
162
173
|
to_return(:body => "", :status => 200)
|
163
174
|
|
164
175
|
@flow.push_to_team_inbox(:subject => "Hello World", :content => @example_content, :tags => ["cool", "stuff"],
|
165
|
-
:from => {:name => "Test", :address => "invalid@nodeta.fi"}).should be_true
|
176
|
+
:from => {:name => "Test", :address => "invalid@nodeta.fi"}, :reply_to => "foobar@example.com").should be_true
|
166
177
|
}.should_not raise_error
|
167
178
|
end
|
168
179
|
|
@@ -175,6 +186,7 @@ describe Flowdock do
|
|
175
186
|
:format => "html",
|
176
187
|
:from_name => "Eric Example",
|
177
188
|
:from_address => "eric@example.com",
|
189
|
+
:reply_to => "john@example.com",
|
178
190
|
:subject => "Hello World",
|
179
191
|
:content => @example_content
|
180
192
|
}).
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flowdock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0.7'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0.7'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: multi_json
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: rdoc
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: 2.4.2
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.4.2
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: rspec
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ~>
|
@@ -54,10 +69,15 @@ dependencies:
|
|
54
69
|
version: '2.6'
|
55
70
|
type: :development
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '2.6'
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: webmock
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ! '>='
|
@@ -65,10 +85,15 @@ dependencies:
|
|
65
85
|
version: '0'
|
66
86
|
type: :development
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
69
94
|
- !ruby/object:Gem::Dependency
|
70
95
|
name: bundler
|
71
|
-
requirement:
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
72
97
|
none: false
|
73
98
|
requirements:
|
74
99
|
- - ~>
|
@@ -76,10 +101,15 @@ dependencies:
|
|
76
101
|
version: '1.0'
|
77
102
|
type: :development
|
78
103
|
prerelease: false
|
79
|
-
version_requirements:
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '1.0'
|
80
110
|
- !ruby/object:Gem::Dependency
|
81
111
|
name: jeweler
|
82
|
-
requirement:
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
83
113
|
none: false
|
84
114
|
requirements:
|
85
115
|
- - ~>
|
@@ -87,10 +117,15 @@ dependencies:
|
|
87
117
|
version: 1.6.4
|
88
118
|
type: :development
|
89
119
|
prerelease: false
|
90
|
-
version_requirements:
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 1.6.4
|
91
126
|
- !ruby/object:Gem::Dependency
|
92
127
|
name: jruby-openssl
|
93
|
-
requirement:
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
94
129
|
none: false
|
95
130
|
requirements:
|
96
131
|
- - ! '>='
|
@@ -98,7 +133,12 @@ dependencies:
|
|
98
133
|
version: '0'
|
99
134
|
type: :development
|
100
135
|
prerelease: false
|
101
|
-
version_requirements:
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
102
142
|
description:
|
103
143
|
email: team@flowdock.com
|
104
144
|
executables: []
|
@@ -135,7 +175,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
135
175
|
version: '0'
|
136
176
|
segments:
|
137
177
|
- 0
|
138
|
-
hash:
|
178
|
+
hash: 619247941054202715
|
139
179
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
180
|
none: false
|
141
181
|
requirements:
|
@@ -144,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
184
|
version: '0'
|
145
185
|
requirements: []
|
146
186
|
rubyforge_project:
|
147
|
-
rubygems_version: 1.8.
|
187
|
+
rubygems_version: 1.8.24
|
148
188
|
signing_key:
|
149
189
|
specification_version: 3
|
150
190
|
summary: Ruby Gem for using Flowdock's API
|