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.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- createsend (0.2.1)
4
+ createsend (0.3.0)
5
5
  hashie (~> 1.0)
6
6
  httparty (~> 0.7)
7
7
  json
@@ -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,
@@ -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
@@ -1,3 +1,3 @@
1
1
  module CreateSend
2
- VERSION = "0.3.0" unless defined?(CreateSend::VERSION)
2
+ VERSION = "0.3.1" unless defined?(CreateSend::VERSION)
3
3
  end
@@ -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://clientone.createsend.com/t/ViewEmail/r/3A433FC72FFE3B8B/C67FD2F38AC4859C/"
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
- stub_get(@api_key, "campaigns/#{@campaign.campaign_id}/bounces.json?page=1&pagesize=1000&orderfield=date&orderdirection=asc", "campaign_bounces.json")
131
- bounces = @campaign.bounces
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"
@@ -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://hello.createsend.com/t/ViewEmail/r/765E86829575EE2C/C67FD2F38AC4859C/'
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://hello.createsend.com/t/ViewEmail/r/E97A7BB2E6983DA1/C67FD2F38AC4859C/'
61
+ drafts.first.PreviewURL.should == 'http://createsend.com/t/r-E97A7BB2E6983DA1'
49
62
  end
50
63
 
51
64
  should "get all lists" do
@@ -5,5 +5,5 @@
5
5
  "Unsubscribed": 0,
6
6
  "Bounced": 0,
7
7
  "UniqueOpened": 5,
8
- "WebVersionURL": "http://clientone.createsend.com/t/ViewEmail/r/3A433FC72FFE3B8B/C67FD2F38AC4859C/"
8
+ "WebVersionURL": "http://createsend.com/t/r-3A433FC72FFE3B8B"
9
9
  }
@@ -1,6 +1,6 @@
1
1
  [
2
2
  {
3
- "WebVersionURL": "http://hello.createsend.com/t/ViewEmail/r/765E86829575EE2C/C67FD2F38AC4859C/",
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://hello.createsend.com/t/ViewEmail/r/DD543566A87C9B8B/C67FD2F38AC4859C/",
11
+ "WebVersionURL": "http://createsend.com/t/r-DD543566A87C9B8B",
12
12
  "CampaignID": "072472b88c853ae5dedaeaf549a8d607",
13
13
  "Subject": "Campaign Two",
14
14
  "Name": "Campaign Two",
@@ -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://hello.createsend.com/t/ViewEmail/r/E97A7BB2E6983DA1/C67FD2F38AC4859C/"
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://hello.createsend.com/t/ViewEmail/r/E97A7BB2E6983DA1/C67FD2F38AC4859C/"
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: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 0
10
- version: 0.3.0
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-04-18 00:00:00 +10:00
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