flowdock 0.7.0 → 0.7.1
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 +4 -4
- data/README.md +1 -1
- data/VERSION +1 -1
- data/flowdock.gemspec +4 -4
- data/lib/flowdock.rb +9 -1
- data/spec/flowdock_spec.rb +38 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13576628fd2b05aaa9ece16cd6944c8d9b02224a
|
4
|
+
data.tar.gz: 4ca310fb95bf29d2c9342387623e62813a5609c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10b82d9fdabb95fa80af828f6593bde4d143813aed8646724db51ae8614d00512348c36f7bef486f6173a7a6101a203539cd584b32b29651b87b1537b596e89b
|
7
|
+
data.tar.gz: f58a5de79dbb5de06e4ab85eb28b83987634a675b903bcc3631297add7b263e87b20c78fa46fc1efe45621d75e27f434907ffff380cedb41442b29489428ad9e
|
data/README.md
CHANGED
@@ -176,7 +176,7 @@ There are separate gems for deployment notifications:
|
|
176
176
|
* [mina-flowdock](https://github.com/elskwid/mina-flowdock)
|
177
177
|
|
178
178
|
## Changelog
|
179
|
-
|
179
|
+
* 0.7.0 - Added `post_to_thread`
|
180
180
|
* 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.
|
181
181
|
|
182
182
|
## Copyright
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.1
|
data/flowdock.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: flowdock 0.7.
|
5
|
+
# stub: flowdock 0.7.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "flowdock"
|
9
|
-
s.version = "0.7.
|
9
|
+
s.version = "0.7.1"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Antti Pitk\u{e4}nen"]
|
14
|
-
s.date = "2015-
|
14
|
+
s.date = "2015-11-17"
|
15
15
|
s.email = "team@flowdock.com"
|
16
16
|
s.extra_rdoc_files = [
|
17
17
|
"LICENSE",
|
@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
|
|
34
34
|
]
|
35
35
|
s.homepage = "http://github.com/flowdock/flowdock-api"
|
36
36
|
s.licenses = ["MIT"]
|
37
|
-
s.rubygems_version = "2.4.
|
37
|
+
s.rubygems_version = "2.4.8"
|
38
38
|
s.summary = "Ruby Gem for using Flowdock's API"
|
39
39
|
|
40
40
|
if s.respond_to? :specification_version then
|
data/lib/flowdock.rb
CHANGED
@@ -6,6 +6,7 @@ module Flowdock
|
|
6
6
|
FLOWDOCK_API_URL = "https://api.flowdock.com/v1"
|
7
7
|
|
8
8
|
class InvalidParameterError < StandardError; end
|
9
|
+
class NotFoundError < StandardError; end
|
9
10
|
class ApiError < StandardError; end
|
10
11
|
|
11
12
|
module Helpers
|
@@ -14,7 +15,14 @@ module Flowdock
|
|
14
15
|
end
|
15
16
|
|
16
17
|
def handle_response(resp)
|
17
|
-
|
18
|
+
body = (resp.body.nil? || resp.body.strip.empty?) ? '{}' : resp.body
|
19
|
+
|
20
|
+
json = MultiJson.decode(body)
|
21
|
+
|
22
|
+
if resp.code == 404
|
23
|
+
raise NotFoundError, "Flowdock API returned error:\nStatus: #{resp.code}\n Message: #{json["message"]}"
|
24
|
+
end
|
25
|
+
|
18
26
|
unless resp.code >= 200 && resp.code < 300
|
19
27
|
errors = json["errors"].map {|k,v| "#{k}: #{v.join(',')}"}.join("\n") unless json["errors"].nil?
|
20
28
|
raise ApiError, "Flowdock API returned error:\nStatus: #{resp.code}\n Message: #{json["message"]}\n Errors:\n#{errors}"
|
data/spec/flowdock_spec.rb
CHANGED
@@ -21,6 +21,25 @@ describe Flowdock do
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
describe "handle_response" do
|
25
|
+
it "parses a response body that contains an empty string" do
|
26
|
+
class TestResponse
|
27
|
+
attr_reader :body, :code
|
28
|
+
|
29
|
+
def initialize
|
30
|
+
@body = ""
|
31
|
+
@code = 200
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class TestHelper
|
36
|
+
include Flowdock::Helpers
|
37
|
+
end
|
38
|
+
|
39
|
+
expect(TestHelper.new.handle_response(TestResponse.new)).to eq({})
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
24
43
|
describe "with sending Team Inbox messages" do
|
25
44
|
before(:each) do
|
26
45
|
@token = "test"
|
@@ -224,6 +243,25 @@ describe Flowdock do
|
|
224
243
|
@flow.push_to_team_inbox(:subject => "Hello World", :content => @example_content).should be_false
|
225
244
|
}.should raise_error(Flowdock::ApiError)
|
226
245
|
end
|
246
|
+
|
247
|
+
it "should raise error if backend returns 404 NotFound" do
|
248
|
+
lambda {
|
249
|
+
stub_request(:post, push_to_team_inbox_url(@token)).
|
250
|
+
with(:body => {
|
251
|
+
:source => "myapp",
|
252
|
+
:project => "myproject",
|
253
|
+
:format => "html",
|
254
|
+
:from_name => "Eric Example",
|
255
|
+
:from_address => "eric@example.com",
|
256
|
+
:reply_to => "john@example.com",
|
257
|
+
:subject => "Hello World",
|
258
|
+
:content => @example_content
|
259
|
+
}).
|
260
|
+
to_return(:body => "{}", :status => 404)
|
261
|
+
|
262
|
+
@flow.push_to_team_inbox(:subject => "Hello World", :content => @example_content).should be_false
|
263
|
+
}.should raise_error(Flowdock::NotFoundError)
|
264
|
+
end
|
227
265
|
end
|
228
266
|
|
229
267
|
describe "with sending Chat messages" do
|
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.7.
|
4
|
+
version: 0.7.1
|
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: 2015-
|
11
|
+
date: 2015-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -163,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
163
|
version: '0'
|
164
164
|
requirements: []
|
165
165
|
rubyforge_project:
|
166
|
-
rubygems_version: 2.4.
|
166
|
+
rubygems_version: 2.4.8
|
167
167
|
signing_key:
|
168
168
|
specification_version: 4
|
169
169
|
summary: Ruby Gem for using Flowdock's API
|