exacto_subscriber 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ begin
11
11
  gem.homepage = "http://github.com/dpickett/exacto_subscriber"
12
12
  gem.authors = ["Dan Pickett"]
13
13
  gem.add_dependency "configatron", ">= 2.6.3"
14
- gem.add_dependency "nokogiri", ">= 1.4.3.1"
14
+ gem.add_dependency "nokogiri", ">= 1.3.3"
15
15
  gem.add_dependency "httparty", ">= 0.6.1"
16
16
  gem.add_development_dependency "rspec", ">= 1.3.0"
17
17
  gem.add_development_dependency "fakeweb", "1.2.8"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -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.1"
8
+ s.version = "0.1.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-08-17}
12
+ s.date = %q{2010-08-23}
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 = [
@@ -34,8 +34,9 @@ Gem::Specification.new do |s|
34
34
  "spec/cassettes/subscribers/subscribe.yml",
35
35
  "spec/cassettes/subscribers/unsubscribe.yml",
36
36
  "spec/exact_target_credentials.example.yml",
37
- "spec/exacto/subcriber_spec.rb",
38
- "spec/exacto_spec.rb",
37
+ "spec/exacto_subscriber/subcriber_spec.rb",
38
+ "spec/exacto_subscriber/unsubscription_spec.rb",
39
+ "spec/exacto_subscriber_spec.rb",
39
40
  "spec/spec.opts",
40
41
  "spec/spec_helper.rb"
41
42
  ]
@@ -45,8 +46,9 @@ Gem::Specification.new do |s|
45
46
  s.rubygems_version = %q{1.3.7}
46
47
  s.summary = %q{Manage Exact Target List subscribers}
47
48
  s.test_files = [
48
- "spec/exacto/subcriber_spec.rb",
49
- "spec/exacto_spec.rb",
49
+ "spec/exacto_subscriber/subcriber_spec.rb",
50
+ "spec/exacto_subscriber/unsubscription_spec.rb",
51
+ "spec/exacto_subscriber_spec.rb",
50
52
  "spec/spec_helper.rb"
51
53
  ]
52
54
 
@@ -56,14 +58,14 @@ Gem::Specification.new do |s|
56
58
 
57
59
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
58
60
  s.add_runtime_dependency(%q<configatron>, [">= 2.6.3"])
59
- s.add_runtime_dependency(%q<nokogiri>, [">= 1.4.3.1"])
61
+ s.add_runtime_dependency(%q<nokogiri>, [">= 1.3.3"])
60
62
  s.add_runtime_dependency(%q<httparty>, [">= 0.6.1"])
61
63
  s.add_development_dependency(%q<rspec>, [">= 1.3.0"])
62
64
  s.add_development_dependency(%q<fakeweb>, ["= 1.2.8"])
63
65
  s.add_development_dependency(%q<vcr>, ["= 1.0.3"])
64
66
  else
65
67
  s.add_dependency(%q<configatron>, [">= 2.6.3"])
66
- s.add_dependency(%q<nokogiri>, [">= 1.4.3.1"])
68
+ s.add_dependency(%q<nokogiri>, [">= 1.3.3"])
67
69
  s.add_dependency(%q<httparty>, [">= 0.6.1"])
68
70
  s.add_dependency(%q<rspec>, [">= 1.3.0"])
69
71
  s.add_dependency(%q<fakeweb>, ["= 1.2.8"])
@@ -71,7 +73,7 @@ Gem::Specification.new do |s|
71
73
  end
72
74
  else
73
75
  s.add_dependency(%q<configatron>, [">= 2.6.3"])
74
- s.add_dependency(%q<nokogiri>, [">= 1.4.3.1"])
76
+ s.add_dependency(%q<nokogiri>, [">= 1.3.3"])
75
77
  s.add_dependency(%q<httparty>, [">= 0.6.1"])
76
78
  s.add_dependency(%q<rspec>, [">= 1.3.0"])
77
79
  s.add_dependency(%q<fakeweb>, ["= 1.2.8"])
@@ -8,9 +8,12 @@ module Exacto
8
8
  end
9
9
 
10
10
  def subscribe_to(list_id)
11
+ @status = "active"
11
12
  @list_id = list_id
12
13
  if item = self.class.find_by_email_and_list_id(email, list_id)
13
14
  item.list_id = list_id
15
+ item.status = @status
16
+ item.attributes = attributes
14
17
  item.update
