constant_contact 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -78,7 +78,7 @@ module ConstantContact
|
|
78
78
|
# But we need: email=<email 1>&email=<email 2>
|
79
79
|
def self.find_all_by_emails(emails)
|
80
80
|
raise ArgumentError, "Expected an array of emails, got a(n) #{emails.class.name}" unless emails.is_a? Array
|
81
|
-
return [] if
|
81
|
+
return [] if emails.empty?
|
82
82
|
|
83
83
|
query_string = emails.map{|e| "email=#{CGI.escape(e.to_s.downcase)}"}.join('&')
|
84
84
|
|
@@ -107,12 +107,21 @@ class ContactTest < Test::Unit::TestCase
|
|
107
107
|
ConstantContact::Base.api_key = "api_key"
|
108
108
|
stub_get('https://api_key%25joesflowers:password@api.constantcontact.com/ws/customers/joesflowers/contacts', 'all_contacts.xml')
|
109
109
|
stub_get('https://api_key%25joesflowers:password@api.constantcontact.com/ws/customers/joesflowers/contacts?email=jon%40example.com', 'single_contact_by_email.xml')
|
110
|
+
stub_get('https://api_key%25joesflowers:password@api.constantcontact.com/ws/customers/joesflowers/contacts?email=jon%40example.com&email=my%40example.com', 'multiple_contacts_by_emails.xml')
|
110
111
|
end
|
111
112
|
|
112
113
|
should 'find contact with email address' do
|
113
114
|
assert_equal 'smith, jon', ConstantContact::Contact.find(:first, :params => {:email => 'jon@example.com'}).Name
|
114
115
|
end
|
115
116
|
|
117
|
+
should 'find two contacts with two email addresses' do
|
118
|
+
contacts = ConstantContact::Contact.find_all_by_emails(['jon@example.com', 'my@example.com'])
|
119
|
+
assert_equal Array, contacts.class
|
120
|
+
assert_equal 2, contacts.size
|
121
|
+
assert_equal 'smith, jon', contacts[0].Name
|
122
|
+
assert_equal 'Doe, Marvin', contacts[1].Name
|
123
|
+
end
|
124
|
+
|
116
125
|
should 'return nil when asking for contact_lists' do
|
117
126
|
assert_equal nil, ConstantContact::Contact.find(:first, :params => {:email => 'jon@example.com'}).contact_lists
|
118
127
|
end
|
@@ -0,0 +1,55 @@
|
|
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&email=my%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
|
+
<entry>
|
35
|
+
<link href="/ws/customers/joesflowers/contacts/2" rel="edit" />
|
36
|
+
<id>http://api.constantcontact.com/ws/customers/joesflowers/contacts/1</id>
|
37
|
+
<title type="text">Contact: my@example.com</title>
|
38
|
+
<updated>2010-04-21T23:24:32.268Z</updated>
|
39
|
+
<author>
|
40
|
+
<name>Constant Contact</name>
|
41
|
+
</author>
|
42
|
+
<content type="application/vnd.ctct+xml">
|
43
|
+
<Contact xmlns="http://ws.constantcontact.com/ns/1.0/" id="http://api.constantcontact.com/ws/customers/joesflowers/contacts/1">
|
44
|
+
<Status>Active</Status>
|
45
|
+
<EmailAddress>my@example.com</EmailAddress>
|
46
|
+
<EmailType>HTML</EmailType>
|
47
|
+
<Name>Doe, Marvin</Name>
|
48
|
+
<OptInTime>2010-04-14T22:09:42.950Z</OptInTime>
|
49
|
+
<OptInSource>ACTION_BY_CUSTOMER</OptInSource>
|
50
|
+
<Confirmed>false</Confirmed>
|
51
|
+
<InsertTime>2010-04-21T18:35:34.066Z</InsertTime>
|
52
|
+
</Contact>
|
53
|
+
</content>
|
54
|
+
</entry>
|
55
|
+
</feed>
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: constant_contact
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 1.1.
|
9
|
+
- 4
|
10
|
+
version: 1.1.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tim Case
|
@@ -152,6 +152,7 @@ files:
|
|
152
152
|
- test/fixtures/contactlistscollection.xml
|
153
153
|
- test/fixtures/contactlistsindividuallist.xml
|
154
154
|
- test/fixtures/memberscollection.xml
|
155
|
+
- test/fixtures/multiple_contacts_by_emails.xml
|
155
156
|
- test/fixtures/new_list.xml
|
156
157
|
- test/fixtures/nocontent.xml
|
157
158
|
- test/fixtures/service_document.xml
|