streamsend 1.0.0.rc2 → 1.0.0.rc3

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZWU3MmE4MDU0OGZiMTE3NjUzMWNmZDU0NDI1YzA5NjlmOGJlNjFjYQ==
4
+ MTMxZWI1MzljMWM0OTY4N2ZhYmMwMjE3NjU2M2FjM2VhNzk1NmExMg==
5
5
  data.tar.gz: !binary |-
6
- NTE5MTQ4OTNmOGUwNzVlN2RhOGY1MWZmNzVmYjM0NDNhZTczOTg5ZA==
6
+ NmI1ODY0YmE3MmZjNzhhMTIyMWVmZjE5ZTFiYTE0MWI0ZGZiYTY0Zg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTFiODlkNDVkN2RkZjhjZjJjYjk5MzY1ZTQ1ZWQzZTg4MzQzODdlYWMxNmM2
10
- NDBlZDY3OTljZTkzOTI3OGRkM2I4ZWMxYzAyMWE1ZGI5YzAxMjZmM2M0MjBh
11
- OTc3ZjkyMGRhMTA4ZjA1ZDI5YThjOGRkYjY1YTA2ZDZjMjVmMmQ=
9
+ NzJiZWJkMTUzYTg1MTcxODc2NzE2YjViZDE4N2UzNzFjM2FjNDgwYWFhZTIx
10
+ NTU0YWQyZjM2MWM1ZDQ5YTgyZWI1NWNiZTc3ZjBkMmFlMTgzYWE5MTljMWRm
11
+ ZmJjZjk4MWZiZjA3MmNiY2UxMjQ4M2YxNTY3ODZjODFmMzM3ZmQ=
12
12
  data.tar.gz: !binary |-
13
- ZTVmMGZiOTMwYjM5NDU2MWFjYzU1ODFhNmQ1OThmN2M1ZmQ2NDIxYTAyMzgx
14
- ZmQ5YjhjYzFmZmJjY2MyZmFmYjM3MmI3NjhhMGMyYjFhZjQzMjk3MjVkMTQ5
15
- NTc4MTUwZmU3MmQ0YTUxOTdhYzNjMThiMzNkNTBiOTljM2IwMzE=
13
+ OTIzZmE5ZjEwMTJkOGNjY2U1NGE0ZjBlM2QyMjFmNjZiY2MxMzc4YzNhMDI0
14
+ YTVjZDMzMDY3NzI4ZGE4MDUxZmJlOTc4ZWM0Y2Y5ZjRmN2FmZGVlNWZjODNh
15
+ YTg2N2VkM2QzOTJhMDg5MjEyNTA1YmM5ZjIxYmY5ZGIxZTIxYWI=
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- streamsend (1.0.0.rc1)
4
+ streamsend (1.0.0.rc3)
5
5
  activesupport (~> 3.2)
6
6
  builder
7
7
  httmultiparty
@@ -11,7 +11,12 @@ module StreamSend
11
11
  when 401
12
12
  raise StreamSend::Api::UnauthorizedException
13
13
  when 422
14
- raise StreamSend::Api::SemanticException.new(response["errors"]["error"])
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 UnexpectedResponse < ApiException
26
+ class UnauthorizedException < ApiException
27
27
  end
28
28
 
29
- class UnauthorizedException < ApiException
29
+ class UnexpectedResponse < ApiException
30
30
  end
31
31
  end
32
32
  end
@@ -1,3 +1,3 @@
1
1
  module StreamSend
2
- VERSION = "1.0.0.rc2"
2
+ VERSION = "1.0.0.rc3"
3
3
  end
@@ -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).to_not be nil
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.rc2
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-15 00:00:00.000000000 Z
11
+ date: 2013-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httmultiparty