15
18
  else
16
19
  create
@@ -23,6 +26,7 @@ module Exacto
23
26
  if item = self.class.find_by_email_and_list_id(email, list_id)
24
27
  item.list_id = list_id
25
28
  item.status = status
29
+ item.attributes = attributes
26
30
  item.update
27
31
  else
28
32
  create
@@ -30,6 +34,7 @@ module Exacto
30
34
  end
31
35
 
32
36
  def create
37
+ @status ||= "active"
33
38
  issue_request do |xml|
34
39
  xml.action "add"
35
40
  xml.search_type "listid"
@@ -53,9 +58,9 @@ module Exacto
53
58
  def resource_xml(xml)
54
59
  xml.values do
55
60
  xml.email__address @email
56
- xml.status @status || "active"
61
+ xml.status @status if @status
57
62
  (self.attributes || {}).each do |field, val|
58
- xml.send(field, val)
63
+ xml.send(field.to_s.gsub("_", "__"), val)
59
64
  end
60
65
  end
61
66
  end
@@ -72,6 +77,7 @@ module Exacto
72
77
  @email = options[:email]
73
78
  @status = options[:status]
74
79
  @subscriber_id = options[:subscriber_id]
80
+ @list_id = options[:list_id]
75
81
  @attributes = options[:attributes] || {}
76
82
  end
77
83
 
@@ -4,8 +4,8 @@ require "httparty"
4
4
  require "nokogiri"
5
5
 
6
6
  module Exacto
7
- def self.user=(user)
8
- configatron.exacto.user = user
7
+ def self.username=(user)
8
+ configatron.exacto.username = user
9
9
  end
10
10
 
11
11
  def self.username
@@ -29,9 +29,9 @@
29
29
  server:
30
30
  - Microsoft-IIS/6.0
31
31
  date:
32
- - Tue, 17 Aug 2010 15:58:00 GMT
32
+ - Fri, 20 Aug 2010 14:29:41 GMT
33
33
  set-cookie:
34
- - ASP.NET_SessionId=egukyha25rlc4045qizuwu45; path=/; HttpOnly
34
+ - ASP.NET_SessionId=oa3lbb22zyp5onrnbrbik5vc; path=/; HttpOnly
35
35
  cache-control:
36
36
  - private
37
37
  transfer-encoding:
@@ -29,9 +29,9 @@
29
29
  server:
30
30
  - Microsoft-IIS/6.0
31
31
  date:
32
- - Tue, 17 Aug 2010 15:57:54 GMT
32
+ - Fri, 20 Aug 2010 14:29:34 GMT
33
33
  set-cookie:
34
- - ASP.NET_SessionId=324tuu45y10kx455aejxgv45; path=/; HttpOnly
34
+ - ASP.NET_SessionId=eqze3nnlq5i4nmr5ljpm1f3y; path=/; HttpOnly
35
35
  cache-control:
36
36
  - private
37
37
  transfer-encoding:
@@ -40,7 +40,52 @@
40
40
  <?xml version='1.0'?>
41
41
  <exacttarget>
42
42
  <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>
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>
44
89
  </exacttarget>
45
90
 
46
91
  http_version: "1.1"
@@ -74,9 +119,9 @@
74
119
  server:
75
120
  - Microsoft-IIS/6.0
76
121
  date:
77
- - Tue, 17 Aug 2010 15:57:54 GMT
122
+ - Fri, 20 Aug 2010 14:29:35 GMT
78
123
  set-cookie:
79
- - ASP.NET_SessionId=1tlfxvvo0yzaql452hz5j345; path=/; HttpOnly
124
+ - ASP.NET_SessionId=zl1tid55urbgqvzfizr2jn55; path=/; HttpOnly
80
125
  cache-control:
81
126
  - private
82
127
  transfer-encoding:
@@ -119,9 +164,9 @@
119
164
  server:
120
165
  - Microsoft-IIS/6.0
121
166
  date:
122
- - Tue, 17 Aug 2010 15:57:55 GMT
167
+ - Fri, 20 Aug 2010 14:29:35 GMT
123
168
  set-cookie:
124
- - ASP.NET_SessionId=y1pnb3qo2vve4555dfjdlc45; path=/; HttpOnly
169
+ - ASP.NET_SessionId=2md1yivdzxvulsudaxk0xz55; path=/; HttpOnly
125
170
  cache-control:
