fuelsdk 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog.md CHANGED
@@ -1,6 +1,11 @@
1
1
  FuelSDK-Ruby
2
2
  ============
3
3
 
4
+ 2013-09-19: Version 0.1.4
5
+ ```
6
+ moved dataextension property munging into client so not required to instantiate those objects.
7
+ ```
8
+
4
9
  2013-09-18: Version 0.1.3
5
10
  ```
6
11
  augment soap_cud to handle dataextensions better
@@ -208,71 +208,28 @@ module FuelSDK
208
208
  end
209
209
 
210
210
  def post
211
- munge_properties self.properties
211
+ add_customer_key self.properties
212
212
  super
213
213
  end
214
214
 
215
215
  def patch
216
- munge_properties self.properties
216
+ add_customer_key self.properties
217
217
  super
218
218
  end
219
219
 
220
220
  def delete
221
- munge_keys self.properties
221
+ add_customer_key self.properties
222
222
  super
223
223
  end
224
224
 
225
225
  private
226
- #::TODO::
227
- # opportunity for meta programming here... but need to get this out the door
228
- def munge_keys d
229
- d.each do |o|
230
-
231
- next if explicit_keys(o) && explicit_customer_key(o)
232
-
233
- formatted = []
234
- o['CustomerKey'] = customer_key unless explicit_customer_key o
235
- unless explicit_properties(o)
236
- o.each do |k, v|
237
- next if k == 'CustomerKey'
238
- formatted.concat FuelSDK.format_name_value_pairs k => v
239
- o.delete k
240
- end
241
- o['Keys'] = {'Key' => formatted }
242
- end
226
+ def add_customer_key data
227
+ data.each do |d|
228
+ next if d.include? 'CustomerKey'
229
+ d['CustomerKey'] = customer_key
243
230
  end
244
231
  end
245
232
 
246
- def explicit_keys h
247
- h['Keys'] and h['Keys']['Key']
248
- end
249
-
250
- def munge_properties d
251
- d.each do |o|
252
-
253
- next if explicit_properties(o) && explicit_customer_key(o)
254
-
255
- formatted = []
256
- o['CustomerKey'] = customer_key unless explicit_customer_key o
257
- unless explicit_properties(o)
258
- o.each do |k, v|
259
- next if k == 'CustomerKey'
260
- formatted.concat FuelSDK.format_name_value_pairs k => v
261
- o.delete k
262
- end
263
- o['Properties'] = {'Property' => formatted }
264
- end
265
- end
266
- end
267
-
268
- def explicit_properties h
269
- h['Properties'] and h['Properties']['Property']
270
- end
271
-
272
- def explicit_customer_key h
273
- h['CustomerKey']
274
- end
275
-
276
233
  def retrieve_required
277
234
  # have to use instance variables so we don't recursivelly retrieve_required
278
235
  if !@name && !@customer_key
@@ -1,3 +1,3 @@
1
1
  module FuelSDK
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
data/lib/fuelsdk.rb CHANGED
@@ -4,18 +4,7 @@ require 'rubygems'
4
4
  require 'date'
5
5
  require 'jwt'
6
6
  require 'active_support/inflector'
7
-
8
- class Array
9
- class << self
10
- def wrap subject
11
- if subject.kind_of? Array
12
- subject
13
- else
14
- [subject]
15
- end
16
- end
17
- end
18
- end
7
+ require "active_support/core_ext/array/wrap"
19
8
 
20
9
  module FuelSDK
21
10
  require 'fuelsdk/utils'
data/spec/objects_spec.rb CHANGED
@@ -461,11 +461,9 @@ describe FuelSDK::DataExtension::Row do
461
461
 
462
462
  subject.properties = [{'Name' => 'Justin'}]
463
463
 
464
- expect(subject.post).to eq([
465
- 'DataExtensionObject', [{
466
- 'CustomerKey' => 'Subscribers',
467
- 'Properties' => {'Property' => [{'Name' => 'Name', 'Value' => 'Justin'}]}}]
468
- ])
464
+ expect(subject.post).to eq(
465
+ ["DataExtensionObject", [{"Name"=>"Justin", "CustomerKey"=>"Subscribers"}]]
466
+ )
469
467
  end
470
468
  end
471
469
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fuelsdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-09-18 00:00:00.000000000 Z
13
+ date: 2013-09-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler