streamsend 1.0.0.rc2 → 1.0.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Gemfile.lock +1 -1
- data/lib/streamsend/api/base/create.rb +6 -1
- data/lib/streamsend/api/exception.rb +3 -3
- data/lib/streamsend/version.rb +1 -1
- data/spec/lib/streamsend/api/integration/upload_spec.rb +1 -1
- data/spec/lib/streamsend/api/unit/base/create_spec.rb +27 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTMxZWI1MzljMWM0OTY4N2ZhYmMwMjE3NjU2M2FjM2VhNzk1NmExMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NmI1ODY0YmE3MmZjNzhhMTIyMWVmZjE5ZTFiYTE0MWI0ZGZiYTY0Zg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzJiZWJkMTUzYTg1MTcxODc2NzE2YjViZDE4N2UzNzFjM2FjNDgwYWFhZTIx
|
10
|
+
NTU0YWQyZjM2MWM1ZDQ5YTgyZWI1NWNiZTc3ZjBkMmFlMTgzYWE5MTljMWRm
|
11
|
+
ZmJjZjk4MWZiZjA3MmNiY2UxMjQ4M2YxNTY3ODZjODFmMzM3ZmQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTIzZmE5ZjEwMTJkOGNjY2U1NGE0ZjBlM2QyMjFmNjZiY2MxMzc4YzNhMDI0
|
14
|
+
YTVjZDMzMDY3NzI4ZGE4MDUxZmJlOTc4ZWM0Y2Y5ZjRmN2FmZGVlNWZjODNh
|
15
|
+
YTg2N2VkM2QzOTJhMDg5MjEyNTA1YmM5ZjIxYmY5ZGIxZTIxYWI=
|
data/Gemfile.lock
CHANGED
@@ -11,7 +11,12 @@ module StreamSend
|
|
11
11
|
when 401
|
12
12
|
raise StreamSend::Api::UnauthorizedException
|
13
13
|
when 422
|
14
|
-
|
14
|
+
if response.content_type == "application/xml"
|
15
|
+
message = response["errors"]
|
16
|
+
else
|
17
|
+
message = "Unprocessable Entity"
|
18
|
+
end
|
19
|
+
raise StreamSend::Api::SemanticException.new(message)
|
15
20
|
else
|
16
21
|
raise StreamSend::Api::Exception.new("Could not create the #{namespace}. (#{response.code})")
|
17
22
|
end
|
@@ -19,14 +19,14 @@ module StreamSend
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def to_s
|
22
|
-
"#{self.class.name}: #{errors.join(',')}"
|
22
|
+
"#{self.class.name}: #{errors.join(', ')}"
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
class
|
26
|
+
class UnauthorizedException < ApiException
|
27
27
|
end
|
28
28
|
|
29
|
-
class
|
29
|
+
class UnexpectedResponse < ApiException
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
data/lib/streamsend/version.rb
CHANGED
@@ -21,7 +21,7 @@ module StreamSend
|
|
21
21
|
creator = Create.new(session)
|
22
22
|
StreamSend::Api::Integration::Helpers.create_upload_file(file_path)
|
23
23
|
upload_id = creator.execute(file_path)
|
24
|
-
expect(upload_id).
|
24
|
+
expect(upload_id).to be_an_instance_of Fixnum
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -28,6 +28,33 @@ module StreamSend
|
|
28
28
|
creator.execute(obj_hash)
|
29
29
|
end.to raise_error(StreamSend::Api::Exception, "Could not create the calls. (404)")
|
30
30
|
end
|
31
|
+
|
32
|
+
it "raises a SemanticException when encountering 422 with a singular error message" do
|
33
|
+
response_xml = <<-XML
|
34
|
+
<errors type='array'>
|
35
|
+
<error>Error B</error>
|
36
|
+
</errors>
|
37
|
+
XML
|
38
|
+
stub_request(:post, "http://test:password@default.base/calls.xml").
|
39
|
+
to_return(:status => 422, :body => response_xml, :headers => { :content_type => "application/xml" })
|
40
|
+
expect do
|
41
|
+
creator.execute(obj_hash)
|
42
|
+
end.to raise_error(StreamSend::Api::SemanticException, /Error B/)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "raises a SemanticException when encountering 422 with multiple errors" do
|
46
|
+
response_xml = <<-XML
|
47
|
+
<errors type='array'>
|
48
|
+
<error>Error A</error>
|
49
|
+
<error>Error B</error>
|
50
|
+
</errors>
|
51
|
+
XML
|
52
|
+
stub_request(:post, "http://test:password@default.base/calls.xml").
|
53
|
+
to_return(:status => 422, :body => response_xml, :headers => { :content_type => "application/xml" })
|
54
|
+
expect do
|
55
|
+
creator.execute(obj_hash)
|
56
|
+
end.to raise_error(StreamSend::Api::SemanticException, /Error A, Error B/)
|
57
|
+
end
|
31
58
|
end
|
32
59
|
|
33
60
|
describe AudienceCreate do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: streamsend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.rc3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Yeo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httmultiparty
|