constant_contact 1.0.0

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.
Files changed (34) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +56 -0
  3. data/lib/constant_contact.rb +13 -0
  4. data/lib/constant_contact/activity.rb +41 -0
  5. data/lib/constant_contact/base.rb +150 -0
  6. data/lib/constant_contact/campaign.rb +112 -0
  7. data/lib/constant_contact/contact.rb +82 -0
  8. data/lib/constant_contact/contact_event.rb +7 -0
  9. data/lib/constant_contact/email_address.rb +6 -0
  10. data/lib/constant_contact/formats.rb +3 -0
  11. data/lib/constant_contact/formats/atom_format.rb +78 -0
  12. data/lib/constant_contact/formats/html_encoded_format.rb +17 -0
  13. data/lib/constant_contact/list.rb +11 -0
  14. data/lib/constant_contact/member.rb +5 -0
  15. data/lib/constant_contact/version.rb +3 -0
  16. data/test/constant_contact/activity_test.rb +41 -0
  17. data/test/constant_contact/atom_format_test.rb +28 -0
  18. data/test/constant_contact/base_test.rb +85 -0
  19. data/test/constant_contact/contact_test.rb +135 -0
  20. data/test/constant_contact/list_test.rb +17 -0
  21. data/test/constant_contact/member_test.rb +25 -0
  22. data/test/constant_contact_test.rb +8 -0
  23. data/test/fixtures/all_contacts.xml +51 -0
  24. data/test/fixtures/contactlistscollection.xml +96 -0
  25. data/test/fixtures/contactlistsindividuallist.xml +30 -0
  26. data/test/fixtures/memberscollection.xml +763 -0
  27. data/test/fixtures/new_list.xml +16 -0
  28. data/test/fixtures/nocontent.xml +12 -0
  29. data/test/fixtures/service_document.xml +15 -0
  30. data/test/fixtures/single_contact_by_email.xml +34 -0
  31. data/test/fixtures/single_contact_by_id.xml +71 -0
  32. data/test/fixtures/single_contact_by_id_with_no_contactlists.xml +65 -0
  33. data/test/test_helper.rb +46 -0
  34. metadata +186 -0
