exactly 0.0.3 → 0.0.4

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.
@@ -1,11 +1,19 @@
1
1
  module Exactly
2
- class TriggeredSendFailed < StandardError
2
+ class ExactlyError < StandardError
3
3
  attr_reader :response
4
4
  def initialize(response)
5
5
  @response = response
6
6
  super(message)
7
7
  end
8
+ end
9
+
10
+ class UpsertDataExtensionFailed < ExactlyError
11
+ def message
12
+ @response.to_hash[:update_response][:results][:status_message]
13
+ end
14
+ end
8
15
 
16
+ class TriggeredSendFailed < ExactlyError
9
17
  def message
10
18
  @response.to_hash[:create_response][:results][:status_message]
11
19
  end
@@ -21,7 +29,7 @@ module Exactly
21
29
  end
22
30
 
23
31
  def upsert_data_extension(customer_key, properties)
24
- client.request "UpdateRequest", :xmlns => "http://exacttarget.com/wsdl/partnerAPI" do
32
+ response = client.request "UpdateRequest", :xmlns => "http://exacttarget.com/wsdl/partnerAPI" do
25
33
  http.headers['SOAPAction'] = 'Update'
26
34
  soap.body = {
27
35
  "Options" => {
@@ -43,6 +51,9 @@ module Exactly
43
51
  :attributes! => { "Objects" => { "xsi:type" => "DataExtensionObject" }}
44
52
  }
45
53
  end
54
+ if response.to_hash[:update_response][:overall_status] != 'OK'
55
+ raise Exactly::UpsertDataExtensionFailed.new(response)
56
+ end
46
57
  end
47
58
 
48
59
  def delete_from_data_extension(customer_key, properties)
@@ -1,3 +1,3 @@
1
1
  module Exactly
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jacob Atzen
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-12-07 00:00:00 +01:00
17
+ date: 2012-12-19 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency