exacto_subscriber 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.2.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{exacto_subscriber}
8
- s.version = "0.1.2"
8
+ s.version = "0.2.0"
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-08-23}
12
+ s.date = %q{2010-08-31}
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 = [
@@ -29,11 +29,20 @@ Gem::Specification.new do |s|
29
29
  "lib/exacto_subscriber.rb",
30
30
  "lib/exacto_subscriber/base.rb",
31
31
  "lib/exacto_subscriber/error.rb",
32
+ "lib/exacto_subscriber/ext/hacked_request.rb",
33
+ "lib/exacto_subscriber/list_unsubscription.rb",
34
+ "lib/exacto_subscriber/master_list_unsubscription.rb",
32
35
  "lib/exacto_subscriber/subscriber.rb",
36
+ "lib/exacto_subscriber/unsubscription.rb",
37
+ "spec/cassettes/list_unsubscriptions/find.yml",
38
+ "spec/cassettes/master_list_unsubscriptions/find_existing.yml",
39
+ "spec/cassettes/master_list_unsubscriptions/find_nonexistent.yml",
33
40
  "spec/cassettes/subscribers/find_by_email_and_list_id.yml",
34
41
  "spec/cassettes/subscribers/subscribe.yml",
35
42
  "spec/cassettes/subscribers/unsubscribe.yml",
36
43
  "spec/exact_target_credentials.example.yml",
44
+ "spec/exacto_subscriber/list_unsubscription_spec.rb",
45
+ "spec/exacto_subscriber/master_list_unsubscription_spec.rb",
37
46
  "spec/exacto_subscriber/subcriber_spec.rb",
38
47
  "spec/exacto_subscriber/unsubscription_spec.rb",
39
48
  "spec/exacto_subscriber_spec.rb",
@@ -46,7 +55,9 @@ Gem::Specification.new do |s|
46
55
  s.rubygems_version = %q{1.3.7}
47
56
  s.summary = %q{Manage Exact Target List subscribers}
48
57
  s.test_files = [
49
- "spec/exacto_subscriber/subcriber_spec.rb",
58
+ "spec/exacto_subscriber/list_unsubscription_spec.rb",
59
+ "spec/exacto_subscriber/master_list_unsubscription_spec.rb",
60
+ "spec/exacto_subscriber/subcriber_spec.rb",
50
61
  "spec/exacto_subscriber/unsubscription_spec.rb",
51
62
  "spec/exacto_subscriber_spec.rb",
52
63
  "spec/spec_helper.rb"
@@ -9,7 +9,7 @@ module Exacto
9
9
  self.class.issue_request(&block)
10
10
  end
11
11
 
12
- def self.issue_request(&block)
12
+ def self.issue_request(system_name = nil, &block)
13
13
  if block_given?
14
14
  builder = Nokogiri::XML::Builder.new do |xml|
15
15
  xml.exacttarget do
@@ -18,7 +18,7 @@ module Exacto
18
18
  xml.password Exacto.password
19
19
  end
20
20
  xml.system do
21
- xml.system_name system_name
21
+ xml.system_name system_name || request_system_name
22
22
  yield(xml)
23
23
  end
24
24
  end
@@ -29,14 +29,54 @@ module Exacto
29
29
  end
30
30
 
31
31
  def self.parse_response(response)
32
- trimmed_response = response["exacttarget"]["system"][self.system_name]
33
- raise_errors_for(trimmed_response)
34
- trimmed_response
32
+ raise_errors_for(response["exacttarget"]["system"][self.request_system_name])
33
+ trimmed_response = trim_response(response)
34
+
35
+ trimmed_response = trimmed_response[self.response_system_name] if trimmed_response
36
+ trimmed_response || {}
37
+ end
38
+
39
+ def self.normalize(resulting_hash)
40
+ new_hash = {}
41
+ resulting_hash.each do |key, value|
42
+ if key =~ /subid/
43
+ new_hash[:subscriber_id] = value
44
+ elsif key =~ /Email\_\_Address/
45
+ new_hash[:email_address] = value
46
+ else
47
+ new_hash[key.gsub(/\_\_/, "_").gsub(/id/, "_id").downcase.to_sym] = value
48
+ end
49
+ end
50
+
51
+ new_hash
52
+ end
53
+
54
+ def self.format_date_for_request(date)
55
+ date.strftime("%m/%d/%Y").gsub(/^0/, "").gsub(/\/0/, "\/")
56
+ end
57
+
58
+ def self.trim_response(response)
59
+ response["exacttarget"]["system"]
60
+ end
61
+
62
+ def self.request_system_name
63
+ system_name
64
+ end
65
+
66
+ def self.response_system_name
67
+ system_name
35
68
  end
36
69
 
37
70
  private
38
71
  def self.raise_errors_for(response)
39
72
  Error.from_response(response)
40
73
  end
74
+
75
+ #we need to hack HTTParty to not encode params so inject a hacked request object in this method
76
+ def perform_request(http_method, path, options) #:nodoc:
77
+ options = default_options.dup.merge(options)
78
+ process_cookies(options)
79
+ HackedRequest.new(http_method, path, options).perform
80
+ end
41
81
  end
42
82
  end
@@ -8,7 +8,7 @@ module Exacto
8
8
  end
9
9
 
10
10
  def self.from_response(response)
11
- if code = response["error"]
11
+ if response && code = response["error"]
12
12
  raise new(code, response["error_description"])
13
13
  end
14
14
  end
@@ -0,0 +1,7 @@
1
+ require "cgi"
2
+
3
+ class HackedRequest < HTTParty::Request
4
+ def body
5
+ CGI.unescape(super)
6
+ end
7
+ end
@@ -0,0 +1,37 @@
1
+ module Exacto
2
+ class ListUnsubscription < Unsubscription
3
+ def self.request_system_name
4
+ "tracking-channel"
5
+ end
6
+
7
+ def self.find(list_id)
8
+ response = issue_request("list") do |xml|
9
+ xml.action "retrieve_sub"
10
+ xml.search_type "listid"
11
+ xml.search_value list_id
12
+ xml.search_status "Unsubscribed"
13
+ end
14
+
15
+ response = [response] if response.is_a?(Hash) && !response.empty?
16
+ response.collect do |i|
17
+ new(normalize(i))
18
+ end
19
+ end
20
+
21
+ def self.response_system_name
22
+ "subscriber"
23
+ end
24
+
25
+ def self.trim_response(response)
26
+ super["list"]["subscribers"]
27
+ end
28
+
29
+ def self.request_system_name
30
+ "tracking-channel"
31
+ end
32
+
33
+ def self.response_system_name
34
+ "subscriber"
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,33 @@
1
+ module Exacto
2
+ class MasterListUnsubscription < Unsubscription
3
+ def self.find(start_date, end_date)
4
+ response = issue_request("tracking") do |xml|
5
+ xml.action "retrieve"
6
+ xml.sub_action "masterunsub"
7
+ xml.search_type ""
8
+ xml.search_value ""
9
+ xml.daterange do
10
+ xml.startdate format_date_for_request(start_date)
11
+ xml.enddate format_date_for_request(end_date)
12
+ end
13
+ end
14
+
15
+ response = [response] if response.is_a?(Hash) && !response.empty?
16
+ response.collect do |i|
17
+ new(normalize(i))
18
+ end
19
+ end
20
+
21
+ def self.trim_response(response)
22
+ super(response)["tracking"]["masterunsub"]
23
+ end
24
+
25
+ def self.request_system_name
26
+ "tracking"
27
+ end
28
+
29
+ def self.response_system_name
30
+ "subscriber"
31
+ end
32
+ end
33
+ end
@@ -1,6 +1,6 @@
1
1
  module Exacto
2
2
  class Subscriber < Exacto::Base
3
- attr_reader :email, :subscriber_id
3
+ attr_reader :email_address, :subscriber_id
4
4
  attr_accessor :list_id, :status, :attributes
5
5
 
6
6
  def initialize(options = {})
@@ -10,7 +10,7 @@ module Exacto
10
10
  def subscribe_to(list_id)
11
11
  @status = "active"
12
12
  @list_id = list_id
13
- if item = self.class.find_by_email_and_list_id(email, list_id)
13
+ if item = self.class.find_by_email_and_list_id(email_address, list_id)
14
14
  item.list_id = list_id
15
15
  item.status = @status
16
16
  item.attributes = attributes
@@ -18,12 +18,14 @@ module Exacto
18
18
  else
19
19
  create
20
20
  end
21
+
22
+ self
21
23
  end
22
24
 
23
25
  def unsubscribe_from(list_id)
24
26
  @list_id = list_id
25
27
  @status = "Unsubscribed"
26
- if item = self.class.find_by_email_and_list_id(email, list_id)
28
+ if item = self.class.find_by_email_and_list_id(email_address, list_id)
27
29
  item.list_id = list_id
28
30
  item.status = status
29
31
  item.attributes = attributes
@@ -31,6 +33,8 @@ module Exacto
31
33
  else
32
34
  create
33
35
  end
36
+
37
+ self
34
38
  end
35
39
 
36
40
  def create
@@ -49,7 +53,7 @@ module Exacto
49
53
  xml.action "edit"
50
54
  xml.search_type "listid"
51
55
  xml.search_value @list_id
52
- xml.search_value2 email
56
+ xml.search_value2 email_address
53
57
  resource_xml(xml)
54
58
  xml.update true
55
59
  end
@@ -57,7 +61,7 @@ module Exacto
57
61
 
58
62
  def resource_xml(xml)
59
63
  xml.values do
60
- xml.email__address @email
64
+ xml.email__address @email_address
61
65
  xml.status @status if @status
62
66
  (self.attributes || {}).each do |field, val|
63
67
  xml.send(field.to_s.gsub("_", "__"), val)
@@ -74,20 +78,20 @@ module Exacto
74
78
  end
75
79
 
76
80
  def update_from_options(options)
77
- @email = options[:email]
81
+ @email_address = options[:email_address]
78
82
  @status = options[:status]
79
83
  @subscriber_id = options[:subscriber_id]
80
84
  @list_id = options[:list_id]
81
85
  @attributes = options[:attributes] || {}
82
86
  end
83
87
 
84
- def self.find_by_email_and_list_id(email, list_id)
88
+ def self.find_by_email_and_list_id(email_address, list_id)
85
89
  begin
86
90
  result = issue_request do |xml|
87
91
  xml.action "retrieve"
88
92
  xml.search_type "listid"
89
93
  xml.search_value list_id
90
- xml.search_value2 email
94
+ xml.search_value2 email_address
91
95
  xml.showChannelID nil
92
96
  end
93
97
  rescue Error => e
@@ -98,22 +102,7 @@ module Exacto
98
102
  end
99
103
  end
100
104
 
101
- result.nil? ? nil : new(normalize(result))
102
- end
103
-
104
- def self.normalize(resulting_hash)
105
- new_hash = {}
106
- resulting_hash.each do |key, value|
107
- if key =~ /subid/
108
- new_hash[:subscriber_id] = value
109
- elsif key =~ /Email\_\_Address/
110
- new_hash[:email] = value
111
- else
112
- new_hash[key.gsub(/\_\_/, "_").gsub(/id/, "_id").downcase.to_sym] = value
113
- end
114
- end
115
-
116
- new_hash
105
+ result.nil? || result.empty? ? nil : new(normalize(result))
117
106
  end
118
107
 
119
108
  def self.system_name
@@ -0,0 +1,15 @@
1
+ module Exacto
2
+ class Unsubscription < Base
3
+ attr_reader :email_address, :unsubscribed_at, :status
4
+ def initialize(options = {})
5
+ @email_address = options[:email_address]
6
+ if options[:unsubscribed_at]
7
+ @unsubscribed_at = DateTime.parse(options[:unsubscribed_at])
8
+ end
9
+ end
10
+
11
+ def response_system_name
12
+ "subscriber"
13
+ end
14
+ end
15
+ end
@@ -21,7 +21,13 @@ module Exacto
21
21
  end
22
22
  end
23
23
 
24
+ require "exacto_subscriber/ext/hacked_request"
25
+
24
26
  require "exacto_subscriber/error"
25
27
  require "exacto_subscriber/base"
26
28
 
27
29
  require "exacto_subscriber/subscriber"
30
+
31
+ require "exacto_subscriber/unsubscription"
32
+ require "exacto_subscriber/list_unsubscription"
33
+ require "exacto_subscriber/master_list_unsubscription"
@@ -0,0 +1,46 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :post
5
+ uri: https://www.exacttarget.com:443/api/integrate.asp?qf=xml
6
+ body: xml=%3C%3Fxml%20version%3D%221.0%22%3F%3E%0A%3Cexacttarget%3E%0A%20%20%3Cauthorization%3E%0A%20%20%20%20%3Cusername%3E<%= CGI.escape username %>%3C%2Fusername%3E%0A%20%20%20%20%3Cpassword%3E<%= CGI.escape password %>%3C%2Fpassword%3E%0A%20%20%3C%2Fauthorization%3E%0A%20%20%3Csystem%3E%0A%20%20%20%20%3Csystem_name%3Elist%3C%2Fsystem_name%3E%0A%20%20%20%20%3Caction%3Eretrieve_sub%3C%2Faction%3E%0A%20%20%20%20%3Csearch_type%3Elistid%3C%2Fsearch_type%3E%0A%20%20%20%20%3Csearch_value%3E<%= CGI.escape list_id %>%3C%2Fsearch_value%3E%0A%20%20%20%20%3Csearch_status%3EUnsubscribed%3C%2Fsearch_status%3E%0A%20%20%3C%2Fsystem%3E%0A%3C%2Fexacttarget%3E%0A
7
+ headers:
8
+ content-type:
9
+ - application/x-www-form-urlencoded
10
+ connection:
11
+ - close
12
+ content-length:
13
+ - "612"
14
+ host:
15
+ - www.exacttarget.com
16
+ response: !ruby/struct:VCR::Response
17
+ status: !ruby/struct:VCR::ResponseStatus
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ x-powered-by:
22
+ - ASP.NET
23
+ x-aspnet-version:
24
+ - 2.0.50727
25
+ connection:
26
+ - close
27
+ content-type:
28
+ - text/xml; charset=utf-8
29
+ server:
30
+ - Microsoft-IIS/6.0
31
+ date:
32
+ - Tue, 31 Aug 2010 16:00:10 GMT
33
+ set-cookie:
34
+ - ASP.NET_SessionId=yxuywfncnj3vjcq0vzq2ryzq; path=/; HttpOnly
35
+ cache-control:
36
+ - private
37
+ transfer-encoding:
38
+ - chunked
39
+ body: |
40
+ <?xml version='1.0'?>
41
+ <exacttarget>
42
+ <system>
43
+ <list><subscribers><subscriber><id>548693262</id><Email__Address>dpickett@secondrotation.com</Email__Address><EmailType>HTML</EmailType><Status>Unsubscribed</Status><First__Name>Daniel</First__Name><Last__Name>Pickett</Last__Name><Originating__Partner /><Packing__Slip__Count>0</Packing__Slip__Count><Accepted__Transaction__Count>0</Accepted__Transaction__Count><Accepted__Transaction__Value>0</Accepted__Transaction__Value></subscriber><subscriber><id>550133036</id><Email__Address>james@secondrotation.com</Email__Address><EmailType>HTML</EmailType><Status>Unsubscribed</Status><First__Name>James</First__Name><Last__Name>McElhiney</Last__Name><Originating__Partner /><Packing__Slip__Count>0</Packing__Slip__Count><Accepted__Transaction__Count>0</Accepted__Transaction__Count><Accepted__Transaction__Value>0</Accepted__Transaction__Value></subscriber><subscriber><id>550133037</id><Email__Address>shari@secondrotation.com</Email__Address><EmailType>HTML</EmailType><Status>Unsubscribed</Status><First__Name>Shari</First__Name><Last__Name>Silvers</Last__Name><Originating__Partner /><Packing__Slip__Count>0</Packing__Slip__Count><Accepted__Transaction__Count>0</Accepted__Transaction__Count><Accepted__Transaction__Value>0</Accepted__Transaction__Value></subscriber><subscriber><id>550133043</id><Email__Address>wai@secondrotation.com</Email__Address><EmailType>HTML</EmailType><Status>Unsubscribed</Status><First__Name>Wai</First__Name><Last__Name>Cheng</Last__Name><Originating__Partner /><Packing__Slip__Count>0</Packing__Slip__Count><Accepted__Transaction__Count>0</Accepted__Transaction__Count><Accepted__Transaction__Value>0</Accepted__Transaction__Value></subscriber><subscriber><id>550133044</id><Email__Address>ex-rousseau@secondrotation.com</Email__Address><EmailType>HTML</EmailType><Status>Unsubscribed</Status><First__Name>Rousseau</First__Name><Last__Name>Aurelien</Last__Name><Originating__Partner /><Packing__Slip__Count>0</Packing__Slip__Count><Accepted__Transaction__Count>0</Accepted__Transaction__Count><Accepted__Transaction__Value>0</Accepted__Transaction__Value></subscriber><subscriber><id>550133073</id><Email__Address>demo@secondrotation.com</Email__Address><EmailType>HTML</EmailType><Status>Unsubscribed</Status><First__Name>Demo</First__Name><Last__Name>Account</Last__Name><Originating__Partner /><Packing__Slip__Count>0</Packing__Slip__Count><Accepted__Transaction__Count>0</Accepted__Transaction__Count><Accepted__Transaction__Value>0</Accepted__Transaction__Value></subscriber><subscriber><id>550133084</id><Email__Address>email-1076@example.com</Email__Address><EmailType>HTML</EmailType><Status>Unsubscribed</Status><First__Name>Anthony</First__Name><Last__Name>Lee</Last__Name><Originating__Partner>gazelle</Originating__Partner><Packing__Slip__Count>1</Packing__Slip__Count><Accepted__Transaction__Count>0</Accepted__Transaction__Count><Accepted__Transaction__Value>0</Accepted__Transaction__Value></subscriber><subscriber><id>550133104</id><Email__Address>lilith@secondrotation.com</Email__Address><EmailType>HTML</EmailType><Status>Unsubscribed</Status><First__Name>Lilith</First__Name><Last__Name>Arthur</Last__Name><Originating__Partner>gazelle</Originating__Partner><Packing__Slip__Count>1</Packing__Slip__Count><Accepted__Transaction__Count>0</Accepted__Transaction__Count><Accepted__Transaction__Value>0</Accepted__Transaction__Value></subscriber><subscriber><id>550133106</id><Email__Address>++donna@secondrotation.com</Email__Address><EmailType>HTML</EmailType><Status>Unsubscribed</Status><First__Name>Donna</First__Name><Last__Name>Le</Last__Name><Originating__Partner /><Packing__Slip__Count>0</Packing__Slip__Count><Accepted__Transaction__Count>0</Accepted__Transaction__Count><Accepted__Transaction__Value>0</Accepted__Transaction__Value></subscriber><subscriber><id>550133120</id><Email__Address>email-2063@example.com</Email__Address><EmailType>HTML</EmailType><Status>Unsubscribed</Status><First__Name>Anna</First__Name><Last__Name>Butler</Last__Name><Originating__Partner>gazelle</Originating__Partner><Packing__Slip__Count>2</Packing__Slip__Count><Accepted__Transaction__Count>1</Accepted__Transaction__Count><Accepted__Transaction__Value>122.099998474121</Accepted__Transaction__Value></subscriber><subscriber><id>550133226</id><Email__Address>email-2630@example.com</Email__Address><EmailType>HTML</EmailType><Status>Unsubscribed</Status><First__Name>Jeffrey</First__Name><Last__Name>Cooper</Last__Name><Originating__Partner>gazelle</Originating__Partner><Packing__Slip__Count>1</Packing__Slip__Count><Accepted__Transaction__Count>0</Accepted__Transaction__Count><Accepted__Transaction__Value>0</Accepted__Transaction__Value></subscriber><subscriber><id>550133271</id><Email__Address>thos@secondrotation.com</Email__Address><EmailType>HTML</EmailType><Status>Unsubscribed</Status><First__Name>Thos</First__Name><Last__Name>Niles</Last__Name><Originating__Partner>gazelle</Originating__Partner><Packing__Slip__Count>1</Packing__Slip__Count><Accepted__Transaction__Count>0</Accepted__Transaction__Count><Accepted__Transaction__Value>0</Accepted__Transaction__Value></subscriber><subscriber><id>550133272</id><Email__Address>email-3521@example.com</Email__Address><EmailType>HTML</EmailType><Status>Unsubscribed</Status><First__Name>Raymond</First__Name><Last__Name>Sanders</Last__Name><Originating__Partner>gazelle</Originating__Partner><Packing__Slip__Count>1</Packing__Slip__Count><Accepted__Transaction__Count>0</Accepted__Transaction__Count><Accepted__Transaction__Value>0</Accepted__Transaction__Value></subscriber><subscriber><id>550133289</id><Email__Address>email-3911@example.com</Email__Address><EmailType>HTML</EmailType><Status>Unsubscribed</Status><First__Name>Mary</First__Name><Last__Name>Baker</Last__Name><Originating__Partner>gazelle</Originating__Partner><Packing__Slip__Count>1</Packing__Slip__Count><Accepted__Transaction__Count>0</Accepted__Transaction__Count><Accepted__Transaction__Value>0</Accepted__Transaction__Value></subscriber><subscriber><id>550133316</id><Email__Address>email-4639@example.com</Email__Address><EmailType>HTML</EmailType><Status>Unsubscribed</Status><First__Name>Timothy</First__Name><Last__Name>Evans</Last__Name><Originating__Partner>gazelle</Originating__Partner><Packing__Slip__Count>2</Packing__Slip__Count><Accepted__Transaction__Count>0</Accepted__Transaction__Count><Accepted__Transaction__Value>0</Accepted__Transaction__Value></subscriber></subscribers></list></system>
44
+ </exacttarget>
45
+
46
+ http_version: "1.1"
@@ -0,0 +1,54 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :post
5
+ uri: https://www.exacttarget.com:443/api/integrate.asp?qf=xml
6
+ body: xml=%3C%3Fxml%20version%3D%221.0%22%3F%3E%0A%3Cexacttarget%3E%0A%20%20%3Cauthorization%3E%0A%20%20%20%20%3Cusername%3E<%= CGI.escape username %>%3C%2Fusername%3E%0A%20%20%20%20%3Cpassword%3E<%= CGI.escape password %>%3C%2Fpassword%3E%0A%20%20%3C%2Fauthorization%3E%0A%20%20%3Csystem%3E%0A%20%20%20%20%3Csystem_name%3Etracking%3C%2Fsystem_name%3E%0A%20%20%20%20%3Caction%3Eretrieve%3C%2Faction%3E%0A%20%20%20%20%3Csub_action%3Emasterunsub%3C%2Fsub_action%3E%0A%20%20%20%20%3Csearch_type%3E%3C%2Fsearch_type%3E%0A%20%20%20%20%3Csearch_value%3E%3C%2Fsearch_value%3E%0A%20%20%20%20%3Cdaterange%3E%0A%20%20%20%20%20%20%3Cstartdate%3E8%2F1%2F2010%3C%2Fstartdate%3E%0A%20%20%20%20%20%20%3Cenddate%3E9%2F1%2F2010%3C%2Fenddate%3E%0A%20%20%20%20%3C%2Fdaterange%3E%0A%20%20%3C%2Fsystem%3E%0A%3C%2Fexacttarget%3E%0A
7
+ headers:
8
+ content-type:
9
+ - application/x-www-form-urlencoded
10
+ connection:
11
+ - close
12
+ content-length:
13
+ - "782"
14
+ host:
15
+ - www.exacttarget.com
16
+ response: !ruby/struct:VCR::Response
17
+ status: !ruby/struct:VCR::ResponseStatus
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ x-powered-by:
22
+ - ASP.NET
23
+ x-aspnet-version:
24
+ - 2.0.50727
25
+ connection:
26
+ - close
27
+ content-type:
28
+ - text/xml; charset=utf-8
29
+ server:
30
+ - Microsoft-IIS/6.0
31
+ date:
32
+ - Tue, 31 Aug 2010 16:03:07 GMT
33
+ set-cookie:
34
+ - ASP.NET_SessionId=f0jwbg55z5yeom55t0moaojx; path=/; HttpOnly
35
+ cache-control:
36
+ - private
37
+ transfer-encoding:
38
+ - chunked
39
+ body: |
40
+ <?xml version='1.0'?>
41
+ <exacttarget>
42
+ <system>
43
+ <tracking>
44
+ <masterunsub><subscriber>
45
+ <email_address>wai@secondrotation.com</email_address>
46
+ <name/>
47
+ <reason>Unsubscribed from list details on subscriber properties dialog.</reason>
48
+ <unsub_date_time>8/31/2010 8:50:00 AM</unsub_date_time>
49
+ </subscriber>
50
+ </masterunsub></tracking>
51
+ </system>
52
+ </exacttarget>
53
+
54
+ http_version: "1.1"
@@ -0,0 +1,49 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :post
5
+ uri: https://www.exacttarget.com:443/api/integrate.asp?qf=xml
6
+ body: xml=%3C%3Fxml%20version%3D%221.0%22%3F%3E%0A%3Cexacttarget%3E%0A%20%20%3Cauthorization%3E%0A%20%20%20%20%3Cusername%3E<%= CGI.escape username %>%3C%2Fusername%3E%0A%20%20%20%20%3Cpassword%3E<%= CGI.escape password %>%3C%2Fpassword%3E%0A%20%20%3C%2Fauthorization%3E%0A%20%20%3Csystem%3E%0A%20%20%20%20%3Csystem_name%3Etracking%3C%2Fsystem_name%3E%0A%20%20%20%20%3Caction%3Eretrieve%3C%2Faction%3E%0A%20%20%20%20%3Csub_action%3Emasterunsub%3C%2Fsub_action%3E%0A%20%20%20%20%3Csearch_type%3E%3C%2Fsearch_type%3E%0A%20%20%20%20%3Csearch_value%3E%3C%2Fsearch_value%3E%0A%20%20%20%20%3Cdaterange%3E%0A%20%20%20%20%20%20%3Cstartdate%3E8%2F1%2F2010%3C%2Fstartdate%3E%0A%20%20%20%20%20%20%3Cenddate%3E8%2F1%2F2010%3C%2Fenddate%3E%0A%20%20%20%20%3C%2Fdaterange%3E%0A%20%20%3C%2Fsystem%3E%0A%3C%2Fexacttarget%3E%0A
7
+ headers:
8
+ content-type:
9
+ - application/x-www-form-urlencoded
10
+ connection:
11
+ - close
12
+ content-length:
13
+ - "782"
14
+ host:
15
+ - www.exacttarget.com
16
+ response: !ruby/struct:VCR::Response
17
+ status: !ruby/struct:VCR::ResponseStatus
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ x-powered-by:
22
+ - ASP.NET
23
+ x-aspnet-version:
24
+ - 2.0.50727
25
+ connection:
26
+ - close
27
+ content-type:
28
+ - text/xml; charset=utf-8
29
+ server:
30
+ - Microsoft-IIS/6.0
31
+ date:
32
+ - Tue, 31 Aug 2010 16:03:08 GMT
33
+ set-cookie:
34
+ - ASP.NET_SessionId=ucgyrv451ub3sw55feopvnqq; path=/; HttpOnly
35
+ cache-control:
36
+ - private
37
+ transfer-encoding:
38
+ - chunked
39
+ body: |
40
+ <?xml version='1.0'?>
41
+ <exacttarget>
42
+ <system>
43
+ <tracking>
44
+ <masterunsub><nosubs>No subscriber were found with the masterunsub status</nosubs>
45
+ </masterunsub></tracking>
46
+ </system>
47
+ </exacttarget>
48
+
49
+ http_version: "1.1"
@@ -29,9 +29,9 @@
29
29
  server:
30
30
  - Microsoft-IIS/6.0
31
31
  date:
32
- - Fri, 20 Aug 2010 14:29:41 GMT
32
+ - Tue, 31 Aug 2010 16:00:23 GMT
33
33
  set-cookie:
34
- - ASP.NET_SessionId=oa3lbb22zyp5onrnbrbik5vc; path=/; HttpOnly
34
+ - ASP.NET_SessionId=vuvotub2esmgkwnejx42mdnt; path=/; HttpOnly
35
35
  cache-control:
36
36
  - private
37
37
  transfer-encoding:
@@ -40,7 +40,142 @@
40
40
  <?xml version='1.0'?>
41
41
  <exacttarget>
42
42
  <system>
43
- <subscriber><subid>548749517</subid><listid><%= CGI.escape list_id %></listid><list_name>Development - master</list_name><Full__Name /><Email__Address>user3@example.com</Email__Address><User__Defined /><Email__Type>HTML</Email__Type><Status>Unsubscribed</Status><First__Name>John</First__Name><Last__Name>Smith</Last__Name><Packing__Slip__Count /><Originating__Partner /></subscriber></system>
43
+ <subscriber><subid>548749517</subid><listid><%= CGI.escape list_id %></listid><list_name>Development - master</list_name><Email__Address>user3@example.com</Email__Address><Email__Type>HTML</Email__Type><Status>Unsubscribed</Status><First__Name>John</First__Name><Last__Name>Smith</Last__Name><Originating__Partner /><Packing__Slip__Count>NaN</Packing__Slip__Count><Accepted__Transaction__Count>NaN</Accepted__Transaction__Count><Accepted__Transaction__Value>NaN</Accepted__Transaction__Value></subscriber></system>
44
+ </exacttarget>
45
+
46
+ http_version: "1.1"
47
+ - !ruby/struct:VCR::HTTPInteraction
48
+ request: !ruby/struct:VCR::Request
49
+ method: :post
50
+ uri: https://www.exacttarget.com:443/api/integrate.asp?qf=xml
51
+ body: xml=%3C%3Fxml%20version%3D%221.0%22%3F%3E%0A%3Cexacttarget%3E%0A%20%20%3Cauthorization%3E%0A%20%20%20%20%3Cusername%3E<%= CGI.escape username %>%3C%2Fusername%3E%0A%20%20%20%20%3Cpassword%3E<%= CGI.escape password %>%3C%2Fpassword%3E%0A%20%20%3C%2Fauthorization%3E%0A%20%20%3Csystem%3E%0A%20%20%20%20%3Csystem_name%3Esubscriber%3C%2Fsystem_name%3E%0A%20%20%20%20%3Caction%3Eedit%3C%2Faction%3E%0A%20%20%20%20%3Csearch_type%3Elistid%3C%2Fsearch_type%3E%0A%20%20%20%20%3Csearch_value%3E<%= CGI.escape list_id %>%3C%2Fsearch_value%3E%0A%20%20%20%20%3Csearch_value2%3Euser3%40example.com%3C%2Fsearch_value2%3E%0A%20%20%20%20%3Cvalues%3E%0A%20%20%20%20%20%20%3Cemail__address%3Euser3%40example.com%3C%2Femail__address%3E%0A%20%20%20%20%20%20%3Cstatus%3Eactive%3C%2Fstatus%3E%0A%20%20%20%20%20%20%3CLast____Name%3ESmith%3C%2FLast____Name%3E%0A%20%20%20%20%20%20%3CFirst____Name%3EJohn%3C%2FFirst____Name%3E%0A%20%20%20%20%3C%2Fvalues%3E%0A%20%20%20%20%3Cupdate%3Etrue%3C%2Fupdate%3E%0A%20%20%3C%2Fsystem%3E%0A%3C%2Fexacttarget%3E%0A
52
+ headers:
53
+ content-type:
54
+ - application/x-www-form-urlencoded
55
+ connection:
56
+ - close
57
+ content-length:
58
+ - "988"
59
+ host:
60
+ - www.exacttarget.com
61
+ response: !ruby/struct:VCR::Response
62
+ status: !ruby/struct:VCR::ResponseStatus
63
+ code: 200
64
+ message: OK
65
+ headers:
66
+ x-powered-by:
67
+ - ASP.NET
68
+ x-aspnet-version:
69
+ - 2.0.50727
70
+ connection:
71
+ - close
72
+ content-type:
73
+ - text/xml; charset=utf-8
74
+ server:
75
+ - Microsoft-IIS/6.0
76
+ date:
77
+ - Tue, 31 Aug 2010 16:00:24 GMT
78
+ set-cookie:
79
+ - ASP.NET_SessionId=rbry3y55m3wyamfe441wgw45; path=/; HttpOnly
80
+ cache-control:
81
+ - private
82
+ transfer-encoding:
83
+ - chunked
84
+ body: |
85
+ <?xml version='1.0'?>
86
+ <exacttarget>
87
+ <system>
88
+ <subscriber><subscriber_info>Subscriber was added/updated successfully</subscriber_info><subscriber_description>548749517</subscriber_description></subscriber></system>
89
+ </exacttarget>
90
+
91
+ http_version: "1.1"
92
+ - !ruby/struct:VCR::HTTPInteraction
93
+ request: !ruby/struct:VCR::Request
94
+ method: :post
95
+ uri: https://www.exacttarget.com:443/api/integrate.asp?qf=xml
96
+ body: xml=%3C%3Fxml%20version%3D%221.0%22%3F%3E%0A%3Cexacttarget%3E%0A%20%20%3Cauthorization%3E%0A%20%20%20%20%3Cusername%3E<%= CGI.escape username %>%3C%2Fusername%3E%0A%20%20%20%20%3Cpassword%3E<%= CGI.escape password %>%3C%2Fpassword%3E%0A%20%20%3C%2Fauthorization%3E%0A%20%20%3Csystem%3E%0A%20%20%20%20%3Csystem_name%3Esubscriber%3C%2Fsystem_name%3E%0A%20%20%20%20%3Caction%3Eretrieve%3C%2Faction%3E%0A%20%20%20%20%3Csearch_type%3Elistid%3C%2Fsearch_type%3E%0A%20%20%20%20%3Csearch_value%3E<%= CGI.escape list_id %>%3C%2Fsearch_value%3E%0A%20%20%20%20%3Csearch_value2%3Euser3%40example.com%3C%2Fsearch_value2%3E%0A%20%20%20%20%3CshowChannelID%3E%3C%2FshowChannelID%3E%0A%20%20%3C%2Fsystem%3E%0A%3C%2Fexacttarget%3E%0A
97
+ headers:
98
+ content-type:
99
+ - application/x-www-form-urlencoded
100
+ connection:
101
+ - close
102
+ content-length:
103
+ - "677"
104
+ host:
105
+ - www.exacttarget.com
106
+ response: !ruby/struct:VCR::Response
107
+ status: !ruby/struct:VCR::ResponseStatus
108
+ code: 200
109
+ message: OK
110
+ headers:
111
+ x-powered-by:
112
+ - ASP.NET
113
+ x-aspnet-version:
114
+ - 2.0.50727
115
+ connection:
116
+ - close
117
+ content-type:
118
+ - text/xml; charset=utf-8
119
+ server:
120
+ - Microsoft-IIS/6.0
121
+ date:
122
+ - Tue, 31 Aug 2010 16:00:26 GMT
123
+ set-cookie:
124
+ - ASP.NET_SessionId=gb41nx452pji1ejnl5cqof45; path=/; HttpOnly
125
+ cache-control:
126
+ - private
127
+ transfer-encoding:
128
+ - chunked
129
+ body: |
130
+ <?xml version='1.0'?>
131
+ <exacttarget>
132
+ <system>
133
+ <subscriber><subid>548749517</subid><listid><%= CGI.escape list_id %></listid><list_name>Development - master</list_name><Email__Address>user3@example.com</Email__Address><Email__Type>HTML</Email__Type><Status>Active</Status><First__Name>John</First__Name><Last__Name>Smith</Last__Name><Originating__Partner /><Packing__Slip__Count>NaN</Packing__Slip__Count><Accepted__Transaction__Count>NaN</Accepted__Transaction__Count><Accepted__Transaction__Value>NaN</Accepted__Transaction__Value></subscriber></system>
134
+ </exacttarget>
135
+
136
+ http_version: "1.1"
137
+ - !ruby/struct:VCR::HTTPInteraction
138
+ request: !ruby/struct:VCR::Request
139
+ method: :post
140
+ uri: https://www.exacttarget.com:443/api/integrate.asp?qf=xml
141
+ body: xml=%3C%3Fxml%20version%3D%221.0%22%3F%3E%0A%3Cexacttarget%3E%0A%20%20%3Cauthorization%3E%0A%20%20%20%20%3Cusername%3E<%= CGI.escape username %>%3C%2Fusername%3E%0A%20%20%20%20%3Cpassword%3E<%= CGI.escape password %>%3C%2Fpassword%3E%0A%20%20%3C%2Fauthorization%3E%0A%20%20%3Csystem%3E%0A%20%20%20%20%3Csystem_name%3Esubscriber%3C%2Fsystem_name%3E%0A%20%20%20%20%3Caction%3Edelete%3C%2Faction%3E%0A%20%20%20%20%3Csearch_type%3Esubid%3C%2Fsearch_type%3E%0A%20%20%20%20%3Csearch_value%3E548749517%3C%2Fsearch_value%3E%0A%20%20%3C%2Fsystem%3E%0A%3C%2Fexacttarget%3E%0A
142
+ headers:
143
+ content-type:
144
+ - application/x-www-form-urlencoded
145
+ connection:
146
+ - close
147
+ content-length:
148
+ - "544"
149
+ host:
150
+ - www.exacttarget.com
151
+ response: !ruby/struct:VCR::Response
152
+ status: !ruby/struct:VCR::ResponseStatus
153
+ code: 200
154
+ message: OK
155
+ headers:
156
+ x-powered-by:
157
+ - ASP.NET
158
+ x-aspnet-version:
159
+ - 2.0.50727
160
+ connection:
161
+ - close
162
+ content-type:
163
+ - text/xml; charset=utf-8
164
+ server:
165
+ - Microsoft-IIS/6.0
166
+ date:
167
+ - Tue, 31 Aug 2010 16:00:26 GMT
168
+ set-cookie:
169
+ - ASP.NET_SessionId=1slfie552ajfzfbhec3dbf55; path=/; HttpOnly
170
+ cache-control:
171
+ - private
172
+ transfer-encoding:
173
+ - chunked
174
+ body: |
175
+ <?xml version='1.0'?>
176
+ <exacttarget>
177
+ <system>
178
+ <subscriber><subscriber_info>Subscriber Deleted Sucessfully!</subscriber_info></subscriber></system>
44
179
  </exacttarget>
45
180
 
46
181
  http_version: "1.1"
@@ -29,9 +29,9 @@
29
29
  server:
30
30
  - Microsoft-IIS/6.0
31
31
  date:
32
- - Fri, 20 Aug 2010 14:29:34 GMT
32
+ - Tue, 31 Aug 2010 16:00:14 GMT
33
33
  set-cookie:
34
- - ASP.NET_SessionId=eqze3nnlq5i4nmr5ljpm1f3y; path=/; HttpOnly
34
+ - ASP.NET_SessionId=q2bhxzzzuh1ihx45vulf1x55; path=/; HttpOnly
35
35
  cache-control:
36
36
  - private
37
37
  transfer-encoding:
@@ -40,52 +40,7 @@
40
40
  <?xml version='1.0'?>
41
41
  <exacttarget>
42
42
  <system>
43
- <subscriber><subid>548749517</subid><listid><%= CGI.escape list_id %></listid><list_name>Development - master</list_name><Full__Name /><Email__Address>user3@example.com</Email__Address><User__Defined /><Email__Type>HTML</Email__Type><Status>Unsubscribed</Status><First__Name>John</First__Name><Last__Name>Smith</Last__Name><Packing__Slip__Count /><Originating__Partner /></subscriber></system>
44
- </exacttarget>
45
-
46
- http_version: "1.1"
47
- - !ruby/struct:VCR::HTTPInteraction
48
- request: !ruby/struct:VCR::Request
49
- method: :post
50
- uri: https://www.exacttarget.com:443/api/integrate.asp?qf=xml
51
- body: xml=%3C%3Fxml%20version%3D%221.0%22%3F%3E%0A%3Cexacttarget%3E%0A%20%20%3Cauthorization%3E%0A%20%20%20%20%3Cusername%3E<%= CGI.escape username %>%3C%2Fusername%3E%0A%20%20%20%20%3Cpassword%3E<%= CGI.escape password %>%3C%2Fpassword%3E%0A%20%20%3C%2Fauthorization%3E%0A%20%20%3Csystem%3E%0A%20%20%20%20%3Csystem_name%3Esubscriber%3C%2Fsystem_name%3E%0A%20%20%20%20%3Caction%3Edelete%3C%2Faction%3E%0A%20%20%20%20%3Csearch_type%3Esubid%3C%2Fsearch_type%3E%0A%20%20%20%20%3Csearch_value%3E548749517%3C%2Fsearch_value%3E%0A%20%20%3C%2Fsystem%3E%0A%3C%2Fexacttarget%3E%0A
52
- headers:
53
- content-type:
54
- - application/x-www-form-urlencoded
55
- connection:
56
- - close
57
- content-length:
58
- - "544"
59
- host:
60
- - www.exacttarget.com
61
- response: !ruby/struct:VCR::Response
62
- status: !ruby/struct:VCR::ResponseStatus
63
- code: 200
64
- message: OK
65
- headers:
66
- x-powered-by:
67
- - ASP.NET
68
- x-aspnet-version:
69
- - 2.0.50727
70
- connection:
71
- - close
72
- content-type:
73
- - text/xml; charset=utf-8
74
- server:
75
- - Microsoft-IIS/6.0
76
- date:
77
- - Fri, 20 Aug 2010 14:29:34 GMT
78
- set-cookie:
79
- - ASP.NET_SessionId=boqm3d55gvcl4z45fwuacdq1; path=/; HttpOnly
80
- cache-control:
81
- - private
82
- transfer-encoding:
83
- - chunked
84
- body: |
85
- <?xml version='1.0'?>
86
- <exacttarget>
87
- <system>
88
- <subscriber><subscriber_info>Subscriber Deleted Sucessfully!</subscriber_info></subscriber></system>
43
+ <subscriber><error>1</error><error_description>Subscriber not found with ListID = <%= CGI.escape list_id %> Email Address = user3@example.com</error_description></subscriber></system>
89
44
  </exacttarget>
90
45
 
91
46
  http_version: "1.1"
@@ -119,9 +74,9 @@
119
74
  server:
120
75
  - Microsoft-IIS/6.0
121
76
  date:
122
- - Fri, 20 Aug 2010 14:29:35 GMT
77
+ - Tue, 31 Aug 2010 16:00:15 GMT
123
78
  set-cookie:
124
- - ASP.NET_SessionId=zl1tid55urbgqvzfizr2jn55; path=/; HttpOnly
79
+ - ASP.NET_SessionId=eaxyxx55ykdp3bmmvzu32gjd; path=/; HttpOnly
125
80
  cache-control:
126
81
  - private
127
82
  transfer-encoding:
@@ -138,14 +93,14 @@
138
93
  request: !ruby/struct:VCR::Request
139
94
  method: :post
140
95
  uri: https://www.exacttarget.com:443/api/integrate.asp?qf=xml
141
- body: xml=%3C%3Fxml%20version%3D%221.0%22%3F%3E%0A%3Cexacttarget%3E%0A%20%20%3Cauthorization%3E%0A%20%20%20%20%3Cusername%3E<%= CGI.escape username %>%3C%2Fusername%3E%0A%20%20%20%20%3Cpassword%3E<%= CGI.escape password %>%3C%2Fpassword%3E%0A%20%20%3C%2Fauthorization%3E%0A%20%20%3Csystem%3E%0A%20%20%20%20%3Csystem_name%3Esubscriber%3C%2Fsystem_name%3E%0A%20%20%20%20%3Caction%3Eadd%3C%2Faction%3E%0A%20%20%20%20%3Csearch_type%3Elistid%3C%2Fsearch_type%3E%0A%20%20%20%20%3Csearch_value%3E<%= CGI.escape list_id %>%3C%2Fsearch_value%3E%0A%20%20%20%20%3Csearch_value2%3E%3C%2Fsearch_value2%3E%0A%20%20%20%20%3Cvalues%3E%0A%20%20%20%20%20%20%3Cemail__address%3Euser3%40example.com%3C%2Femail__address%3E%0A%20%20%20%20%20%20%3Cstatus%3Eactive%3C%2Fstatus%3E%0A%20%20%20%20%20%20%3CLast__Name%3ESmith%3C%2FLast__Name%3E%0A%20%20%20%20%20%20%3CFirst__Name%3EJohn%3C%2FFirst__Name%3E%0A%20%20%20%20%3C%2Fvalues%3E%0A%20%20%3C%2Fsystem%3E%0A%3C%2Fexacttarget%3E%0A
96
+ body: xml=%3C%3Fxml%20version%3D%221.0%22%3F%3E%0A%3Cexacttarget%3E%0A%20%20%3Cauthorization%3E%0A%20%20%20%20%3Cusername%3E<%= CGI.escape username %>%3C%2Fusername%3E%0A%20%20%20%20%3Cpassword%3E<%= CGI.escape password %>%3C%2Fpassword%3E%0A%20%20%3C%2Fauthorization%3E%0A%20%20%3Csystem%3E%0A%20%20%20%20%3Csystem_name%3Esubscriber%3C%2Fsystem_name%3E%0A%20%20%20%20%3Caction%3Eadd%3C%2Faction%3E%0A%20%20%20%20%3Csearch_type%3Elistid%3C%2Fsearch_type%3E%0A%20%20%20%20%3Csearch_value%3E<%= CGI.escape list_id %>%3C%2Fsearch_value%3E%0A%20%20%20%20%3Csearch_value2%3E%3C%2Fsearch_value2%3E%0A%20%20%20%20%3Cvalues%3E%0A%20%20%20%20%20%20%3Cemail__address%3Euser3%40example.com%3C%2Femail__address%3E%0A%20%20%20%20%20%20%3Cstatus%3Eactive%3C%2Fstatus%3E%0A%20%20%20%20%20%20%3CLast____Name%3ESmith%3C%2FLast____Name%3E%0A%20%20%20%20%20%20%3CFirst____Name%3EJohn%3C%2FFirst____Name%3E%0A%20%20%20%20%3C%2Fvalues%3E%0A%20%20%3C%2Fsystem%3E%0A%3C%2Fexacttarget%3E%0A
142
97
  headers:
143
98
  content-type:
144
99
  - application/x-www-form-urlencoded
145
100
  connection:
146
101
  - close
147
102
  content-length:
148
- - "914"
103
+ - "922"
149
104
  host:
150
105
  - www.exacttarget.com
151
106
  response: !ruby/struct:VCR::Response
@@ -164,9 +119,9 @@
164
119
  server:
165
120
  - Microsoft-IIS/6.0
166
121
  date:
167
- - Fri, 20 Aug 2010 14:29:35 GMT
122
+ - Tue, 31 Aug 2010 16:00:17 GMT
168
123
  set-cookie:
169
- - ASP.NET_SessionId=2md1yivdzxvulsudaxk0xz55; path=/; HttpOnly
124
+ - ASP.NET_SessionId=ibxgga550dkk5tqqehyilc55; path=/; HttpOnly
170
125
  cache-control:
171
126
  - private
172
127
  transfer-encoding:
@@ -29,9 +29,9 @@
29
29
  server:
30
30
  - Microsoft-IIS/6.0
31
31
  date:
32
- - Fri, 20 Aug 2010 14:29:37 GMT
32
+ - Tue, 31 Aug 2010 16:00:17 GMT
33
33
  set-cookie:
34
- - ASP.NET_SessionId=dpxpqhbwps5xyounbg2llx45; path=/; HttpOnly
34
+ - ASP.NET_SessionId=xfbokdmxxjhjbmrnzh5jjq45; path=/; HttpOnly
35
35
  cache-control:
36
36
  - private
37
37
  transfer-encoding:
@@ -40,7 +40,7 @@
40
40
  <?xml version='1.0'?>
41
41
  <exacttarget>
42
42
  <system>
43
- <subscriber><subid>548749517</subid><listid><%= CGI.escape list_id %></listid><list_name>Development - master</list_name><Full__Name /><Email__Address>user3@example.com</Email__Address><User__Defined /><Email__Type>HTML</Email__Type><Status>Active</Status><First__Name>John</First__Name><Last__Name>Smith</Last__Name><Packing__Slip__Count /><Originating__Partner /></subscriber></system>
43
+ <subscriber><subid>548749517</subid><listid><%= CGI.escape list_id %></listid><list_name>Development - master</list_name><Email__Address>user3@example.com</Email__Address><Email__Type>HTML</Email__Type><Status>Active</Status><First__Name>John</First__Name><Last__Name>Smith</Last__Name><Originating__Partner /><Packing__Slip__Count>NaN</Packing__Slip__Count><Accepted__Transaction__Count>NaN</Accepted__Transaction__Count><Accepted__Transaction__Value>NaN</Accepted__Transaction__Value></subscriber></system>
44
44
  </exacttarget>
45
45
 
46
46
  http_version: "1.1"
@@ -74,9 +74,9 @@
74
74
  server:
75
75
  - Microsoft-IIS/6.0
76
76
  date:
77
- - Fri, 20 Aug 2010 14:29:37 GMT
77
+ - Tue, 31 Aug 2010 16:00:19 GMT
78
78
  set-cookie:
79
- - ASP.NET_SessionId=0h12lrmfqvvr3s55lyfy0kqc; path=/; HttpOnly
79
+ - ASP.NET_SessionId=k3ung0bkprsgif55kfslwa3m; path=/; HttpOnly
80
80
  cache-control:
81
81
  - private
82
82
  transfer-encoding:
@@ -119,9 +119,9 @@
119
119
  server:
120
120
  - Microsoft-IIS/6.0
121
121
  date:
122
- - Fri, 20 Aug 2010 14:29:39 GMT
122
+ - Tue, 31 Aug 2010 16:00:20 GMT
123
123
  set-cookie:
124
- - ASP.NET_SessionId=dovlhm4534gpkqyxzk3veqm1; path=/; HttpOnly
124
+ - ASP.NET_SessionId=vigan255jwobvlyfsqwls055; path=/; HttpOnly
125
125
  cache-control:
126
126
  - private
127
127
  transfer-encoding:
@@ -138,14 +138,14 @@
138
138
  request: !ruby/struct:VCR::Request
139
139
  method: :post
140
140
  uri: https://www.exacttarget.com:443/api/integrate.asp?qf=xml
141
- body: xml=%3C%3Fxml%20version%3D%221.0%22%3F%3E%0A%3Cexacttarget%3E%0A%20%20%3Cauthorization%3E%0A%20%20%20%20%3Cusername%3E<%= CGI.escape username %>%3C%2Fusername%3E%0A%20%20%20%20%3Cpassword%3E<%= CGI.escape password %>%3C%2Fpassword%3E%0A%20%20%3C%2Fauthorization%3E%0A%20%20%3Csystem%3E%0A%20%20%20%20%3Csystem_name%3Esubscriber%3C%2Fsystem_name%3E%0A%20%20%20%20%3Caction%3Eadd%3C%2Faction%3E%0A%20%20%20%20%3Csearch_type%3Elistid%3C%2Fsearch_type%3E%0A%20%20%20%20%3Csearch_value%3E<%= CGI.escape list_id %>%3C%2Fsearch_value%3E%0A%20%20%20%20%3Csearch_value2%3E%3C%2Fsearch_value2%3E%0A%20%20%20%20%3Cvalues%3E%0A%20%20%20%20%20%20%3Cemail__address%3Euser3%40example.com%3C%2Femail__address%3E%0A%20%20%20%20%20%20%3Cstatus%3EUnsubscribed%3C%2Fstatus%3E%0A%20%20%20%20%20%20%3CLast__Name%3ESmith%3C%2FLast__Name%3E%0A%20%20%20%20%20%20%3CFirst__Name%3EJohn%3C%2FFirst__Name%3E%0A%20%20%20%20%3C%2Fvalues%3E%0A%20%20%3C%2Fsystem%3E%0A%3C%2Fexacttarget%3E%0A
141
+ body: xml=%3C%3Fxml%20version%3D%221.0%22%3F%3E%0A%3Cexacttarget%3E%0A%20%20%3Cauthorization%3E%0A%20%20%20%20%3Cusername%3E<%= CGI.escape username %>%3C%2Fusername%3E%0A%20%20%20%20%3Cpassword%3E<%= CGI.escape password %>%3C%2Fpassword%3E%0A%20%20%3C%2Fauthorization%3E%0A%20%20%3Csystem%3E%0A%20%20%20%20%3Csystem_name%3Esubscriber%3C%2Fsystem_name%3E%0A%20%20%20%20%3Caction%3Eadd%3C%2Faction%3E%0A%20%20%20%20%3Csearch_type%3Elistid%3C%2Fsearch_type%3E%0A%20%20%20%20%3Csearch_value%3E<%= CGI.escape list_id %>%3C%2Fsearch_value%3E%0A%20%20%20%20%3Csearch_value2%3E%3C%2Fsearch_value2%3E%0A%20%20%20%20%3Cvalues%3E%0A%20%20%20%20%20%20%3Cemail__address%3Euser3%40example.com%3C%2Femail__address%3E%0A%20%20%20%20%20%20%3Cstatus%3EUnsubscribed%3C%2Fstatus%3E%0A%20%20%20%20%20%20%3CLast____Name%3ESmith%3C%2FLast____Name%3E%0A%20%20%20%20%20%20%3CFirst____Name%3EJohn%3C%2FFirst____Name%3E%0A%20%20%20%20%3C%2Fvalues%3E%0A%20%20%3C%2Fsystem%3E%0A%3C%2Fexacttarget%3E%0A
142
142
  headers:
143
143
  content-type:
144
144
  - application/x-www-form-urlencoded
145
145
  connection:
146
146
  - close
147
147
  content-length:
148
- - "920"
148
+ - "928"
149
149
  host:
150
150
  - www.exacttarget.com
151
151
  response: !ruby/struct:VCR::Response
@@ -164,9 +164,9 @@
164
164
  server:
165
165
  - Microsoft-IIS/6.0
166
166
  date:
167
- - Fri, 20 Aug 2010 14:29:40 GMT
167
+ - Tue, 31 Aug 2010 16:00:21 GMT
168
168
  set-cookie:
169
- - ASP.NET_SessionId=jpwqno4542blwyqudden0w45; path=/; HttpOnly
169
+ - ASP.NET_SessionId=am5ia255rj3izmbmfpdeq345; path=/; HttpOnly
170
170
  cache-control:
171
171
  - private
172
172
  transfer-encoding:
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe Exacto::ListUnsubscription do
4
+ let(:list_id) { configatron.exacto.test_list_id }
5
+ subject { Exacto::ListUnsubscription.find(list_id) }
6
+
7
+ before(:each) do
8
+ VCR.insert_cassette('list_unsubscriptions/find')
9
+ end
10
+
11
+ after(:each) do
12
+ VCR.eject_cassette
13
+ end
14
+
15
+ it { should_not be_empty }
16
+
17
+ it 'should have an unsubscription with a valid email' do
18
+ subject.first.email_address.should_not be_nil
19
+ end
20
+ end
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+ describe Exacto::MasterListUnsubscription do
4
+ describe "finding existing unsubscriptions" do
5
+ before(:each) do
6
+ VCR.insert_cassette('master_list_unsubscriptions/find_existing', :record => :all)
7
+ end
8
+
9
+ after(:each) do
10
+ VCR.eject_cassette
11
+ end
12
+
13
+ subject do
14
+ Exacto::MasterListUnsubscription.find(DateTime.parse("08/01/2010"), DateTime.parse("09/01/2010"))
15
+ end
16
+
17
+ it { should_not be_empty }
18
+ it 'should have a valid unsubscriber (someone with an email)' do
19
+ subject.first.email_address.should_not be_blank
20
+ end
21
+ end
22
+
23
+ describe "finding an empty set of unsubscriptions" do
24
+ before(:each) do
25
+ VCR.insert_cassette('master_list_unsubscriptions/find_nonexistent', :record => :all)
26
+ end
27
+
28
+ after(:each) do
29
+ VCR.eject_cassette
30
+ end
31
+
32
+ subject do
33
+ Exacto::MasterListUnsubscription.find(DateTime.parse("08/01/2010"), DateTime.parse("08/01/2010"))
34
+ end
35
+
36
+ it { should be_empty }
37
+ end
38
+ end
@@ -2,17 +2,18 @@ require 'spec_helper'
2
2
 
3
3
  describe Exacto::Subscriber do
4
4
  let(:list_id) { configatron.exacto.test_list_id }
5
- let(:email) { "user3@example.com" }
5
+ let(:email_address) { "user3@example.com" }
6
+
6
7
  subject do
7
8
  Exacto::Subscriber.new(
8
- :email => email,
9
- :attributes => {"First__Name" => "John", "Last__Name" => "Smith"})
9
+ :email_address => email_address,
10
+ :attributes => {"First__Name" => "John", "Last__Name" => "Smith"})
10
11
  end
11
12
 
12
13
  describe 'subscriptions' do
13
14
  before(:each) do
14
15
  VCR.insert_cassette('subscribers/subscribe')
15
- result = subject.class.find_by_email_and_list_id(email, list_id)
16
+ result = subject.class.find_by_email_and_list_id(email_address, list_id)
16
17
  result.destroy if result
17
18
  end
18
19
 
@@ -35,7 +36,7 @@ describe Exacto::Subscriber do
35
36
  describe "unsubscribing" do
36
37
  before(:each) do
37
38
  VCR.insert_cassette('subscribers/unsubscribe')
38
- result = subject.class.find_by_email_and_list_id(email, list_id)
39
+ result = subject.class.find_by_email_and_list_id(email_address, list_id)
39
40
  result.destroy if result
40
41
  end
41
42
 
@@ -58,17 +59,22 @@ describe Exacto::Subscriber do
58
59
  describe 'finding a subscriber by email and list id' do
59
60
  before(:each) do
60
61
  VCR.insert_cassette('subscribers/find_by_email_and_list_id')
62
+ Exacto::Subscriber.new(
63
+ :email_address => email_address,
64
+ :attributes => {"First__Name" => "John", "Last__Name" => "Smith"}).subscribe_to(list_id)
61
65
  end
62
66
 
63
67
  after(:each) do
68
+ subscriber.destroy
64
69
  VCR.eject_cassette
65
70
  end
66
71
 
67
- subject { Exacto::Subscriber.find_by_email_and_list_id(email, list_id) }
72
+ let(:subscriber){ Exacto::Subscriber.find_by_email_and_list_id(email_address, list_id) }
73
+ subject { subscriber }
68
74
 
69
75
  it { should_not be_nil }
70
- its(:email) { should_not be_nil }
71
- its(:subscriber_id) {should_not be_nil}
76
+ its(:email_address) { should_not be_nil }
77
+ its(:subscriber_id) { should_not be_nil }
72
78
  end
73
79
 
74
80
  end
@@ -1,49 +1,14 @@
1
- # require 'spec_helper'
2
- #
3
- # describe Exacto::Unsubscription do
4
- # subject do
5
- # Exacto::Unsubscription.new(
6
- # :email => "user@example.com",
7
- # :unsubscribed_at => Time.now.to_s
8
- # )
9
- # end
10
- #
11
- # its(:email) { should_not be_nil }
12
- # its(:unsubscribed_at) { should_not be_nil }
13
- # its(:unsubscribed_at) { should be_kind_of(DateTime) }
14
- #
15
- # describe "finding unsubscriptions" do
16
- # before(:each) do
17
- # VCR.insert_cassette('unsubscriptions/find')
18
- # end
19
- #
20
- # after(:each) do
21
- # VCR.eject_cassette
22
- # end
23
- #
24
- # subject do
25
- # Exacto::Unsubscription.find(
26
- # :start_date => DateTime.parse("8/1/2010"),
27
- # :end_date => DateTime.parse("8/20/2010"))
28
- # end
29
- #
30
- # it { should_not be_empty }
31
- # end
32
- # end
1
+ require 'spec_helper'
33
2
 
3
+ describe Exacto::Unsubscription do
4
+ subject do
5
+ Exacto::Unsubscription.new(
6
+ :email_address => "user@example.com",
7
+ :unsubscribed_at => Time.now.to_s
8
+ )
9
+ end
34
10
 
35
- # <?xml version="1.0"?>
36
- # <exacttarget>
37
- # <authorization>
38
- # <username>gazelle_engineering</username>
39
- # <password>gazelle@55</password>
40
- # </authorization>
41
- # <system>
42
- # <system_name>tracking-channel</system_name>
43
- # <action>retrieve</action>
44
- # <sub_action>unsubscribe</sub_action>
45
- # <search_type>daterange</search_type>
46
- # <search_value>8/1/2010</search_value>
47
- # <search_value2>8/20/2010</search_value2>
48
- # </system>
49
- # </exacttarget>
11
+ its(:email_address) { should_not be_nil }
12
+ its(:unsubscribed_at) { should_not be_nil }
13
+ its(:unsubscribed_at) { should be_kind_of(DateTime) }
14
+ end
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: 31
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
9
8
  - 2
10
- version: 0.1.2
9
+ - 0
10
+ version: 0.2.0
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-08-23 00:00:00 -04:00
18
+ date: 2010-08-31 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -136,11 +136,20 @@ files:
136
136
  - lib/exacto_subscriber.rb
137
137
  - lib/exacto_subscriber/base.rb
138
138
  - lib/exacto_subscriber/error.rb
139
+ - lib/exacto_subscriber/ext/hacked_request.rb
140
+ - lib/exacto_subscriber/list_unsubscription.rb
141
+ - lib/exacto_subscriber/master_list_unsubscription.rb
139
142
  - lib/exacto_subscriber/subscriber.rb
143
+ - lib/exacto_subscriber/unsubscription.rb
144
+ - spec/cassettes/list_unsubscriptions/find.yml
145
+ - spec/cassettes/master_list_unsubscriptions/find_existing.yml
146
+ - spec/cassettes/master_list_unsubscriptions/find_nonexistent.yml
140
147
  - spec/cassettes/subscribers/find_by_email_and_list_id.yml
141
148
  - spec/cassettes/subscribers/subscribe.yml
142
149
  - spec/cassettes/subscribers/unsubscribe.yml
143
150
  - spec/exact_target_credentials.example.yml
151
+ - spec/exacto_subscriber/list_unsubscription_spec.rb
152
+ - spec/exacto_subscriber/master_list_unsubscription_spec.rb
144
153
  - spec/exacto_subscriber/subcriber_spec.rb
145
154
  - spec/exacto_subscriber/unsubscription_spec.rb
146
155
  - spec/exacto_subscriber_spec.rb
@@ -181,6 +190,8 @@ signing_key:
181
190
  specification_version: 3
182
191
  summary: Manage Exact Target List subscribers
183
192
  test_files:
193
+ - spec/exacto_subscriber/list_unsubscription_spec.rb
194
+ - spec/exacto_subscriber/master_list_unsubscription_spec.rb
184
195
  - spec/exacto_subscriber/subcriber_spec.rb
185
196
  - spec/exacto_subscriber/unsubscription_spec.rb
186
197
  - spec/exacto_subscriber_spec.rb