cupid 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +5 -2
- data/lib/cupid/methods/email.rb +15 -0
- data/lib/cupid/version.rb +1 -1
- data/tmp/dancing_with_ET.rb +33 -18
- metadata +4 -4
data/README.md
CHANGED
@@ -25,6 +25,9 @@ et_translator = Cupid::Session.new
|
|
25
25
|
# Retrieving folders for not default account (your_account_id can be nil - default account on ET)
|
26
26
|
folders = et_translator.retrieve_email_folders
|
27
27
|
|
28
|
+
# Retrieving email copies for not default account (your_account_id can be nil - default account on ET)
|
29
|
+
copies = et_translator.retrieve_email_copies(name)
|
30
|
+
|
28
31
|
# Creating new folder
|
29
32
|
# not required fields for folder: description, content_type, is_active, is_editable, allow_children
|
30
33
|
new_folder_id = et_translator.create_folder('title', :parent => parent_directory_id)
|
@@ -47,13 +50,13 @@ send_tracking_id = et_translator.send_email_to_list(email_id, list_id)
|
|
47
50
|
Puts this line into `Gemfile` then run `$ bundle`:
|
48
51
|
|
49
52
|
``` ruby
|
50
|
-
gem 'cupid', '0.1.
|
53
|
+
gem 'cupid', '0.1.2'
|
51
54
|
```
|
52
55
|
|
53
56
|
Or if you are old-school Rails 2 developer put this into `config/environment.rb` and run `$ rake gems:install`:
|
54
57
|
|
55
58
|
``` ruby
|
56
|
-
config.gem 'cupid', :version => '0.1.
|
59
|
+
config.gem 'cupid', :version => '0.1.2'
|
57
60
|
```
|
58
61
|
|
59
62
|
Or manually install cupid gem: `$ gem install cupid`
|
data/lib/cupid/methods/email.rb
CHANGED
@@ -15,6 +15,21 @@ module Cupid
|
|
15
15
|
all_folders = response.css('Results').map{|f| {f.css('Name').to_a.map(&:text).join('/') => f.css('ID')[0].text}}
|
16
16
|
end
|
17
17
|
|
18
|
+
def retrieve_email_copies(name, account=nil, properties=nil)
|
19
|
+
account ||= @account
|
20
|
+
properties ||= ['ID', 'Name']
|
21
|
+
filters = '<Filter xsi:type="SimpleFilterPart">' +
|
22
|
+
'<Property>Name</Property>' +
|
23
|
+
'<SimpleOperator>like</SimpleOperator>' +
|
24
|
+
'<Value>' + name + '</Value>' +
|
25
|
+
'</Filter>'
|
26
|
+
|
27
|
+
soap_body = build_retrieve(account.to_s, 'Email', properties, filters)
|
28
|
+
response = build_request('Retrieve', 'RetrieveRequestMsg', soap_body)
|
29
|
+
response = Nokogiri::XML(response.http.body).remove_namespaces!
|
30
|
+
all_copies = response.css('Results').map{|f| {f.css('Name').to_a.map(&:text).join('/') => f.css('ID')[0].text}}
|
31
|
+
end
|
32
|
+
|
18
33
|
def create_email(subject, body, *args)
|
19
34
|
options = args.extract_options!
|
20
35
|
options[:subject] = CGI.escapeHTML subject.to_s
|
data/lib/cupid/version.rb
CHANGED
data/tmp/dancing_with_ET.rb
CHANGED
@@ -8,7 +8,7 @@ client = Savon::Client.new do
|
|
8
8
|
wsdl.document = "https://webservice.s4.exacttarget.com/etframework.wsdl"
|
9
9
|
end
|
10
10
|
|
11
|
-
client.wsse.credentials "
|
11
|
+
client.wsse.credentials "", ""
|
12
12
|
client.wsse.created_at = Time.now.utc
|
13
13
|
client.wsse.expires_at = (Time.now + 60).utc
|
14
14
|
client.http.headers["SOAPAction"] = '"urn:example#service"'
|
@@ -138,22 +138,37 @@ body = '<Objects xsi:type="Send">
|
|
138
138
|
# puts '-============-'
|
139
139
|
#
|
140
140
|
# puts body_noko.text
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
141
|
+
body = '<RetrieveRequest>
|
142
|
+
<ClientIDs>
|
143
|
+
<ID>1058484</ID>
|
144
|
+
</ClientIDs>
|
145
|
+
<ObjectType>DataFolder</ObjectType>
|
146
|
+
<Properties>ID</Properties>
|
147
|
+
<Properties>Name</Properties>
|
148
|
+
<Properties>ParentFolder.ID</Properties>
|
149
|
+
<Properties>ParentFolder.Name</Properties>
|
150
|
+
<Filter xsi:type="SimpleFilterPart">
|
151
|
+
<Property>ContentType</Property>
|
152
|
+
<SimpleOperator>like</SimpleOperator>
|
153
|
+
<Value>email</Value>
|
154
|
+
</Filter>
|
155
|
+
</RetrieveRequest>'
|
156
|
+
|
157
|
+
body = '<RetrieveRequest>
|
158
|
+
<ClientIDs>
|
159
|
+
<ID>1058484</ID>
|
160
|
+
</ClientIDs>
|
161
|
+
<ObjectType>Email</ObjectType>
|
162
|
+
<Properties>ID</Properties>
|
163
|
+
<Properties>Name</Properties>
|
164
|
+
<Properties>Folder</Properties>
|
165
|
+
<Properties>CategoryID</Properties>
|
166
|
+
<Filter xsi:type="SimpleFilterPart">
|
167
|
+
<Property>Name</Property>
|
168
|
+
<SimpleOperator>like</SimpleOperator>
|
169
|
+
<Value>120911_piter_follow_up_side</Value>
|
170
|
+
</Filter>
|
171
|
+
</RetrieveRequest>'
|
157
172
|
|
158
173
|
html = CGI.escapeHTML('<center><h2>Way Cool Email</h2></center>')
|
159
174
|
|
@@ -178,7 +193,7 @@ namespaces = {
|
|
178
193
|
}
|
179
194
|
#
|
180
195
|
response = client.request :retrieve do |soap|
|
181
|
-
soap.input = ['
|
196
|
+
soap.input = ['RetrieveRequestMsg', { 'xmlns'=>"http://exacttarget.com/wsdl/partnerAPI"}]
|
182
197
|
soap.header = header
|
183
198
|
soap.env_namespace = :s
|
184
199
|
soap.namespaces = namespaces
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cupid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- gazay
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-09-
|
18
|
+
date: 2011-09-28 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: builder
|