126
171
  - private
127
172
  transfer-encoding:
@@ -29,9 +29,9 @@
29
29
  server:
30
30
  - Microsoft-IIS/6.0
31
31
  date:
32
- - Tue, 17 Aug 2010 15:57:56 GMT
32
+ - Fri, 20 Aug 2010 14:29:37 GMT
33
33
  set-cookie:
34
- - ASP.NET_SessionId=ozehg545vffjxh45we1kx5j0; path=/; HttpOnly
34
+ - ASP.NET_SessionId=dpxpqhbwps5xyounbg2llx45; path=/; HttpOnly
35
35
  cache-control:
36
36
  - private
37
37
  transfer-encoding:
@@ -74,9 +74,9 @@
74
74
  server:
75
75
  - Microsoft-IIS/6.0
76
76
  date:
77
- - Tue, 17 Aug 2010 15:57:57 GMT
77
+ - Fri, 20 Aug 2010 14:29:37 GMT
78
78
  set-cookie:
79
- - ASP.NET_SessionId=o3noh1brm5lxjn2tlayuozes; path=/; HttpOnly
79
+ - ASP.NET_SessionId=0h12lrmfqvvr3s55lyfy0kqc; 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
- - Tue, 17 Aug 2010 15:57:58 GMT
122
+ - Fri, 20 Aug 2010 14:29:39 GMT
123
123
  set-cookie:
124
- - ASP.NET_SessionId=doix3y55bi15fzeocix1czvl; path=/; HttpOnly
124
+ - ASP.NET_SessionId=dovlhm4534gpkqyxzk3veqm1; path=/; HttpOnly
125
125
  cache-control:
126
126
  - private
127
127
  transfer-encoding:
@@ -164,9 +164,9 @@
164
164
  server:
165
165
  - Microsoft-IIS/6.0
166
166
  date:
167
- - Tue, 17 Aug 2010 15:57:59 GMT
167
+ - Fri, 20 Aug 2010 14:29:40 GMT
168
168
  set-cookie:
169
- - ASP.NET_SessionId=cjz4qy45hoqtxm55rgfxicvv; path=/; HttpOnly
169
+ - ASP.NET_SessionId=jpwqno4542blwyqudden0w45; path=/; HttpOnly
170
170
  cache-control:
171
171
  - private
172
172
  transfer-encoding:
@@ -70,4 +70,5 @@ describe Exacto::Subscriber do
70
70
  its(:email) { should_not be_nil }
71
71
  its(:subscriber_id) {should_not be_nil}
72
72
  end
73
+
73
74
  end
@@ -0,0 +1,49 @@
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
33
+
34
+
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>
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: 25
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.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-08-17 00:00:00 -04:00
18
+ date: 2010-08-23 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -42,13 +42,12 @@ dependencies:
42
42
  requirements:
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
- hash: 113
45
+ hash: 29
46
46
  segments:
47
47
  - 1
48
- - 4
49
48
  - 3
50
- - 1
51
- version: 1.4.3.1
49
+ - 3
50
+ version: 1.3.3
52
51
  type: :runtime
53
52
  version_requirements: *id002
54
53
  - !ruby/object:Gem::Dependency
@@ -142,8 +141,9 @@ files:
142
141
  - spec/cassettes/subscribers/subscribe.yml
143
142
  - spec/cassettes/subscribers/unsubscribe.yml
144
143
  - spec/exact_target_credentials.example.yml
145
- - spec/exacto/subcriber_spec.rb
146
- - spec/exacto_spec.rb
144
+ - spec/exacto_subscriber/subcriber_spec.rb
145
+ - spec/exacto_subscriber/unsubscription_spec.rb
146
+ - spec/exacto_subscriber_spec.rb
147
147
  - spec/spec.opts
148
148
  - spec/spec_helper.rb
149
149
  has_rdoc: true
@@ -181,6 +181,7 @@ signing_key:
181
181
  specification_version: 3
182
182
  summary: Manage Exact Target List subscribers
183
183
  test_files:
184
- - spec/exacto/subcriber_spec.rb
185
- - spec/exacto_spec.rb
184
+ - spec/exacto_subscriber/subcriber_spec.rb
185
+ - spec/exacto_subscriber/unsubscription_spec.rb
186
+ - spec/exacto_subscriber_spec.rb
186
187
  - spec/spec_helper.rb