cupid 0.0.86 → 0.1.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/README.md +10 -5
- data/lib/cupid/methods/email.rb +4 -4
- data/lib/cupid/session.rb +11 -10
- data/lib/cupid/version.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -12,6 +12,7 @@ Add cupid initializer to your config/initializers and now there only two paramet
|
|
12
12
|
Cupid.configure do |config|
|
13
13
|
config.username = 'username'
|
14
14
|
config.password = 'password'
|
15
|
+
config.account = 'default_client_id'
|
15
16
|
end
|
16
17
|
```
|
17
18
|
|
@@ -22,19 +23,23 @@ After that you can create Cupid::Session object and do some stuff through it:
|
|
22
23
|
et_translator = Cupid::Session.new
|
23
24
|
|
24
25
|
# Retrieving folders for not default account (your_account_id can be nil - default account on ET)
|
25
|
-
folders = et_translator.retrieve_email_folders
|
26
|
+
folders = et_translator.retrieve_email_folders
|
26
27
|
|
27
28
|
# Creating new folder
|
28
29
|
# not required fields for folder: description, content_type, is_active, is_editable, allow_children
|
29
|
-
new_folder_id = et_translator.create_folder('title', :parent => parent_directory_id
|
30
|
+
new_folder_id = et_translator.create_folder('title', :parent => parent_directory_id)
|
30
31
|
|
31
32
|
# Creating new email
|
32
33
|
# not required fields for email: email_type, is_html_paste, character_set, name, description, category_id
|
33
|
-
new_email_id = et_translator.create_email('subject', 'body'
|
34
|
+
new_email_id = et_translator.create_email('subject', 'body')
|
34
35
|
|
35
36
|
# Creating new subscriber
|
36
37
|
# not required fields for subscriber: first_name, last_name, client_id
|
37
38
|
new_subscriber_id = et_translator.create_subscriber('email@email.com')
|
39
|
+
|
40
|
+
# Send email to list
|
41
|
+
# not required fields for send: account
|
42
|
+
send_tracking_id = et_translator.send_email_to_list(email_id, list_id)
|
38
43
|
```
|
39
44
|
|
40
45
|
## Installation
|
@@ -42,13 +47,13 @@ new_subscriber_id = et_translator.create_subscriber('email@email.com')
|
|
42
47
|
Puts this line into `Gemfile` then run `$ bundle`:
|
43
48
|
|
44
49
|
``` ruby
|
45
|
-
gem 'cupid', '0.0
|
50
|
+
gem 'cupid', '0.1.0'
|
46
51
|
```
|
47
52
|
|
48
53
|
Or if you are old-school Rails 2 developer put this into `config/environment.rb` and run `$ rake gems:install`:
|
49
54
|
|
50
55
|
``` ruby
|
51
|
-
config.gem 'cupid', :version => '0.0
|
56
|
+
config.gem 'cupid', :version => '0.1.0'
|
52
57
|
```
|
53
58
|
|
54
59
|
Or manually install cupid gem: `$ gem install cupid`
|
data/lib/cupid/methods/email.rb
CHANGED
@@ -3,10 +3,11 @@ module Cupid
|
|
3
3
|
def retrieve_email_folders(account=nil, properties=nil)
|
4
4
|
account ||= @account
|
5
5
|
properties ||= ['ID', 'Name', 'ParentFolder.ID', 'ParentFolder.Name']
|
6
|
-
filters = 'Filter xsi:type="SimpleFilterPart"' => {
|
6
|
+
filters = {'Filter xsi:type="SimpleFilterPart"' => {
|
7
7
|
'Property' => 'ContentType',
|
8
8
|
'SimpleOperator' => 'like',
|
9
9
|
'Value' => 'email'
|
10
|
+
}
|
10
11
|
}
|
11
12
|
|
12
13
|
soap_body = build_retrieve(account.to_s, 'DataFolder', properties, filters)
|
@@ -120,9 +121,8 @@ module Cupid
|
|
120
121
|
'<List>' +
|
121
122
|
'<PartnerKey xsi:nil="true"/>' +
|
122
123
|
'<ObjectID xsi:nil="true"/>' +
|
123
|
-
'<ID>' + list_id.to_s + '</
|
124
|
-
'</List>'
|
125
|
-
'</Objects>'
|
124
|
+
'<ID>' + list_id.to_s + '</ID>' +
|
125
|
+
'</List>'
|
126
126
|
end
|
127
127
|
end
|
128
128
|
end
|
data/lib/cupid/session.rb
CHANGED
@@ -61,17 +61,18 @@ module Cupid
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def build_retrieve(id, object_type, properties, filters=nil)
|
64
|
-
body =
|
65
|
-
'ClientIDs'
|
66
|
-
'ID'
|
67
|
-
|
68
|
-
'ObjectType'
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
64
|
+
body = '<RetrieveRequest>' +
|
65
|
+
'<ClientIDs>' +
|
66
|
+
'<ID>' + id.to_s + '</ID>' +
|
67
|
+
'</ClientIDs>' +
|
68
|
+
'<ObjectType>' + object_type.to_s + '</ObjectType>'
|
69
|
+
properties.each do |p|
|
70
|
+
body += '<Properties>' + p.to_s + '</Properties>'
|
71
|
+
end
|
72
|
+
|
73
|
+
body += filters if filters
|
73
74
|
|
74
|
-
body
|
75
|
+
body + '</RetrieveRequest>'
|
75
76
|
end
|
76
77
|
end
|
77
78
|
end
|
data/lib/cupid/version.rb
CHANGED
metadata
CHANGED