flowdock 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/VERSION +1 -1
- data/lib/flowdock.rb +12 -0
- data/spec/flowdock_spec.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: add821dc4a38cf06e2c3f714696a492b4d33c662
|
4
|
+
data.tar.gz: f7e1b06102bacda9ce5ae06d07e89780fca71091
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c297de7187f02165ae0f3293b749b71e3950c4c3c7f51c0826c1508e864962e9fc46e368590f83d277c73ec8cef886bf0116b423474949a7369fad8ebffabf77
|
7
|
+
data.tar.gz: fa3bf91e94f7ae7f8367f18c9dee67e966e27d95548ed9670f51126ff2b13b6af299899b031154f8bb56b7808c688e9749ece4402436311222bbdde4487c3bb1
|
data/README.md
CHANGED
@@ -140,6 +140,10 @@ There are separate gems for deployment notifications:
|
|
140
140
|
* [capistrano-flowdock](https://github.com/flowdock/capistrano-flowdock)
|
141
141
|
* [mina-flowdock](https://github.com/elskwid/mina-flowdock)
|
142
142
|
|
143
|
+
## Changelog
|
144
|
+
|
145
|
+
* 0.5.0 - Added `Flowdock::Client` that authenticates using user credentials and can be used to interact with the api. Better threads support for both `Flow` and `Client` so that comments can be made.
|
146
|
+
|
143
147
|
## Copyright
|
144
148
|
|
145
149
|
Copyright (c) 2012 Flowdock Ltd. See LICENSE for further details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.0
|
data/lib/flowdock.rb
CHANGED
@@ -146,6 +146,18 @@ module Flowdock
|
|
146
146
|
post(event + 's', params.merge(tags: tags, event: event))
|
147
147
|
end
|
148
148
|
|
149
|
+
def private_message(params)
|
150
|
+
raise InvalidParameterError, "Message must have :content" if blank?(params[:content])
|
151
|
+
raise InvalidParameterError, "Message must have :user_id" if blank?(params[:user_id])
|
152
|
+
|
153
|
+
user_id = params.delete(:user_id)
|
154
|
+
|
155
|
+
params = params.clone
|
156
|
+
event = "message"
|
157
|
+
|
158
|
+
post("private/#{user_id}/messages", params.merge(event: event))
|
159
|
+
end
|
160
|
+
|
149
161
|
def post(path, data = {})
|
150
162
|
resp = self.class.post(api_url(path), :body => MultiJson.dump(data), :basic_auth => {:username => @api_token, :password => ''}, :headers => headers)
|
151
163
|
handle_response(resp)
|
data/spec/flowdock_spec.rb
CHANGED
@@ -375,6 +375,16 @@ describe Flowdock::Client do
|
|
375
375
|
expect(res).to eq({"id" => 1234})
|
376
376
|
}.not_to raise_error
|
377
377
|
end
|
378
|
+
it 'posts to /private/:user_id/messages' do
|
379
|
+
expect {
|
380
|
+
stub_request(:post, "https://#{token}:@api.flowdock.com/v1/private/12345/messages").
|
381
|
+
with(:body => MultiJson.dump(content: "foobar", event: "message"), :headers => {"Accept" => "application/json", "Content-Type" => "application/json"}).
|
382
|
+
to_return(:status => 201, :body => '{"id":1234}', :headers => {"Content-Type" => "application/json"})
|
383
|
+
res = client.private_message(user_id: "12345", content: 'foobar')
|
384
|
+
expect(res).to eq({"id" => 1234})
|
385
|
+
}.not_to raise_error
|
386
|
+
end
|
387
|
+
|
378
388
|
it 'raises without flow' do
|
379
389
|
expect {
|
380
390
|
client.chat_message(content: 'foobar')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flowdock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Antti Pitkänen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|