cupid 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock ADDED
@@ -0,0 +1,37 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ cupid (0.0.2)
5
+ builder (>= 2.1.2)
6
+ nokogiri (>= 1.4.1)
7
+ savon (>= 0.9.0)
8
+
9
+ GEM
10
+ remote: http://rubygems.org/
11
+ specs:
12
+ akami (1.0.0)
13
+ gyoku (>= 0.4.0)
14
+ builder (3.0.0)
15
+ gyoku (0.4.4)
16
+ builder (>= 2.1.2)
17
+ httpi (0.9.5)
18
+ rack
19
+ nokogiri (1.5.0)
20
+ nori (1.0.2)
21
+ rack (1.3.2)
22
+ savon (0.9.7)
23
+ akami (~> 1.0)
24
+ builder (>= 2.1.2)
25
+ gyoku (>= 0.4.0)
26
+ httpi (~> 0.9)
27
+ nokogiri (>= 1.4.0)
28
+ nori (~> 1.0)
29
+ wasabi (~> 2.0)
30
+ wasabi (2.0.0)
31
+ nokogiri (>= 1.4.0)
32
+
33
+ PLATFORMS
34
+ ruby
35
+
36
+ DEPENDENCIES
37
+ cupid!
data/README.md CHANGED
@@ -13,13 +13,13 @@ Sponsored by Evil Martians <http://evilmartians.com>
13
13
  Puts this line into `Gemfile` then run `$ bundle`:
14
14
 
15
15
  ``` ruby
16
- gem 'cupid', '0.0.2'
16
+ gem 'cupid', '0.0.3'
17
17
  ```
18
18
 
19
19
  Or if you are old-school Rails 2 developer put this into `config/environment.rb` and run `$ rake gems:install`:
20
20
 
21
21
  ``` ruby
22
- config.gem 'cupid', :version => '0.0.2'
22
+ config.gem 'cupid', :version => '0.0.3'
23
23
  ```
24
24
 
25
25
  Or manually install cupid gem: `$ gem install cupid`
@@ -39,6 +39,24 @@ module Cupid
39
39
  created_email_id = response.css('NewID').text
40
40
  end
41
41
 
42
+ def create_folder(title, *args)
43
+ options = args.extract_options!
44
+ options[:title] = CGI.escapeHTML title.to_s
45
+
46
+ options[:content_type] ||= 'email'
47
+ options[:is_active] ||= 'true'
48
+ options[:is_editable] ||= 'true'
49
+ options[:allow_children] ||= 'true'
50
+
51
+ soap_body = '<Objects xsi:type="DataFolder">' +
52
+ create_folder_object(options) +
53
+ '</Objects>'
54
+
55
+ response = build_request('Create', 'CreateRequest', soap_body)
56
+ response = Nokogiri::XML(response.http.body).remove_namespaces!
57
+ created_folder_id = response.css('NewID').text
58
+ end
59
+
42
60
  def email_link(email_id)
43
61
  "https://members.s4.exacttarget.com/Content/Email/EmailEdit.aspx?eid=" + email_id.to_s
44
62
  end
@@ -48,16 +66,32 @@ module Cupid
48
66
  end
49
67
 
50
68
  private
51
- def create_email_object(options)
52
- email_object = '<ObjectID xsi:nil="true"/>'
53
- email_object += '<Client><ID>' + options[:client_id].to_s + '</ID></Client>' if options[:client_id]
54
- email_object += '<CategoryID>' + options[:category_id].to_s + '</CategoryID>' if options[:category_id]
55
- email_object += '<Name>' + options[:name].to_s + '</Name>' if options[:name]
56
- email_object += '<Description>' + options[:description].to_s + '</Description>' if options[:description]
57
- email_object += '<Subject>' + options[:subject] + '</Subject>' +
58
- '<HTMLBody>' + options[:body] + '</HTMLBody>' +
59
- '<EmailType>' + options[:email_type] + '</EmailType>' +
60
- '<IsHTMLPaste>' + options[:is_html_paste] + '</IsHTMLPaste>'
69
+ def create_email_object(options)
70
+ email_object = '<ObjectID xsi:nil="true"/>'
71
+ email_object += '<Client><ID>' + options[:client_id].to_s + '</ID></Client>' if options[:client_id]
72
+ email_object += '<CategoryID>' + options[:category_id].to_s + '</CategoryID>' if options[:category_id]
73
+ email_object += '<Name>' + options[:name].to_s + '</Name>' if options[:name]
74
+ email_object += '<Description>' + options[:description].to_s + '</Description>' if options[:description]
75
+ email_object += '<Subject>' + options[:subject] + '</Subject>' +
76
+ '<HTMLBody>' + options[:body] + '</HTMLBody>' +
77
+ '<EmailType>' + options[:email_type] + '</EmailType>' +
78
+ '<IsHTMLPaste>' + options[:is_html_paste] + '</IsHTMLPaste>'
79
+ end
80
+
81
+ def create_folder_object(options)
82
+ folder_object = '<ObjectID xsi:nil="true"/>'
83
+ folder_object += '<Client><ID>' + options[:client_id].to_s + '</ID></Client>' if options[:client_id]
84
+ folder_object += '<CustomerKey>' + options[:title].to_s + '</CustomerKey>' if options[:title]
85
+ folder_object += '<Name>' + options[:title].to_s + '</Name>'
86
+ folder_object += '<Description>' + options[:description].to_s + '</Description>' if options[:description]
87
+ if options[:parent]
88
+ folder_object += '<ParentFolder>
89
+ <PartnerKey xsi:nil="true"/>
90
+ <ModifiedDate xsi:nil="true"/>
91
+ <ID>' + options[:parent].to_s + '</ID>
92
+ <ObjectID xsi:nil="true"/>
93
+ </ParentFolder>'
61
94
  end
95
+ end
62
96
  end
63
97
  end
data/lib/cupid/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cupid
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
@@ -1,5 +1,5 @@
1
1
  require 'rubygems'
2
- require 'ruby-debug'
2
+ # require 'ruby-debug'
3
3
  require 'savon'
4
4
  require 'cgi'
5
5
 
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: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
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-08-01 00:00:00 Z
18
+ date: 2011-09-05 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: builder
@@ -76,6 +76,7 @@ extra_rdoc_files: []
76
76
 
77
77
  files:
78
78
  - Gemfile
79
+ - Gemfile.lock
79
80
  - README.md
80
81
  - Rakefile
81
82
  - cupid.gemspec
@@ -117,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
118
  requirements: []
118
119
 
119
120
  rubyforge_project: cupid
120
- rubygems_version: 1.7.2
121
+ rubygems_version: 1.8.6
121
122
  signing_key:
122
123
  specification_version: 3
123
124
  summary: Create, organize and send emails through Exact Target SOAP API