streamsend 1.0.0.rc5 → 1.0.0.rc6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- M2EyMzFiNThlZWQ1YjRjNDQxMjE3YWNmOTIxZGEyMmY1M2E1ZGYxNw==
4
+ OGViNzRmM2I3M2NjODk3NTlkZDgzMTc3MTljMTkxMGRhY2YxODZkYg==
5
5
  data.tar.gz: !binary |-
6
- MGI4ODQ4NTkyNjc2MWMyZGNlNjdjYWQ5OTEzZmY4ZGFkYmM5OTdkNQ==
6
+ MDQ3NjJmYzVhNWQ3ZGI5OWFkN2ZjN2Q4YjlmMTAxZmRiM2VmOTBmZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YzU2ZDM1Zjk4NDI5YjM2YTUwYWQyOWRiMWFiY2M5YmQ0ZTY3YjQyZmM5Zjk3
10
- NjY0OTg1NGI0N2Q4MjRiNjhjZWI3OTc2MGFkNTMwZTljNTc3MmM0YWU4NzY2
11
- NTRmNjk5OGU4ODlhMDEwMDA2OTU3ZmFkZTVjMzY3NzVkN2FkOGY=
9
+ NjFmZmIzNTE2MmYyMWI0MGYyYzZiMDgxOGFhN2I3YjYyOWYwZjZiOTdjMjA4
10
+ YWE3ZWUxY2Y0YWNlNTdmM2I0YzdjYzkyYTY5ZTIwMzQ3NjMwMTg3ZmQ0OWUx
11
+ ZTM4ZmFkODE3MDMzZTQyY2M4ZjE4MDY3NzY3NjcwYzkzNWI1OTc=
12
12
  data.tar.gz: !binary |-
13
- MzEzYWVlYmZhNWJiZTgxMmRlNjNhYWVjNDYyYzEwZjA0ODhiNzdkZmUzNmY5
14
- MTRjNzEzYjJiM2M1NGYzYjNkOTg0MjYxODUxNTdlNmJlYTZkY2Y0ZGE5NDJl
15
- NDNiNDU1ZTUxNjI1NTlmZTNmYmYyZmJjYWM4ZjZjMTY4MTIzMzE=
13
+ ODYyYjNhMzlhMWU5MzlkOWZkY2E0ZDc1NDAyNzQyODlkOTE3MzhlZjZmNmMz
14
+ ZmYwOTk3YzhkMDAxNDk0ZTM1MzYwNDc1ODNlZmJjYmUzODE0ODFlNGM4ZDY5
15
+ NmJkYWJhOWU3MTY1OTkzOWIwZjgyOWNhOGNhOTRmMjU0ZDJiZGI=
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- streamsend (1.0.0.rc4)
4
+ streamsend (1.0.0.rc6)
5
5
  activesupport (~> 3.2)
6
6
  builder
7
7
  httmultiparty
@@ -58,14 +58,13 @@ module StreamSend
58
58
  private
59
59
 
60
60
  def get_error_from response
61
- message = "Unprocessable Entity"
62
- if response.parsed_response["request"]
63
- message = response.parsed_response["request"]["errors"]
64
- elsif response.parsed_response["errors"]
65
- message = response.parsed_response["errors"]["error"]
66
- elsif response["errors"]
67
- message = response["errors"]
61
+ return response.parsed_response["request"]["errors"] if response.parsed_response["request"]
62
+ if response.parsed_response["errors"]
63
+ return response.parsed_response["errors"] if response.parsed_response["errors"].is_a?(Array)
64
+ return response.parsed_response["errors"]["error"] if response.parsed_response["errors"].is_a?(Hash)
68
65
  end
66
+ return response["errors"] if response["errors"]
67
+ return "Unprocessable Entity"
69
68
  end
70
69
  end
71
70
  end
@@ -1,3 +1,3 @@
1
1
  module StreamSend
2
- VERSION = "1.0.0.rc5"
2
+ VERSION = "1.0.0.rc6"
3
3
  end
@@ -7,6 +7,7 @@ module StreamSend
7
7
  let(:session){ StreamSend::Api::Session.new() }
8
8
  let(:randomish){ DateTime.now.to_i.to_s }
9
9
  let(:email_hash){ { :from_email_address => { :email_address => "testing+#{randomish}@badd.address" } } }
10
+ let(:address_id) { Create.new(session).execute(email_hash) }
10
11
 
11
12
  before do
12
13
  WebMock.disable!
@@ -25,8 +26,6 @@ module StreamSend
25
26
 
26
27
  describe Show do
27
28
  it "shows a from email address by id" do
28
- creator = Create.new(session)
29
- address_id = creator.execute(email_hash)
30
29
  shower = Show.new(session)
31
30
  address = shower.execute(address_id)
32
31
  expect(address.email_address).to eq(email_hash[:from_email_address][:email_address])
@@ -35,8 +34,6 @@ module StreamSend
35
34
 
36
35
  describe ResendActivationEmail do
37
36
  it "resends the actiation email" do
38
- creator = Create.new(session)
39
- address_id = creator.execute(email_hash)
40
37
  response = ResendActivationEmail.new(session).execute(address_id)
41
38
  expect(response.code).to eq(200)
42
39
  end
@@ -148,16 +148,25 @@ module StreamSend
148
148
  id = creator.execute(person_hash)
149
149
 
150
150
  person = shower.execute(id)
151
- person.email_address = "me+#{randomish}@you.too"
151
+ new_email_address = "me+#{randomish}@you.too"
152
+ person.email_address = new_email_address
152
153
  updater = Update.new(session)
153
154
  updater.execute(id, :person => person.marshal_dump)
154
155
  person_updated = shower.execute(id)
155
- expect(person_updated.email_address).to eq(person_hash[:person][:email_address])
156
+ expect(person_updated.email_address).to eq(new_email_address)
156
157
  expect(person_updated.id).to eq(id)
157
158
 
158
159
  destroyer = Destroy.new(session)
159
160
  destroyer.execute(id)
160
161
  end
162
+
163
+ it "handles 422 errors properly" do
164
+ invalid_person_id = -3
165
+ update_request = Update.new(session)
166
+ expect do
167
+ update_request.execute(invalid_person_id, {})
168
+ end.to raise_error(StreamSend::Api::SemanticException, /Invalid person ID/)
169
+ end
161
170
  end
162
171
 
163
172
  describe Destroy do
@@ -30,11 +30,9 @@ module StreamSend
30
30
  let(:non_existent_person_id) { 42 }
31
31
  let(:error_response) do
32
32
  response_xml = <<-XML
33
- <request>
34
33
  <errors type='array'>
35
- <message>Invalid Owner ID</message>
34
+ <error>Invalid Owner ID</error>
36
35
  </errors>
37
- </request>
38
36
  XML
39
37
  end
40
38
 
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.rc5
4
+ version: 1.0.0.rc6
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-11-11 00:00:00.000000000 Z
11
+ date: 2013-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httmultiparty