rbet 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +5 -0
- data/LICENSE +20 -0
- data/README.rdoc +2 -1
- data/Rakefile +41 -43
- data/VERSION +1 -0
- data/lib/rbet/client.rb +18 -2
- data/lib/rbet/list.rb +15 -4
- data/lib/rbet/subscriber.rb +21 -4
- data/lib/rbet/subscriber_add.rxml +1 -1
- data/lib/rbet/version.rb +1 -1
- data/rbet.gemspec +88 -0
- metadata +27 -10
data/.document
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Kevin McFadden
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
CHANGED
@@ -3,7 +3,8 @@
|
|
3
3
|
This is an attempt to make integrating easier with ExactTarget. ExactTarget is an email newsletter system designed to make it easy to setup timely newsletters.
|
4
4
|
|
5
5
|
- Exact Target: http://www.exacttarget.com/
|
6
|
-
- Exact Target API: http://wiki.memberlandingpages.com/API_References/
|
6
|
+
- Exact Target XML API: http://wiki.memberlandingpages.com/API_References/XML_API
|
7
|
+
- Exact Target Web Service API: http://wiki.memberlandingpages.com/API_References/Web_Service_Guide
|
7
8
|
|
8
9
|
== Adding rbet to a Rails Project
|
9
10
|
|
data/Rakefile
CHANGED
@@ -1,56 +1,54 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require 'rake
|
3
|
-
require 'rake/testtask'
|
4
|
-
require 'rake/rdoctask'
|
5
|
-
require 'lib/rbet/version'
|
6
|
-
|
7
|
-
spec = Gem::Specification.new do |s|
|
8
|
-
s.name = 'rbet'
|
9
|
-
s.version = RBET::Version.to_s
|
10
|
-
s.has_rdoc = true
|
11
|
-
s.extra_rdoc_files = %w(README.rdoc)
|
12
|
-
s.rdoc_options = %w(--main README.rdoc)
|
13
|
-
s.summary = "A ruby wrapper for the Exact Target API"
|
14
|
-
s.author = 'See Contributing Section'
|
15
|
-
s.email = 'kevin@conceptsahead.com'
|
16
|
-
s.homepage = 'http://github.com/n3bulous/rbet'
|
17
|
-
s.files = %w(README.rdoc Rakefile) + Dir.glob("{lib,test}/**/*")
|
18
|
-
# s.executables = ['rbet']
|
19
|
-
|
20
|
-
# s.add_dependency('gem_name', '~> 0.0.1')
|
21
|
-
end
|
2
|
+
require 'rake'
|
22
3
|
|
23
|
-
|
24
|
-
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "rbet"
|
8
|
+
gem.summary = %Q{A ruby wrapper for the Exact Target API}
|
9
|
+
gem.description = %Q{A ruby wrapper for the Exact Target API}
|
10
|
+
gem.email = "kevin@conceptsahead.com"
|
11
|
+
gem.homepage = "http://github.com/n3bulous/rbet"
|
12
|
+
gem.authors = ["See Contributing Section"]
|
13
|
+
|
14
|
+
gem.add_development_dependency "hpricot", ">= 0"
|
15
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
|
+
end
|
17
|
+
Jeweler::GemcutterTasks.new
|
18
|
+
rescue LoadError
|
19
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
25
20
|
end
|
26
21
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
22
|
+
require 'rake/testtask'
|
23
|
+
Rake::TestTask.new(:test) do |test|
|
24
|
+
test.libs << 'lib' << 'test'
|
25
|
+
test.pattern = 'test/**/test_*.rb'
|
26
|
+
test.verbose = true
|
31
27
|
end
|
32
28
|
|
33
29
|
begin
|
34
30
|
require 'rcov/rcovtask'
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
t.verbose = true
|
40
|
-
t.rcov_opts = ['--text-report', "-x #{Gem.path}", '-x /Library/Ruby', '-x /usr/lib/ruby']
|
31
|
+
Rcov::RcovTask.new do |test|
|
32
|
+
test.libs << 'test'
|
33
|
+
test.pattern = 'test/**/test_*.rb'
|
34
|
+
test.verbose = true
|
41
35
|
end
|
42
|
-
|
43
|
-
task :default => :coverage
|
44
|
-
|
45
36
|
rescue LoadError
|
46
|
-
|
47
|
-
|
37
|
+
task :rcov do
|
38
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
39
|
+
end
|
48
40
|
end
|
49
41
|
|
42
|
+
task :test => :check_dependencies
|
43
|
+
|
44
|
+
task :default => :test
|
50
45
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
46
|
+
require 'rake/rdoctask'
|
47
|
+
Rake::RDocTask.new do |rdoc|
|
48
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
49
|
+
|
50
|
+
rdoc.rdoc_dir = 'rdoc'
|
51
|
+
rdoc.title = "rbet #{version}"
|
52
|
+
rdoc.rdoc_files.include('README*')
|
53
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
54
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.3
|
data/lib/rbet/client.rb
CHANGED
@@ -25,6 +25,7 @@
|
|
25
25
|
require 'net/https'
|
26
26
|
require 'uri'
|
27
27
|
require 'erb'
|
28
|
+
include ERB::Util
|
28
29
|
|
29
30
|
module RBET
|
30
31
|
class Client
|
@@ -50,7 +51,8 @@ module RBET
|
|
50
51
|
@url.use_ssl = options.key?(:use_ssl) ? options[:use_ssl] : true
|
51
52
|
@url.set_debug_output options.key?(:debug_output) ? options[:debug_output] : nil
|
52
53
|
@headers = {
|
53
|
-
'Content-Type' => 'application/x-www-form-urlencoded'
|
54
|
+
'Content-Type' => 'application/x-www-form-urlencoded',
|
55
|
+
'Connection' => 'close'
|
54
56
|
}
|
55
57
|
end
|
56
58
|
|
@@ -78,7 +80,21 @@ module RBET
|
|
78
80
|
@system = ""
|
79
81
|
yield @system
|
80
82
|
|
81
|
-
|
83
|
+
data = ""
|
84
|
+
xml = Builder::XmlMarkup.new(:target => data, :indent => 2)
|
85
|
+
xml.instruct!
|
86
|
+
|
87
|
+
xml.exacttarget do |x|
|
88
|
+
x.authorization do
|
89
|
+
x.username @username
|
90
|
+
x.password @password
|
91
|
+
end
|
92
|
+
x << @system
|
93
|
+
end
|
94
|
+
|
95
|
+
data_encoded = url_encode(data)
|
96
|
+
|
97
|
+
result = 'qf=xml&xml=' + data_encoded
|
82
98
|
|
83
99
|
@url.post( @uri.path, result, @headers.merge('Content-length' => result.length.to_s) )
|
84
100
|
end
|
data/lib/rbet/list.rb
CHANGED
@@ -80,10 +80,21 @@ module RBET
|
|
80
80
|
|
81
81
|
# returns a new list object by list name
|
82
82
|
def retrieve_by_name( name )
|
83
|
-
|
84
|
-
|
83
|
+
search_type = "listname"
|
84
|
+
search_value = name
|
85
|
+
|
86
|
+
data = ""
|
87
|
+
xml = Builder::XmlMarkup.new(:target => data, :indent => 2)
|
88
|
+
xml.system do
|
89
|
+
xml.system_name "list"
|
90
|
+
xml.action "retrieve"
|
91
|
+
xml.search_type search_type
|
92
|
+
xml.search_value search_value
|
93
|
+
end
|
94
|
+
|
85
95
|
response = send do|io|
|
86
|
-
io << render_template('list_retrieve')
|
96
|
+
#io << render_template('list_retrieve')
|
97
|
+
io << data
|
87
98
|
end
|
88
99
|
Error.check_response_error(response)
|
89
100
|
load_list( response.read_body )
|
@@ -128,7 +139,7 @@ module RBET
|
|
128
139
|
io << render_template('list_send_email')
|
129
140
|
end
|
130
141
|
Error.check_response_error(response)
|
131
|
-
|
142
|
+
|
132
143
|
doc = Hpricot.XML( response.read_body )
|
133
144
|
doc.at("job_description").inner_html.to_i rescue nil
|
134
145
|
end
|
data/lib/rbet/subscriber.rb
CHANGED
@@ -85,8 +85,28 @@ module RBET
|
|
85
85
|
@email = email
|
86
86
|
@subscriber_listid = listid
|
87
87
|
@attributes = attributes
|
88
|
+
|
89
|
+
data = ""
|
90
|
+
xml = Builder::XmlMarkup.new(:target => data, :indent => 2)
|
91
|
+
xml.system do
|
92
|
+
xml.system_name "subscriber"
|
93
|
+
xml.action "add"
|
94
|
+
xml.search_type "listid"
|
95
|
+
xml.search_value @subscriber_listid
|
96
|
+
xml.search_value2 nil
|
97
|
+
xml.values do
|
98
|
+
xml.email__address @email
|
99
|
+
xml.status "active"
|
100
|
+
@attributes.each do|name,value|
|
101
|
+
eval "xml.#{name} '#{(value.is_a?(Array)) ? value.join(',') : value}'"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
106
|
+
|
88
107
|
response = send do|io|
|
89
|
-
io << render_template('subscriber_add')
|
108
|
+
# io << render_template('subscriber_add')
|
109
|
+
io << data
|
90
110
|
end
|
91
111
|
Error.check_response_error(response)
|
92
112
|
doc = Hpricot.XML(response.read_body)
|
@@ -123,7 +143,6 @@ module RBET
|
|
123
143
|
@subscriber_listid = listid
|
124
144
|
@subscriberid = subscriberid
|
125
145
|
|
126
|
-
puts render_template('subscriber_delete')
|
127
146
|
response = send do|io|
|
128
147
|
io << render_template('subscriber_delete')
|
129
148
|
end
|
@@ -131,7 +150,5 @@ module RBET
|
|
131
150
|
doc = Hpricot.XML(response.read_body)
|
132
151
|
doc.at("subscriber_info").inner_html
|
133
152
|
end
|
134
|
-
|
135
|
-
|
136
153
|
end
|
137
154
|
end
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<search_value><%= @subscriber_listid %></search_value>
|
6
6
|
<search_value2></search_value2>
|
7
7
|
<values>
|
8
|
-
<
|
8
|
+
<email__address><%= @email %></email__address>
|
9
9
|
<status>active</status>
|
10
10
|
<% @attributes.each do|name,value| %>
|
11
11
|
<<%= name %>><%= (value.is_a?(Array)) ? value.join(',') : value %></<%= name %>>
|
data/lib/rbet/version.rb
CHANGED
data/rbet.gemspec
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{rbet}
|
8
|
+
s.version = "1.0.3"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["See Contributing Section"]
|
12
|
+
s.date = %q{2010-03-07}
|
13
|
+
s.description = %q{A ruby wrapper for the Exact Target API}
|
14
|
+
s.email = %q{kevin@conceptsahead.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".gitignore",
|
22
|
+
"LICENSE",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"lib/rbet.rb",
|
27
|
+
"lib/rbet/auth.rxml",
|
28
|
+
"lib/rbet/client.rb",
|
29
|
+
"lib/rbet/error.rb",
|
30
|
+
"lib/rbet/list.rb",
|
31
|
+
"lib/rbet/list_add.rxml",
|
32
|
+
"lib/rbet/list_list_all.rxml",
|
33
|
+
"lib/rbet/list_retrieve.rxml",
|
34
|
+
"lib/rbet/list_retrieve_subscribers.rxml",
|
35
|
+
"lib/rbet/list_send_email.rxml",
|
36
|
+
"lib/rbet/ping.rxml",
|
37
|
+
"lib/rbet/renderable.rb",
|
38
|
+
"lib/rbet/subscriber.rb",
|
39
|
+
"lib/rbet/subscriber_add.rxml",
|
40
|
+
"lib/rbet/subscriber_delete.rxml",
|
41
|
+
"lib/rbet/subscriber_retrieve.rxml",
|
42
|
+
"lib/rbet/subscriber_retrieve_by_id.rxml",
|
43
|
+
"lib/rbet/subscriber_update.rxml",
|
44
|
+
"lib/rbet/tracker.rb",
|
45
|
+
"lib/rbet/tracker_retrieve_summary.rxml",
|
46
|
+
"lib/rbet/triggered_send.rb",
|
47
|
+
"lib/rbet/triggered_send.rxml",
|
48
|
+
"lib/rbet/version.rb",
|
49
|
+
"rbet.gemspec",
|
50
|
+
"test/client_test.rb",
|
51
|
+
"test/help.rb",
|
52
|
+
"test/list_test.rb",
|
53
|
+
"test/subscriber_test.rb",
|
54
|
+
"test/templates/diagnostics_ping_success.rxml",
|
55
|
+
"test/templates/list_add_failure.rxml",
|
56
|
+
"test/templates/list_add_success.rxml",
|
57
|
+
"test/templates/list_retrieve_all_success.rxml",
|
58
|
+
"test/templates/list_retrieve_bylistid_success.rxml",
|
59
|
+
"test/templates/subscriber_add_success.rxml",
|
60
|
+
"test/templates/subscriber_retrieve_failed.rxml",
|
61
|
+
"test/templates/subscriber_retrieve_success.rxml"
|
62
|
+
]
|
63
|
+
s.homepage = %q{http://github.com/n3bulous/rbet}
|
64
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
65
|
+
s.require_paths = ["lib"]
|
66
|
+
s.rubygems_version = %q{1.3.5}
|
67
|
+
s.summary = %q{A ruby wrapper for the Exact Target API}
|
68
|
+
s.test_files = [
|
69
|
+
"test/client_test.rb",
|
70
|
+
"test/help.rb",
|
71
|
+
"test/list_test.rb",
|
72
|
+
"test/subscriber_test.rb"
|
73
|
+
]
|
74
|
+
|
75
|
+
if s.respond_to? :specification_version then
|
76
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
77
|
+
s.specification_version = 3
|
78
|
+
|
79
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
80
|
+
s.add_development_dependency(%q<hpricot>, [">= 0"])
|
81
|
+
else
|
82
|
+
s.add_dependency(%q<hpricot>, [">= 0"])
|
83
|
+
end
|
84
|
+
else
|
85
|
+
s.add_dependency(%q<hpricot>, [">= 0"])
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- See Contributing Section
|
@@ -9,21 +9,36 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-03-07 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
16
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: hpricot
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
description: A ruby wrapper for the Exact Target API
|
17
26
|
email: kevin@conceptsahead.com
|
18
27
|
executables: []
|
19
28
|
|
20
29
|
extensions: []
|
21
30
|
|
22
31
|
extra_rdoc_files:
|
32
|
+
- LICENSE
|
23
33
|
- README.rdoc
|
24
34
|
files:
|
35
|
+
- .document
|
36
|
+
- .gitignore
|
37
|
+
- LICENSE
|
25
38
|
- README.rdoc
|
26
39
|
- Rakefile
|
40
|
+
- VERSION
|
41
|
+
- lib/rbet.rb
|
27
42
|
- lib/rbet/auth.rxml
|
28
43
|
- lib/rbet/client.rb
|
29
44
|
- lib/rbet/error.rb
|
@@ -46,7 +61,7 @@ files:
|
|
46
61
|
- lib/rbet/triggered_send.rb
|
47
62
|
- lib/rbet/triggered_send.rxml
|
48
63
|
- lib/rbet/version.rb
|
49
|
-
-
|
64
|
+
- rbet.gemspec
|
50
65
|
- test/client_test.rb
|
51
66
|
- test/help.rb
|
52
67
|
- test/list_test.rb
|
@@ -65,8 +80,7 @@ licenses: []
|
|
65
80
|
|
66
81
|
post_install_message:
|
67
82
|
rdoc_options:
|
68
|
-
- --
|
69
|
-
- README.rdoc
|
83
|
+
- --charset=UTF-8
|
70
84
|
require_paths:
|
71
85
|
- lib
|
72
86
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -88,5 +102,8 @@ rubygems_version: 1.3.5
|
|
88
102
|
signing_key:
|
89
103
|
specification_version: 3
|
90
104
|
summary: A ruby wrapper for the Exact Target API
|
91
|
-
test_files:
|
92
|
-
|
105
|
+
test_files:
|
106
|
+
- test/client_test.rb
|
107
|
+
- test/help.rb
|
108
|
+
- test/list_test.rb
|
109
|
+
- test/subscriber_test.rb
|