createsend 0.1.1 → 0.2.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.
- data/Gemfile.lock +1 -1
- data/README.md +6 -6
- data/Rakefile +1 -1
- data/createsend.gemspec +1 -1
- data/lib/campaign.rb +131 -129
- data/lib/client.rb +134 -132
- data/lib/createsend.rb +94 -80
- data/lib/list.rb +179 -180
- data/lib/segment.rb +67 -65
- data/lib/subscriber.rb +56 -54
- data/lib/template.rb +35 -33
- data/test/campaign_test.rb +2 -2
- data/test/client_test.rb +2 -2
- data/test/createsend_test.rb +8 -8
- data/test/fixtures/list_webhooks.json +1 -4
- data/test/list_test.rb +4 -4
- data/test/segment_test.rb +2 -2
- data/test/subscriber_test.rb +6 -6
- data/test/template_test.rb +2 -2
- metadata +5 -5
data/test/segment_test.rb
CHANGED
@@ -5,14 +5,14 @@ class SegmentTest < Test::Unit::TestCase
|
|
5
5
|
setup do
|
6
6
|
@api_key = '123123123123123123123'
|
7
7
|
CreateSend.api_key @api_key
|
8
|
-
@segment = Segment.new(:segment_id => '98y2e98y289dh89h938389')
|
8
|
+
@segment = CreateSend::Segment.new(:segment_id => '98y2e98y289dh89h938389')
|
9
9
|
end
|
10
10
|
|
11
11
|
should "create a new segment" do
|
12
12
|
list_id = "2983492834987394879837498"
|
13
13
|
rules = [ { :Subject => "EmailAddress", :Clauses => [ "CONTAINS example.com" ] } ]
|
14
14
|
stub_post(@api_key, "segments/#{list_id}.json", "create_segment.json")
|
15
|
-
res = Segment.create list_id, "new segment title", rules
|
15
|
+
res = CreateSend::Segment.create list_id, "new segment title", rules
|
16
16
|
res.should == "0246c2aea610a3545d9780bf6ab89006"
|
17
17
|
end
|
18
18
|
|
data/test/subscriber_test.rb
CHANGED
@@ -6,13 +6,13 @@ class SubscriberTest < Test::Unit::TestCase
|
|
6
6
|
@api_key = '123123123123123123123'
|
7
7
|
CreateSend.api_key @api_key
|
8
8
|
@list_id = "d98h2938d9283d982u3d98u88"
|
9
|
-
@subscriber = Subscriber.new @list_id, "subscriber@example.com"
|
9
|
+
@subscriber = CreateSend::Subscriber.new @list_id, "subscriber@example.com"
|
10
10
|
end
|
11
11
|
|
12
12
|
should "get a subscriber by list id and email address" do
|
13
13
|
email = "subscriber@example.com"
|
14
14
|
stub_get(@api_key, "subscribers/#{@list_id}.json?email=#{CGI.escape(email)}", "subscriber_details.json")
|
15
|
-
subscriber = Subscriber.get @list_id, email
|
15
|
+
subscriber = CreateSend::Subscriber.get @list_id, email
|
16
16
|
subscriber.EmailAddress.should == email
|
17
17
|
subscriber.Name.should == "Subscriber One"
|
18
18
|
subscriber.Date.should == "2010-10-25 10:28:00"
|
@@ -24,14 +24,14 @@ class SubscriberTest < Test::Unit::TestCase
|
|
24
24
|
|
25
25
|
should "add a subscriber without custom fields" do
|
26
26
|
stub_post(@api_key, "subscribers/#{@list_id}.json", "add_subscriber.json")
|
27
|
-
email_address = Subscriber.add @list_id, "subscriber@example.com", "Subscriber", [], true
|
27
|
+
email_address = CreateSend::Subscriber.add @list_id, "subscriber@example.com", "Subscriber", [], true
|
28
28
|
email_address.should == "subscriber@example.com"
|
29
29
|
end
|
30
30
|
|
31
31
|
should "add a subscriber with custom fields" do
|
32
32
|
stub_post(@api_key, "subscribers/#{@list_id}.json", "add_subscriber.json")
|
33
33
|
custom_fields = [ { :Key => 'website', :Value => 'http://example.com/' } ]
|
34
|
-
email_address = Subscriber.add @list_id, "subscriber@example.com", "Subscriber", custom_fields, true
|
34
|
+
email_address = CreateSend::Subscriber.add @list_id, "subscriber@example.com", "Subscriber", custom_fields, true
|
35
35
|
email_address.should == "subscriber@example.com"
|
36
36
|
end
|
37
37
|
|
@@ -42,7 +42,7 @@ class SubscriberTest < Test::Unit::TestCase
|
|
42
42
|
{ :EmailAddress => "example+2@example.com", :Name => "Example Two" },
|
43
43
|
{ :EmailAddress => "example+3@example.com", :Name => "Example Three" },
|
44
44
|
]
|
45
|
-
import_result = Subscriber.import @list_id, subscribers, true
|
45
|
+
import_result = CreateSend::Subscriber.import @list_id, subscribers, true
|
46
46
|
import_result.FailureDetails.size.should == 0
|
47
47
|
import_result.TotalUniqueEmailsSubmitted.should == 3
|
48
48
|
import_result.TotalExistingSubscribers.should == 0
|
@@ -58,7 +58,7 @@ class SubscriberTest < Test::Unit::TestCase
|
|
58
58
|
{ :EmailAddress => "example+2@example.com", :Name => "Example Two" },
|
59
59
|
{ :EmailAddress => "example+3@example.com", :Name => "Example Three" },
|
60
60
|
]
|
61
|
-
import_result = Subscriber.import @list_id, subscribers, true
|
61
|
+
import_result = CreateSend::Subscriber.import @list_id, subscribers, true
|
62
62
|
import_result.FailureDetails.size.should == 1
|
63
63
|
import_result.FailureDetails.first.EmailAddress.should == "example+1@example"
|
64
64
|
import_result.FailureDetails.first.Code.should == 1
|
data/test/template_test.rb
CHANGED
@@ -5,13 +5,13 @@ class TemplateTest < Test::Unit::TestCase
|
|
5
5
|
setup do
|
6
6
|
@api_key = '123123123123123123123'
|
7
7
|
CreateSend.api_key @api_key
|
8
|
-
@template = Template.new(:template_id => '98y2e98y289dh89h938389')
|
8
|
+
@template = CreateSend::Template.new(:template_id => '98y2e98y289dh89h938389')
|
9
9
|
end
|
10
10
|
|
11
11
|
should "create a template" do
|
12
12
|
client_id = '87y8d7qyw8d7yq8w7ydwqwd'
|
13
13
|
stub_post(@api_key, "templates/#{client_id}.json", "create_template.json")
|
14
|
-
template_id = Template.create client_id, "Template One", "http://templates.org/index.html",
|
14
|
+
template_id = CreateSend::Template.create client_id, "Template One", "http://templates.org/index.html",
|
15
15
|
"http://templates.org/files.zip", "http://templates.org/screenshot.jpg"
|
16
16
|
template_id.should == "98y2e98y289dh89h938389"
|
17
17
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: createsend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- James Dennes
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-12-
|
18
|
+
date: 2010-12-29 00:00:00 +11:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|