flowdock 0.5.0 → 0.6.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: f1b21f2284092dd5c694e22637cd1f00bb85df48
4
- data.tar.gz: ef80fc3c8718925b0efdcb7e2dadb6a6da8ffc85
3
+ metadata.gz: add821dc4a38cf06e2c3f714696a492b4d33c662
4
+ data.tar.gz: f7e1b06102bacda9ce5ae06d07e89780fca71091
5
5
  SHA512:
6
- metadata.gz: 38b75fa2a1bbeb1e912507c5672dec632601a8790e354029c00978b7e1564c678fb991b117cfcd62e3aa1d3ddec37c1f93f5101d8ae6abe302eaee1b4bf4cf23
7
- data.tar.gz: a3f11ccf01ea48600d1208dbef5709ebc68fe8e3d36844d300f0f0e9adc7d984dc43da0d6686d2f826d3c260d2c2cc8062d7705b42bec0a4316d924ef06d0fb8
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.5.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)
@@ -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.5.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: 2014-09-23 00:00:00.000000000 Z
11
+ date: 2015-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty