exacto_subscriber 0.2.1 → 0.2.2
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/Rakefile +2 -1
- data/VERSION +1 -1
- data/exacto_subscriber.gemspec +11 -5
- data/lib/exacto_subscriber.rb +1 -0
- data/lib/exacto_subscriber/base.rb +5 -1
- data/lib/exacto_subscriber/response_error.rb +7 -0
- data/spec/cassettes/master_list_unsubscriptions/find_existing.yml +2 -8
- data/spec/cassettes/master_list_unsubscriptions/find_nonexistent.yml +2 -8
- data/spec/exacto_subscriber/subcriber_spec.rb +20 -0
- data/spec/mock_responses/blank_response.xml +0 -0
- data/spec/mock_responses/exact_target_supplied_response_error.xml +5 -0
- metadata +28 -9
data/Rakefile
CHANGED
|
@@ -13,8 +13,9 @@ begin
|
|
|
13
13
|
gem.add_dependency "configatron", ">= 2.6.3"
|
|
14
14
|
gem.add_dependency "nokogiri", ">= 1.3.3"
|
|
15
15
|
gem.add_dependency "httparty", ">= 0.6.1"
|
|
16
|
-
gem.add_development_dependency "rspec", ">= 1.3.
|
|
16
|
+
gem.add_development_dependency "rspec", ">= 1.3.1"
|
|
17
17
|
gem.add_development_dependency "fakeweb", "1.2.8"
|
|
18
|
+
gem.add_development_dependency "mocha", "0.9.10"
|
|
18
19
|
gem.add_development_dependency "vcr", "1.0.3"
|
|
19
20
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
|
20
21
|
end
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.
|
|
1
|
+
0.2.2
|
data/exacto_subscriber.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{exacto_subscriber}
|
|
8
|
-
s.version = "0.2.
|
|
8
|
+
s.version = "0.2.2"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Dan Pickett"]
|
|
12
|
-
s.date = %q{2010-
|
|
12
|
+
s.date = %q{2010-12-13}
|
|
13
13
|
s.description = %q{Manage Exact Target List subscribers: more coming}
|
|
14
14
|
s.email = %q{dpickett@enlightsolutions.com}
|
|
15
15
|
s.extra_rdoc_files = [
|
|
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
|
|
|
32
32
|
"lib/exacto_subscriber/ext/hacked_request.rb",
|
|
33
33
|
"lib/exacto_subscriber/list_unsubscription.rb",
|
|
34
34
|
"lib/exacto_subscriber/master_list_unsubscription.rb",
|
|
35
|
+
"lib/exacto_subscriber/response_error.rb",
|
|
35
36
|
"lib/exacto_subscriber/subscriber.rb",
|
|
36
37
|
"lib/exacto_subscriber/unsubscription.rb",
|
|
37
38
|
"spec/cassettes/list_unsubscriptions/find.yml",
|
|
@@ -46,6 +47,8 @@ Gem::Specification.new do |s|
|
|
|
46
47
|
"spec/exacto_subscriber/subcriber_spec.rb",
|
|
47
48
|
"spec/exacto_subscriber/unsubscription_spec.rb",
|
|
48
49
|
"spec/exacto_subscriber_spec.rb",
|
|
50
|
+
"spec/mock_responses/blank_response.xml",
|
|
51
|
+
"spec/mock_responses/exact_target_supplied_response_error.xml",
|
|
49
52
|
"spec/spec.opts",
|
|
50
53
|
"spec/spec_helper.rb"
|
|
51
54
|
]
|
|
@@ -71,23 +74,26 @@ Gem::Specification.new do |s|
|
|
|
71
74
|
s.add_runtime_dependency(%q<configatron>, [">= 2.6.3"])
|
|
72
75
|
s.add_runtime_dependency(%q<nokogiri>, [">= 1.3.3"])
|
|
73
76
|
s.add_runtime_dependency(%q<httparty>, [">= 0.6.1"])
|
|
74
|
-
s.add_development_dependency(%q<rspec>, [">= 1.3.
|
|
77
|
+
s.add_development_dependency(%q<rspec>, [">= 1.3.1"])
|
|
75
78
|
s.add_development_dependency(%q<fakeweb>, ["= 1.2.8"])
|
|
79
|
+
s.add_development_dependency(%q<mocha>, ["= 0.9.10"])
|
|
76
80
|
s.add_development_dependency(%q<vcr>, ["= 1.0.3"])
|
|
77
81
|
else
|
|
78
82
|
s.add_dependency(%q<configatron>, [">= 2.6.3"])
|
|
79
83
|
s.add_dependency(%q<nokogiri>, [">= 1.3.3"])
|
|
80
84
|
s.add_dependency(%q<httparty>, [">= 0.6.1"])
|
|
81
|
-
s.add_dependency(%q<rspec>, [">= 1.3.
|
|
85
|
+
s.add_dependency(%q<rspec>, [">= 1.3.1"])
|
|
82
86
|
s.add_dependency(%q<fakeweb>, ["= 1.2.8"])
|
|
87
|
+
s.add_dependency(%q<mocha>, ["= 0.9.10"])
|
|
83
88
|
s.add_dependency(%q<vcr>, ["= 1.0.3"])
|
|
84
89
|
end
|
|
85
90
|
else
|
|
86
91
|
s.add_dependency(%q<configatron>, [">= 2.6.3"])
|
|
87
92
|
s.add_dependency(%q<nokogiri>, [">= 1.3.3"])
|
|
88
93
|
s.add_dependency(%q<httparty>, [">= 0.6.1"])
|
|
89
|
-
s.add_dependency(%q<rspec>, [">= 1.3.
|
|
94
|
+
s.add_dependency(%q<rspec>, [">= 1.3.1"])
|
|
90
95
|
s.add_dependency(%q<fakeweb>, ["= 1.2.8"])
|
|
96
|
+
s.add_dependency(%q<mocha>, ["= 0.9.10"])
|
|
91
97
|
s.add_dependency(%q<vcr>, ["= 1.0.3"])
|
|
92
98
|
end
|
|
93
99
|
end
|
data/lib/exacto_subscriber.rb
CHANGED
|
@@ -31,7 +31,11 @@ module Exacto
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def self.parse_response(response)
|
|
34
|
-
|
|
34
|
+
if response["exacttarget"] && response["exacttarget"]["system"]
|
|
35
|
+
raise_errors_for(response["exacttarget"]["system"][self.request_system_name])
|
|
36
|
+
else
|
|
37
|
+
raise Exacto::ResponseError.new(response.body)
|
|
38
|
+
end
|
|
35
39
|
trimmed_response = trim_response(response)
|
|
36
40
|
|
|
37
41
|
trimmed_response = trimmed_response[self.response_system_name] if trimmed_response
|
|
@@ -18,20 +18,14 @@
|
|
|
18
18
|
code: 200
|
|
19
19
|
message: OK
|
|
20
20
|
headers:
|
|
21
|
-
x-powered-by:
|
|
22
|
-
- ASP.NET
|
|
23
|
-
x-aspnet-version:
|
|
24
|
-
- 2.0.50727
|
|
25
21
|
connection:
|
|
26
22
|
- close
|
|
27
23
|
content-type:
|
|
28
24
|
- text/xml; charset=utf-8
|
|
29
|
-
server:
|
|
30
|
-
- Microsoft-IIS/6.0
|
|
31
25
|
date:
|
|
32
|
-
-
|
|
26
|
+
- Mon, 13 Dec 2010 16:51:18 GMT
|
|
33
27
|
set-cookie:
|
|
34
|
-
- ASP.NET_SessionId=
|
|
28
|
+
- ASP.NET_SessionId=cbwibcem2octoikdvhsnzoas; path=/; HttpOnly
|
|
35
29
|
cache-control:
|
|
36
30
|
- private
|
|
37
31
|
transfer-encoding:
|
|
@@ -18,20 +18,14 @@
|
|
|
18
18
|
code: 200
|
|
19
19
|
message: OK
|
|
20
20
|
headers:
|
|
21
|
-
x-powered-by:
|
|
22
|
-
- ASP.NET
|
|
23
|
-
x-aspnet-version:
|
|
24
|
-
- 2.0.50727
|
|
25
21
|
connection:
|
|
26
22
|
- close
|
|
27
23
|
content-type:
|
|
28
24
|
- text/xml; charset=utf-8
|
|
29
|
-
server:
|
|
30
|
-
- Microsoft-IIS/6.0
|
|
31
25
|
date:
|
|
32
|
-
-
|
|
26
|
+
- Mon, 13 Dec 2010 16:51:20 GMT
|
|
33
27
|
set-cookie:
|
|
34
|
-
- ASP.NET_SessionId=
|
|
28
|
+
- ASP.NET_SessionId=takoq0nzexfogma4dewdbzn2; path=/; HttpOnly
|
|
35
29
|
cache-control:
|
|
36
30
|
- private
|
|
37
31
|
transfer-encoding:
|
|
@@ -77,4 +77,24 @@ describe Exacto::Subscriber do
|
|
|
77
77
|
its(:subscriber_id) { should_not be_nil }
|
|
78
78
|
end
|
|
79
79
|
|
|
80
|
+
describe "error conditions" do
|
|
81
|
+
it 'should raise an exacto error if Exact Target returns an error' do
|
|
82
|
+
fake_response(:post, "https://www.exacttarget.com/api/integrate.asp?qf=xml",
|
|
83
|
+
read_mock_response("exact_target_supplied_response_error"))
|
|
84
|
+
lambda { subject.subscribe_to(list_id) }.should raise_error(Exacto::Error)
|
|
85
|
+
end
|
|
86
|
+
it "should raise a response error if Exact Target does not return an intended response" do
|
|
87
|
+
fake_response(:post, "https://www.exacttarget.com/api/integrate.asp?qf=xml",
|
|
88
|
+
read_mock_response("blank_response"))
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def fake_response(method, uri, body)
|
|
93
|
+
FakeWeb.register_uri(method, uri, :body => body, :content_type => "text/xml")
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
MOCK_RESPONSE_DIR = File.join(File.dirname(__FILE__), "../mock_responses")
|
|
97
|
+
def read_mock_response(base_file_name)
|
|
98
|
+
File.read(File.join(MOCK_RESPONSE_DIR, "#{base_file_name}.xml"))
|
|
99
|
+
end
|
|
80
100
|
end
|
|
File without changes
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: exacto_subscriber
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 19
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 2
|
|
9
|
-
-
|
|
10
|
-
version: 0.2.
|
|
9
|
+
- 2
|
|
10
|
+
version: 0.2.2
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Dan Pickett
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2010-
|
|
18
|
+
date: 2010-12-13 00:00:00 -05:00
|
|
19
19
|
default_executable:
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|
|
@@ -74,12 +74,12 @@ dependencies:
|
|
|
74
74
|
requirements:
|
|
75
75
|
- - ">="
|
|
76
76
|
- !ruby/object:Gem::Version
|
|
77
|
-
hash:
|
|
77
|
+
hash: 25
|
|
78
78
|
segments:
|
|
79
79
|
- 1
|
|
80
80
|
- 3
|
|
81
|
-
-
|
|
82
|
-
version: 1.3.
|
|
81
|
+
- 1
|
|
82
|
+
version: 1.3.1
|
|
83
83
|
type: :development
|
|
84
84
|
version_requirements: *id004
|
|
85
85
|
- !ruby/object:Gem::Dependency
|
|
@@ -99,9 +99,25 @@ dependencies:
|
|
|
99
99
|
type: :development
|
|
100
100
|
version_requirements: *id005
|
|
101
101
|
- !ruby/object:Gem::Dependency
|
|
102
|
-
name:
|
|
102
|
+
name: mocha
|
|
103
103
|
prerelease: false
|
|
104
104
|
requirement: &id006 !ruby/object:Gem::Requirement
|
|
105
|
+
none: false
|
|
106
|
+
requirements:
|
|
107
|
+
- - "="
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
hash: 47
|
|
110
|
+
segments:
|
|
111
|
+
- 0
|
|
112
|
+
- 9
|
|
113
|
+
- 10
|
|
114
|
+
version: 0.9.10
|
|
115
|
+
type: :development
|
|
116
|
+
version_requirements: *id006
|
|
117
|
+
- !ruby/object:Gem::Dependency
|
|
118
|
+
name: vcr
|
|
119
|
+
prerelease: false
|
|
120
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
|
105
121
|
none: false
|
|
106
122
|
requirements:
|
|
107
123
|
- - "="
|
|
@@ -113,7 +129,7 @@ dependencies:
|
|
|
113
129
|
- 3
|
|
114
130
|
version: 1.0.3
|
|
115
131
|
type: :development
|
|
116
|
-
version_requirements: *
|
|
132
|
+
version_requirements: *id007
|
|
117
133
|
description: "Manage Exact Target List subscribers: more coming"
|
|
118
134
|
email: dpickett@enlightsolutions.com
|
|
119
135
|
executables: []
|
|
@@ -139,6 +155,7 @@ files:
|
|
|
139
155
|
- lib/exacto_subscriber/ext/hacked_request.rb
|
|
140
156
|
- lib/exacto_subscriber/list_unsubscription.rb
|
|
141
157
|
- lib/exacto_subscriber/master_list_unsubscription.rb
|
|
158
|
+
- lib/exacto_subscriber/response_error.rb
|
|
142
159
|
- lib/exacto_subscriber/subscriber.rb
|
|
143
160
|
- lib/exacto_subscriber/unsubscription.rb
|
|
144
161
|
- spec/cassettes/list_unsubscriptions/find.yml
|
|
@@ -153,6 +170,8 @@ files:
|
|
|
153
170
|
- spec/exacto_subscriber/subcriber_spec.rb
|
|
154
171
|
- spec/exacto_subscriber/unsubscription_spec.rb
|
|
155
172
|
- spec/exacto_subscriber_spec.rb
|
|
173
|
+
- spec/mock_responses/blank_response.xml
|
|
174
|
+
- spec/mock_responses/exact_target_supplied_response_error.xml
|
|
156
175
|
- spec/spec.opts
|
|
157
176
|
- spec/spec_helper.rb
|
|
158
177
|
has_rdoc: true
|