exact-target-api 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f16b1465275075f5b2b956702c000af1872935ef
4
- data.tar.gz: 04bb5390afa4c61ba19e5ea212b792bdab596b6c
3
+ metadata.gz: d03c6227c8147eaa8d7c2b6b0bd0c12a01106c93
4
+ data.tar.gz: b2b00dc4f9a997b20d7da11eaf5e72724b7285b0
5
5
  SHA512:
6
- metadata.gz: 5a6b1736bdada888b8649f167e1093267f5c6d56f048ddbf71eb430b05e2043d219d00411948838a33dacbd02a66a40aa3dae0cc562fe573643c5939cee29acd
7
- data.tar.gz: f3a477594d4239dab32fa99880b5c9c24a5db0b1a7bbdfd2ba75d0d271edcb84715cf4d2dda14b8fca067b901b85acd0ccb4d5e9eea76193b6947743471112a6
6
+ metadata.gz: cb58973a5a9bfb9e0dd18653aed4199c7f3e5c075d0fffc1087722f0a76998aabdc88af3fbbfd0d708464ed054a33a720985f96f89b9d88a7313eafb3ab8306a
7
+ data.tar.gz: 578287fe009d3159f10cc2f48ff562ad47a6f5f5f0f5e44900bce1c94d14a468079b71ac1f091e4b7e71f4e7dcfe58abaeb50f929620a06d6fbd4cfdd453293a
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- exact-target-api (0.0.1)
4
+ exact-target-api (0.0.3)
5
5
  jwt (~> 0.1.8)
6
6
  savon (~> 2.2.0)
7
7
 
@@ -18,8 +18,10 @@ GEM
18
18
  rack
19
19
  jwt (0.1.8)
20
20
  multi_json (>= 1.5)
21
- multi_json (1.7.3)
22
- nokogiri (1.5.9)
21
+ mini_portile (0.5.0)
22
+ multi_json (1.7.7)
23
+ nokogiri (1.6.0)
24
+ mini_portile (~> 0.5.0)
23
25
  nori (2.1.0)
24
26
  rack (1.5.2)
25
27
  savon (2.2.0)
data/README.md CHANGED
@@ -58,5 +58,20 @@ puts subscriber.status # true
58
58
  puts subscriber.results # {:partner_key=>nil, :object_id=>nil, :email_address=>"RubySDK@bh.exacttarget.com", :subscriber_key=>"RubySDK@bh.exacttarget.com", :status=>"Active", :"@xsi:type"=>"Subscriber"}
59
59
 
60
60
 
61
+ # Folders
62
+ folder_id = client.folders.find 'FolderName'
63
+ folder_id = client.folders.create 'FolderName', parent_folder_id, 'Some description'
64
+ folder_id = client.folders.find_or_create 'FolderName', parent_folder_id, 'Some description'
65
+
66
+ list = client.list.create(
67
+ ListName: "...",
68
+ Description: "...",
69
+ Type: "Private",
70
+ folder_id: folder_id
71
+ # OR
72
+ # CategoryID: folder_id
73
+ )
74
+
75
+
61
76
 
62
77
  ```
@@ -27,6 +27,7 @@ require "exact-target-api/delete_rest"
27
27
  require "exact-target-api/describe"
28
28
  require "exact-target-api/email"
29
29
  require "exact-target-api/folder"
30
+ require "exact-target-api/folders"
30
31
  require "exact-target-api/get"
31
32
  require "exact-target-api/get_rest"
32
33
  require "exact-target-api/list"
@@ -108,6 +108,10 @@ module ET
108
108
  ET::Subscriber.new(self)
109
109
  end
110
110
 
111
+ def folders
112
+ ET::Folders.new(self)
113
+ end
114
+
111
115
  #def AddSubscriberToList(emailAddress, listIDs, subscriberKey = nil)
112
116
  # newSub = ET::Subscriber.new
113
117
  # newSub.authStub = self
@@ -0,0 +1,61 @@
1
+ module ET
2
+ class Folders < ET::BaseObject
3
+ def initialize(client)
4
+ @client = client
5
+
6
+
7
+ end
8
+
9
+ def find_or_create(name, parent_folder_id, description = '', options = {})
10
+ if (folder_id = find(name))
11
+ folder_id
12
+ else
13
+ create(name, parent_folder_id, description, options)
14
+ end
15
+ end
16
+
17
+
18
+ def find(name)
19
+ folder = ET::Folder.new
20
+ folder.client = @client
21
+ props = ["ID"]
22
+ filter = {
23
+ 'LeftOperand' => {
24
+ 'Property' => 'Name',
25
+ 'SimpleOperator' => 'equals',
26
+ 'Value' => name
27
+ },
28
+ 'LogicalOperator' => 'AND',
29
+ 'RightOperand' => {
30
+ 'Property' => 'ContentType',
31
+ 'SimpleOperator' => 'equals',
32
+ 'Value' => 'EMAIL'
33
+ }
34
+ }
35
+ res = folder.get(props, filter)
36
+
37
+ res.results[0][:id] if res.results[0]
38
+ end
39
+
40
+
41
+ def create(name, parent_folder_id, description = '', options = {})
42
+ stringify_keys!(options)
43
+
44
+ folder = ET::Folder.new
45
+ folder.client = @client
46
+ data = {
47
+ "CustomerKey" => name,
48
+ "Name" => name,
49
+ "ContentType"=> "EMAIL",
50
+ "ParentFolder" => {"ID" => parent_folder_id},
51
+ "Description" => description
52
+ }.merge(options)
53
+
54
+ res = folder.post(data)
55
+ if res.results[0] && (id = res.results[0][:new_id]).to_i > 0
56
+ id
57
+ end
58
+ end
59
+
60
+ end
61
+ end
@@ -16,8 +16,10 @@ module ET
16
16
  ET::Describe.new(@client, @obj)
17
17
  end
18
18
 
19
- def getMoreResults
19
+ def get_more_results
20
20
  ET::Continue.new(@client, @lastRequestID)
21
21
  end
22
+
23
+ alias_method :getMoreResults, :get_more_results
22
24
  end
23
25
  end
@@ -16,6 +16,9 @@ module ET
16
16
  # {ListName: "NewListName", Description: "This list was created with the RubySDK", Type: "Private"}
17
17
  def create(params)
18
18
  stringify_keys!(params)
19
+ if (folder_id = params.delete('folder_id'))
20
+ params['CategoryID'] = folder_id
21
+ end
19
22
  res = post(params)
20
23
  assign_values(res)
21
24
  self
@@ -1,3 +1,3 @@
1
1
  module ET
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exact-target-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Shapiotko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-27 00:00:00.000000000 Z
11
+ date: 2013-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: savon
@@ -71,6 +71,7 @@ files:
71
71
  - lib/exact-target-api/describe.rb
72
72
  - lib/exact-target-api/email.rb
73
73
  - lib/exact-target-api/folder.rb
74
+ - lib/exact-target-api/folders.rb
74
75
  - lib/exact-target-api/get.rb
75
76
  - lib/exact-target-api/get_rest.rb
76
77
  - lib/exact-target-api/get_support.rb