@@ -0,0 +1,16 @@
1
+ <entry xmlns="http://www.w3.org/2005/Atom">
2
+ <id>http://api.constantcontact.com/ws/customers/joesflowers/lists/15</id>
3
+ <title type="text">A New List</title>
4
+ <author />
5
+ <updated>2008-04-16T15:28:09.757Z</updated>
6
+ <content type="application/vnd.ctct+xml">
7
+ <ContactList xmlns="http://ws.constantcontact.com/ns/1.0/"
8
+ id="http://api.constantcontact.com/ws/customers/joesflowers/lists/15">
9
+ <OptInDefault>false</OptInDefault>
10
+ <Name>Test list 5</Name>
11
+ <SortOrder>1</SortOrder>
12
+ <ShortName>Test list 5</ShortName>
13
+ </ContactList>
14
+ </content>
15
+ <link href="/ws/customers/joesflowers/lists/15" rel="edit" />
16
+ </entry>
@@ -0,0 +1,12 @@
1
+ <?xml version='1.0' encoding='UTF-8'?>
2
+ <feed xmlns="http://www.w3.org/2005/Atom">
3
+ <id>http://api.constantcontact.com/ws/customers/recordkick/campaigns</id>
4
+ <title type="text">Campaigns for customer: recordkick</title>
5
+ <link href="http://api.constantcontact.com/ws/customers/recordkick/campaigns" />
6
+ <link href="http://api.constantcontact.com/ws/customers/recordkick/campaigns" rel="self" />
7
+ <author>
8
+ <name>recordkick</name>
9
+ </author>
10
+ <updated>2009-07-25T22:23:18.626Z</updated>
11
+ <link href="/ws/customers/recordkick/campaigns" rel="first" />
12
+ </feed>
@@ -0,0 +1,15 @@
1
+ <?xml version='1.0' encoding='UTF-8'?>
2
+ <service xmlns="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom">
3
+ <workspace>
4
+ <atom:title type="text">Constant Contact Web Services Customer Workspace</atom:title>
5
+ <collection href="/ws/customers/joesflowers/lists">
6
+ <atom:title type="text">Contact Lists</atom:title>
7
+ <accept>application/atom+xml; type=entry</accept>
8
+ </collection>
9
+ <collection href="/ws/customers/joesflowers/activities">
10
+ <atom:title type="text">Bulk Activity</atom:title>
11
+ <accept>application/x-www-form-urlencoded</accept>
12
+ <accept>multipart/form-data</accept>
13
+ </collection>
14
+ </workspace>
15
+ </service>
@@ -0,0 +1,34 @@
1
+ <?xml version='1.0' encoding='UTF-8'?>
2
+ <feed xmlns="http://www.w3.org/2005/Atom">
3
+ <id>http://api.constantcontact.com/ws/customers/joesflowers/contacts</id>
4
+ <title type="text">Contacts for Customer: joesflowers</title>
5
+ <link href="contacts" />
6
+ <link href="contacts" rel="self" />
7
+ <author>
8
+ <name>joesflowers</name>
9
+ </author>
10
+ <updated>2010-04-21T23:24:32.247Z</updated>
11
+ <link href="/ws/customers/joesflowers/contacts" rel="first" />
12
+ <link href="/ws/customers/joesflowers/contacts?email=jon%40example.com" rel="current" />
13
+ <entry>
14
+ <link href="/ws/customers/joesflowers/contacts/2" rel="edit" />
15
+ <id>http://api.constantcontact.com/ws/customers/joesflowers/contacts/2</id>
16
+ <title type="text">Contact: jon@example.com</title>
17
+ <updated>2010-04-21T23:24:32.268Z</updated>
18
+ <author>
19
+ <name>Constant Contact</name>
20
+ </author>
21
+ <content type="application/vnd.ctct+xml">
22
+ <Contact xmlns="http://ws.constantcontact.com/ns/1.0/" id="http://api.constantcontact.com/ws/customers/joesflowers/contacts/2">
23
+ <Status>Active</Status>
24
+ <EmailAddress>jon@example.com</EmailAddress>
25
+ <EmailType>HTML</EmailType>
26
+ <Name>smith, jon</Name>
27
+ <OptInTime>2010-04-21T18:35:34.066Z</OptInTime>
28
+ <OptInSource>ACTION_BY_CUSTOMER</OptInSource>
29
+ <Confirmed>false</Confirmed>
30
+ <InsertTime>2010-04-21T18:35:34.066Z</InsertTime>
31
+ </Contact>
32
+ </content>
33
+ </entry>
34
+ </feed>
@@ -0,0 +1,71 @@
1
+ <?xml version='1.0' encoding='UTF-8'?>
2
+ <entry xmlns="http://www.w3.org/2005/Atom">
3
+ <link href="/ws/customers/joesflowers/contacts/2" rel="edit" />
4
+ <id>http://api.constantcontact.com/ws/customers/joesflowers/contacts/2</id>
5
+ <title type="text">Contact: jon@example.com</title>
6
+ <updated>2010-04-21T18:35:34.279Z</updated>
7
+ <author>
8
+ <name>Constant Contact</name>
9
+ </author>
10
+ <content type="application/vnd.ctct+xml">
11
+ <Contact xmlns="http://ws.constantcontact.com/ns/1.0/" id="http://api.constantcontact.com/ws/customers/joesflowers/contacts/2">
12
+ <Status>Active</Status>
13
+ <EmailAddress>jon@example.com</EmailAddress>
14
+ <EmailType>HTML</EmailType>
15
+ <Name>jon smith</Name>
16
+ <FirstName>jon</FirstName>
17
+ <MiddleName></MiddleName>
18
+ <LastName>smith</LastName>
19
+ <JobTitle></JobTitle>
20
+ <CompanyName></CompanyName>
21
+ <HomePhone></HomePhone>
22
+ <WorkPhone></WorkPhone>
23
+ <Addr1></Addr1>
24
+ <Addr2></Addr2>
25
+ <Addr3></Addr3>
26
+ <City></City>
27
+ <StateCode></StateCode>
28
+ <StateName></StateName>
29
+ <CountryCode></CountryCode>
30
+ <CountryName></CountryName>
31
+ <PostalCode></PostalCode>
32
+ <SubPostalCode></SubPostalCode>
33
+ <Note></Note>
34
+ <CustomField1></CustomField1>
35
+ <CustomField2></CustomField2>
36
+ <CustomField3></CustomField3>
37
+ <CustomField4></CustomField4>
38
+ <CustomField5></CustomField5>
39
+ <CustomField6></CustomField6>
40
+ <CustomField7></CustomField7>
41
+ <CustomField8></CustomField8>
42
+ <CustomField9></CustomField9>
43
+ <CustomField10></CustomField10>
44
+ <CustomField11></CustomField11>
45
+ <CustomField12></CustomField12>
46
+ <CustomField13></CustomField13>
47
+ <CustomField14></CustomField14>
48
+ <CustomField15></CustomField15>
49
+ <ContactLists>
50
+ <ContactList id="http://api.constantcontact.com/ws/customers/joesflowers/lists/1">
51
+ <link xmlns="http://www.w3.org/2005/Atom" href="/ws/customers/joesflowers/lists/1" rel="self" />
52
+ <OptInSource>ACTION_BY_CUSTOMER</OptInSource>
53
+ <OptInTime>2010-04-21T18:35:34.175Z</OptInTime>
54
+ </ContactList>
55
+ </ContactLists>
56
+ <Confirmed>false</Confirmed>
57
+ <InsertTime>2010-04-21T18:35:34.066Z</InsertTime>
58
+ <LastUpdateTime>2010-04-21T18:35:34.279Z</LastUpdateTime>
59
+ </Contact>
60
+ </content>
61
+ <source>
62
+ <id>http://api.constantcontact.com/ws/customers/joesflowers/contacts</id>
63
+ <title type="text">Contacts for Customer: joesflowers</title>
64
+ <link href="contacts" />
65
+ <link href="contacts" rel="self" />
66
+ <author>
67
+ <name>joesflowers</name>
68
+ </author>
69
+ <updated>2010-04-21T23:36:25.001Z</updated>
70
+ </source>
71
+ </entry>"
@@ -0,0 +1,65 @@
1
+ <?xml version='1.0' encoding='UTF-8'?>
2
+ <entry xmlns="http://www.w3.org/2005/Atom">
3
+ <link href="/ws/customers/joesflowers/contacts/2" rel="edit" />
4
+ <id>http://api.constantcontact.com/ws/customers/joesflowers/contacts/2</id>
5
+ <title type="text">Contact: jon@example.com</title>
6
+ <updated>2010-04-21T18:35:34.279Z</updated>
7
+ <author>
8
+ <name>Constant Contact</name>
9
+ </author>
10
+ <content type="application/vnd.ctct+xml">
11
+ <Contact xmlns="http://ws.constantcontact.com/ns/1.0/" id="http://api.constantcontact.com/ws/customers/joesflowers/contacts/2">
12
+ <Status>Active</Status>
13
+ <EmailAddress>jon@example.com</EmailAddress>
14
+ <EmailType>HTML</EmailType>
15
+ <Name>jon smith</Name>
16
+ <FirstName>jon</FirstName>
17
+ <MiddleName></MiddleName>
18
+ <LastName>smith</LastName>
19
+ <JobTitle></JobTitle>
20
+ <CompanyName></CompanyName>
21
+ <HomePhone></HomePhone>
22
+ <WorkPhone></WorkPhone>
23
+ <Addr1></Addr1>
24
+ <Addr2></Addr2>
25
+ <Addr3></Addr3>
26
+ <City></City>
27
+ <StateCode></StateCode>
28
+ <StateName></StateName>
29
+ <CountryCode></CountryCode>
30
+ <CountryName></CountryName>
31
+ <PostalCode></PostalCode>
32
+ <SubPostalCode></SubPostalCode>
33
+ <Note></Note>
34
+ <CustomField1></CustomField1>
35
+ <CustomField2></CustomField2>
36
+ <CustomField3></CustomField3>
37
+ <CustomField4></CustomField4>
38
+ <CustomField5></CustomField5>
39
+ <CustomField6></CustomField6>
40
+ <CustomField7></CustomField7>
41
+ <CustomField8></CustomField8>
42
+ <CustomField9></CustomField9>
43
+ <CustomField10></CustomField10>
44
+ <CustomField11></CustomField11>
45
+ <CustomField12></CustomField12>
46
+ <CustomField13></CustomField13>
47
+ <CustomField14></CustomField14>
48
+ <CustomField15></CustomField15>
49
+ <ContactLists></ContactLists>
50
+ <Confirmed>false</Confirmed>
51
+ <InsertTime>2010-04-21T18:35:34.066Z</InsertTime>
52
+ <LastUpdateTime>2010-04-21T18:35:34.279Z</LastUpdateTime>
53
+ </Contact>
54
+ </content>
55
+ <source>
56
+ <id>http://api.constantcontact.com/ws/customers/joesflowers/contacts</id>
57
+ <title type="text">Contacts for Customer: joesflowers</title>
58
+ <link href="contacts" />
59
+ <link href="contacts" rel="self" />
60
+ <author>
61
+ <name>joesflowers</name>
62
+ </author>
63
+ <updated>2010-04-21T23:36:25.001Z</updated>
64
+ </source>
65
+ </entry>"
@@ -0,0 +1,46 @@
1
+ require 'rubygems'
2
+ require 'active_support/test_case'
3
+ require 'test/unit'
4
+ require 'shoulda'
5
+ require 'matchy'
6
+ require 'mocha'
7
+ require 'fakeweb'
8
+
9
+ FakeWeb.allow_net_connect = false
10
+
11
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
12
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
13
+ require 'constant_contact'
14
+
15
+ class Test::Unit::TestCase
16
+ end
17
+
18
+ def fixture_file(filename)
19
+ return '' if filename == ''
20
+ file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/' + filename)
21
+ File.read(file_path)
22
+ end
23
+
24
+ def constant_contact_url(url)
25
+ url =~ /^http/ ? url : "http://api.constantcontact.com#{url}"
26
+ end
27
+
28
+ def stub_get(url, filename, status=nil)
29
+ options = {:body => fixture_file(filename)}
30
+ options.merge!({:status => status}) unless status.nil?
31
+
32
+ FakeWeb.register_uri(:get, constant_contact_url(url), options)
33
+ end
34
+
35
+ def stub_post(url, filename)
36
+ FakeWeb.register_uri(:post, constant_contact_url(url), :body => fixture_file(filename))
37
+ end
38
+
39
+ def stub_put(url, filename)
40
+ FakeWeb.register_uri(:put, constant_contact_url(url), :body => fixture_file(filename))
41
+ end
42
+
43
+ def stub_delete(url, status)
44
+ options = {:status => status}
45
+ FakeWeb.register_uri(:delete, constant_contact_url(url), options)
46
+ end
metadata ADDED
@@ -0,0 +1,186 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: constant_contact
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 0
10
+ version: 1.0.0
11
+ platform: ruby
12
+ authors:
13
+ - Tim Case
14
+ - Ed Hickey
15
+ - Nathan Hyde
16
+ autorequire:
17
+ bindir: bin
18
+ cert_chain: []
19
+
20
+ date: 2010-09-02 00:00:00 -04:00
21
+ default_executable:
22
+ dependencies:
23
+ - !ruby/object:Gem::Dependency
24
+ name: activeresource
25
+ prerelease: false
26
+ requirement: &id001 !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ hash: 3
32
+ segments:
33
+ - 0
34
+ version: "0"
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: actionpack
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
48
+ version: "0"
49
+ type: :runtime
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: shoulda
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
63
+ type: :development
64
+ version_requirements: *id003
65
+ - !ruby/object:Gem::Dependency
66
+ name: matchy
67
+ prerelease: false
68
+ requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ type: :development
78
+ version_requirements: *id004
79
+ - !ruby/object:Gem::Dependency
80
+ name: mocha
81
+ prerelease: false
82
+ requirement: &id005 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ hash: 3
88
+ segments:
89
+ - 0
90
+ version: "0"
91
+ type: :development
92
+ version_requirements: *id005
93
+ - !ruby/object:Gem::Dependency
94
+ name: fakeweb
95
+ prerelease: false
96
+ requirement: &id006 !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ hash: 3
102
+ segments:
103
+ - 0
104
+ version: "0"
105
+ type: :development
106
+ version_requirements: *id006
107
+ description: This is a very ActiveResource-like ruby wrapper to the Constant Contact API.
108
+ email:
109
+ executables: []
110
+
111
+ extensions: []
112
+
113
+ extra_rdoc_files: []
114
+
115
+ files:
116
+ - lib/constant_contact/activity.rb
117
+ - lib/constant_contact/base.rb
118
+ - lib/constant_contact/campaign.rb
119
+ - lib/constant_contact/contact.rb
120
+ - lib/constant_contact/contact_event.rb
121
+ - lib/constant_contact/email_address.rb
122
+ - lib/constant_contact/formats/atom_format.rb
123
+ - lib/constant_contact/formats/html_encoded_format.rb
124
+ - lib/constant_contact/formats.rb
125
+ - lib/constant_contact/list.rb
126
+ - lib/constant_contact/member.rb
127
+ - lib/constant_contact/version.rb
128
+ - lib/constant_contact.rb
129
+ - test/constant_contact/activity_test.rb
130
+ - test/constant_contact/atom_format_test.rb
131
+ - test/constant_contact/base_test.rb
132
+ - test/constant_contact/contact_test.rb
133
+ - test/constant_contact/list_test.rb
134
+ - test/constant_contact/member_test.rb
135
+ - test/constant_contact_test.rb
136
+ - test/fixtures/all_contacts.xml
137
+ - test/fixtures/contactlistscollection.xml
138
+ - test/fixtures/contactlistsindividuallist.xml
139
+ - test/fixtures/memberscollection.xml
140
+ - test/fixtures/new_list.xml
141
+ - test/fixtures/nocontent.xml
142
+ - test/fixtures/service_document.xml
143
+ - test/fixtures/single_contact_by_email.xml
144
+ - test/fixtures/single_contact_by_id.xml
145
+ - test/fixtures/single_contact_by_id_with_no_contactlists.xml
146
+ - test/test_helper.rb
147
+ - MIT-LICENSE
148
+ - README.md
149
+ has_rdoc: true
150
+ homepage: http://github.com/idris/constant_contact
151
+ licenses: []
152
+
153
+ post_install_message:
154
+ rdoc_options: []
155
+
156
+ require_paths:
157
+ - lib
158
+ required_ruby_version: !ruby/object:Gem::Requirement
159
+ none: false
160
+ requirements:
161
+ - - ">="
162
+ - !ruby/object:Gem::Version
163
+ hash: 3
164
+ segments:
165
+ - 0
166
+ version: "0"
167
+ required_rubygems_version: !ruby/object:Gem::Requirement
168
+ none: false
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ hash: 23
173
+ segments:
174
+ - 1
175
+ - 3
176
+ - 6
177
+ version: 1.3.6
178
+ requirements: []
179
+
180
+ rubyforge_project:
181
+ rubygems_version: 1.3.7
182
+ signing_key:
183
+ specification_version: 3
184
+ summary: ActiveResource wrapper for the Constant Contact API.
185
+ test_files: []
186
+