exact_target_sdk 0.6.0 → 0.7.0

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.
data/CHANGELOG.rdoc CHANGED
@@ -1,5 +1,8 @@
1
1
  = ExactTarget SDK
2
2
 
3
+ == Version 0.7.0
4
+ * Implemented Client#Delete method
5
+
3
6
  == Version 0.6.0
4
7
  * Adding ContentArea object (from csalzman pull request)
5
8
 
@@ -10,6 +10,8 @@ module ExactTargetSDK
10
10
  autoload :ContentArea, 'exact_target_sdk/content_area'
11
11
  autoload :CreateResponse, 'exact_target_sdk/create_response'
12
12
  autoload :CreateResult, 'exact_target_sdk/create_result'
13
+ autoload :DeleteResponse, 'exact_target_sdk/delete_response'
14
+ autoload :DeleteResult, 'exact_target_sdk/delete_result'
13
15
  autoload :FilterPart, 'exact_target_sdk/filter_part'
14
16
  autoload :Result, 'exact_target_sdk/result'
15
17
  autoload :RetrieveResponse, 'exact_target_sdk/retrieve_response'
@@ -135,6 +135,38 @@ class Client
135
135
  UpdateResponse.new(response)
136
136
  end
137
137
 
138
+ # Invokes the Delete method.
139
+ #
140
+ # The provided arguments should each be sub-classes of APIObject, and each
141
+ # provided object will be updated in order.
142
+ #
143
+ # Possible exceptions are:
144
+ # HTTPError if an HTTP error (such as a timeout) occurs
145
+ # SOAPFault if a SOAP fault occurs
146
+ # Timeout if there is a timeout waiting for the response
147
+ # InvalidAPIObject if any of the provided objects don't pass validation
148
+ #
149
+ # Returns a DeleteResponse object.
150
+ def Delete(*args)
151
+ # TODO: implement and accept DeleteOptions
152
+
153
+ api_objects = args
154
+
155
+ response = execute_request 'Delete' do |xml|
156
+ xml.DeleteRequest do
157
+ xml.Options # TODO: support DeleteOptions
158
+
159
+ api_objects.each do |api_object|
160
+ xml.Objects "xsi:type" => api_object.type_name do
161
+ api_object.render!(xml)
162
+ end
163
+ end
164
+ end
165
+ end
166
+
167
+ DeleteResponse.new(response)
168
+ end
169
+
138
170
  def logger
139
171
  config[:logger]
140
172
  end
@@ -0,0 +1,25 @@
1
+ module ExactTargetSDK
2
+ class DeleteResponse
3
+
4
+ attr_reader :OverallStatus, :RequestID, :Results
5
+
6
+ def initialize(response)
7
+ response = response.to_hash[:delete_response]
8
+ @OverallStatus = response[:overall_status]
9
+ @RequestID = response[:request_id]
10
+ @Results = []
11
+
12
+ results = if response[:results].is_a? Array
13
+ response[:results]
14
+ elsif response[:results].is_a? Hash
15
+ [ response[:results] ]
16
+ else
17
+ []
18
+ end
19
+ results.each do |result|
20
+ @Results << DeleteResult.new(result)
21
+ end
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,4 @@
1
+ module ExactTargetSDK
2
+ class DeleteResult < Result
3
+ end
4
+ end
@@ -1,3 +1,3 @@
1
1
  module ExactTargetSDK
2
- VERSION = '0.6.0'
2
+ VERSION = '0.7.0'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exact_target_sdk
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 6
8
+ - 7
9
9
  - 0
10
- version: 0.6.0
10
+ version: 0.7.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Dawson
@@ -96,6 +96,8 @@ files:
96
96
  - lib/exact_target_sdk/content_area.rb
97
97
  - lib/exact_target_sdk/create_response.rb
98
98
  - lib/exact_target_sdk/create_result.rb
99
+ - lib/exact_target_sdk/delete_response.rb
100
+ - lib/exact_target_sdk/delete_result.rb
99
101
  - lib/exact_target_sdk/errors.rb
100
102
  - lib/exact_target_sdk/filter_part.rb
101
103
  - lib/exact_target_sdk/result.rb