createsend 0.3.0 → 0.3.1
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/lib/createsend/campaign.rb +2 -1
- data/lib/createsend/client.rb +6 -0
- data/lib/createsend/version.rb +1 -1
- data/test/campaign_test.rb +4 -3
- data/test/client_test.rb +15 -2
- data/test/fixtures/campaign_summary.json +1 -1
- data/test/fixtures/campaigns.json +2 -2
- data/test/fixtures/drafts.json +2 -2
- data/test/fixtures/scheduled_campaigns.json +20 -0
- metadata +6 -4
data/Gemfile.lock
CHANGED
data/lib/createsend/campaign.rb
CHANGED
@@ -108,8 +108,9 @@ module CreateSend
|
|
108
108
|
end
|
109
109
|
|
110
110
|
# Retrieves the bounces for this campaign.
|
111
|
-
def bounces(page=1, page_size=1000, order_field="date", order_direction="asc")
|
111
|
+
def bounces(date="1900-01-01", page=1, page_size=1000, order_field="date", order_direction="asc")
|
112
112
|
options = { :query => {
|
113
|
+
:date => date,
|
113
114
|
:page => page,
|
114
115
|
:pagesize => page_size,
|
115
116
|
:orderfield => order_field,
|
data/lib/createsend/client.rb
CHANGED
@@ -32,6 +32,12 @@ module CreateSend
|
|
32
32
|
response = get 'campaigns'
|
33
33
|
response.map{|item| Hashie::Mash.new(item)}
|
34
34
|
end
|
35
|
+
|
36
|
+
# Gets the currently scheduled campaigns belonging to this client.
|
37
|
+
def scheduled
|
38
|
+
response = get 'scheduled'
|
39
|
+
response.map{|item| Hashie::Mash.new(item)}
|
40
|
+
end
|
35
41
|
|
36
42
|
# Gets the draft campaigns belonging to this client.
|
37
43
|
def drafts
|
data/lib/createsend/version.rb
CHANGED
data/test/campaign_test.rb
CHANGED
@@ -41,7 +41,7 @@ class CampaignTest < Test::Unit::TestCase
|
|
41
41
|
summary.Unsubscribed.should == 0
|
42
42
|
summary.Bounced.should == 0
|
43
43
|
summary.UniqueOpened.should == 5
|
44
|
-
summary.WebVersionURL.should == "http://
|
44
|
+
summary.WebVersionURL.should == "http://createsend.com/t/r-3A433FC72FFE3B8B"
|
45
45
|
end
|
46
46
|
|
47
47
|
should "get the lists and segments for a campaign" do
|
@@ -127,8 +127,9 @@ class CampaignTest < Test::Unit::TestCase
|
|
127
127
|
end
|
128
128
|
|
129
129
|
should "get the bounces for a campaign" do
|
130
|
-
|
131
|
-
|
130
|
+
min_date = "2010-01-01"
|
131
|
+
stub_get(@api_key, "campaigns/#{@campaign.campaign_id}/bounces.json?page=1&pagesize=1000&orderfield=date&orderdirection=asc&date=#{CGI.escape(min_date)}", "campaign_bounces.json")
|
132
|
+
bounces = @campaign.bounces min_date
|
132
133
|
bounces.Results.size.should == 2
|
133
134
|
bounces.Results.first.EmailAddress.should == "asdf@softbouncemyemail.com"
|
134
135
|
bounces.Results.first.ListID.should == "654523a5855b4a440bae3fb295641546"
|
data/test/client_test.rb
CHANGED
@@ -30,13 +30,26 @@ class ClientTest < Test::Unit::TestCase
|
|
30
30
|
campaigns = @client.campaigns
|
31
31
|
campaigns.size.should == 2
|
32
32
|
campaigns.first.CampaignID.should == 'fc0ce7105baeaf97f47c99be31d02a91'
|
33
|
-
campaigns.first.WebVersionURL.should == 'http://
|
33
|
+
campaigns.first.WebVersionURL.should == 'http://createsend.com/t/r-765E86829575EE2C'
|
34
34
|
campaigns.first.Subject.should == 'Campaign One'
|
35
35
|
campaigns.first.Name.should == 'Campaign One'
|
36
36
|
campaigns.first.SentDate.should == '2010-10-12 12:58:00'
|
37
37
|
campaigns.first.TotalRecipients.should == 2245
|
38
38
|
end
|
39
39
|
|
40
|
+
should "get scheduled campaigns" do
|
41
|
+
stub_get(@api_key, "clients/#{@client.client_id}/scheduled.json", "scheduled_campaigns.json")
|
42
|
+
campaigns = @client.scheduled
|
43
|
+
campaigns.size.should == 2
|
44
|
+
campaigns.first.DateScheduled.should == "2011-05-25 10:40:00"
|
45
|
+
campaigns.first.ScheduledTimeZone.should == "(GMT+10:00) Canberra, Melbourne, Sydney"
|
46
|
+
campaigns.first.CampaignID.should == "827dbbd2161ea9989fa11ad562c66937"
|
47
|
+
campaigns.first.Name.should == "Magic Issue One"
|
48
|
+
campaigns.first.Subject.should == "Magic Issue One"
|
49
|
+
campaigns.first.DateCreated.should == "2011-05-24 10:37:00"
|
50
|
+
campaigns.first.PreviewURL.should == "http://createsend.com/t/r-DD543521A87C9B8B"
|
51
|
+
end
|
52
|
+
|
40
53
|
should "get all drafts" do
|
41
54
|
stub_get(@api_key, "clients/#{@client.client_id}/drafts.json", "drafts.json")
|
42
55
|
drafts = @client.drafts
|
@@ -45,7 +58,7 @@ class ClientTest < Test::Unit::TestCase
|
|
45
58
|
drafts.first.Name.should == 'Draft One'
|
46
59
|
drafts.first.Subject.should == 'Draft One'
|
47
60
|
drafts.first.DateCreated.should == '2010-08-19 16:08:00'
|
48
|
-
drafts.first.PreviewURL.should == 'http://
|
61
|
+
drafts.first.PreviewURL.should == 'http://createsend.com/t/r-E97A7BB2E6983DA1'
|
49
62
|
end
|
50
63
|
|
51
64
|
should "get all lists" do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[
|
2
2
|
{
|
3
|
-
"WebVersionURL": "http://
|
3
|
+
"WebVersionURL": "http://createsend.com/t/r-765E86829575EE2C",
|
4
4
|
"CampaignID": "fc0ce7105baeaf97f47c99be31d02a91",
|
5
5
|
"Subject": "Campaign One",
|
6
6
|
"Name": "Campaign One",
|
@@ -8,7 +8,7 @@
|
|
8
8
|
"TotalRecipients": 2245
|
9
9
|
},
|
10
10
|
{
|
11
|
-
"WebVersionURL": "http://
|
11
|
+
"WebVersionURL": "http://createsend.com/t/r-DD543566A87C9B8B",
|
12
12
|
"CampaignID": "072472b88c853ae5dedaeaf549a8d607",
|
13
13
|
"Subject": "Campaign Two",
|
14
14
|
"Name": "Campaign Two",
|
data/test/fixtures/drafts.json
CHANGED
@@ -4,13 +4,13 @@
|
|
4
4
|
"Name": "Draft One",
|
5
5
|
"Subject": "Draft One",
|
6
6
|
"DateCreated": "2010-08-19 16:08:00",
|
7
|
-
"PreviewURL": "http://
|
7
|
+
"PreviewURL": "http://createsend.com/t/r-E97A7BB2E6983DA1"
|
8
8
|
},
|
9
9
|
{
|
10
10
|
"CampaignID": "2e928e982065d92627139208c8c01db1",
|
11
11
|
"Name": "Draft Two",
|
12
12
|
"Subject": "Draft Two",
|
13
13
|
"DateCreated": "2010-08-19 16:08:00",
|
14
|
-
"PreviewURL": "http://
|
14
|
+
"PreviewURL": "http://createsend.com/t/r-E97A7BB2E6983DA1"
|
15
15
|
}
|
16
16
|
]
|
@@ -0,0 +1,20 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"DateScheduled": "2011-05-25 10:40:00",
|
4
|
+
"ScheduledTimeZone": "(GMT+10:00) Canberra, Melbourne, Sydney",
|
5
|
+
"CampaignID": "827dbbd2161ea9989fa11ad562c66937",
|
6
|
+
"Name": "Magic Issue One",
|
7
|
+
"Subject": "Magic Issue One",
|
8
|
+
"DateCreated": "2011-05-24 10:37:00",
|
9
|
+
"PreviewURL": "http://createsend.com/t/r-DD543521A87C9B8B"
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"DateScheduled": "2011-05-29 11:20:00",
|
13
|
+
"ScheduledTimeZone": "(GMT+10:00) Canberra, Melbourne, Sydney",
|
14
|
+
"CampaignID": "4f54bbd2161e65789fa11ad562c66937",
|
15
|
+
"Name": "Magic Issue Two",
|
16
|
+
"Subject": "Magic Issue Two",
|
17
|
+
"DateCreated": "2011-05-24 10:39:00",
|
18
|
+
"PreviewURL": "http://createsend.com/t/r-DD913521A87C9B8B"
|
19
|
+
}
|
20
|
+
]
|
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: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 1
|
10
|
+
version: 0.3.1
|
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: 2011-
|
18
|
+
date: 2011-06-06 00:00:00 +10:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -182,6 +182,7 @@ files:
|
|
182
182
|
- test/fixtures/list_stats.json
|
183
183
|
- test/fixtures/list_webhooks.json
|
184
184
|
- test/fixtures/lists.json
|
185
|
+
- test/fixtures/scheduled_campaigns.json
|
185
186
|
- test/fixtures/segment_details.json
|
186
187
|
- test/fixtures/segment_subscribers.json
|
187
188
|
- test/fixtures/segments.json
|
@@ -269,6 +270,7 @@ test_files:
|
|
269
270
|
- test/fixtures/list_stats.json
|
270
271
|
- test/fixtures/list_webhooks.json
|
271
272
|
- test/fixtures/lists.json
|
273
|
+
- test/fixtures/scheduled_campaigns.json
|
272
274
|
- test/fixtures/segment_details.json
|
273
275
|
- test/fixtures/segment_subscribers.json
|
274
276
|
- test/fixtures/segments.json
|