madmimi 1.0.16 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +2 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +93 -0
- data/README.rdoc +88 -37
- data/Rakefile +2 -30
- data/VERSION +1 -1
- data/config/paths.yml +23 -0
- data/lib/madmimi.rb +210 -123
- data/madmimi.gemspec +130 -22
- data/spec/cassettes/add_to_list/success.yml +54 -0
- data/spec/cassettes/add_to_list/user_does_not_exist.yml +165 -0
- data/spec/cassettes/add_to_list/user_existed.yml +54 -0
- data/spec/cassettes/add_to_list/user_exists.yml +171 -0
- data/spec/cassettes/add_to_list/user_updated.yml +174 -0
- data/spec/cassettes/add_user/user_did_not_exist.yml +54 -0
- data/spec/cassettes/add_user/user_exist.yml +303 -0
- data/spec/cassettes/add_user/user_existed.yml +54 -0
- data/spec/cassettes/add_user/user_missing.yml +138 -0
- data/spec/cassettes/add_user/user_updated.yml +153 -0
- data/spec/cassettes/add_users/users_did_not_exist.yml +54 -0
- data/spec/cassettes/add_users/users_exist.yml +326 -0
- data/spec/cassettes/add_users/users_existed.yml +54 -0
- data/spec/cassettes/add_users/users_missing.yml +305 -0
- data/spec/cassettes/add_users/users_updated.yml +327 -0
- data/spec/cassettes/add_users_to_list/gained_membership.yml +107 -0
- data/spec/cassettes/add_users_to_list/missing_membership.yml +174 -0
- data/spec/cassettes/add_users_to_list/users_did_not_exist.yml +54 -0
- data/spec/cassettes/add_users_to_list/users_exist.yml +365 -0
- data/spec/cassettes/add_users_to_list/users_existed.yml +54 -0
- data/spec/cassettes/add_users_to_list/users_missing.yml +341 -0
- data/spec/cassettes/add_users_to_list/users_updated.yml +365 -0
- data/spec/cassettes/audience_search/does_not_include_suppressed_users.yml +76 -0
- data/spec/cassettes/audience_search/includes_suppressed_users.yml +86 -0
- data/spec/cassettes/csv_import/success.yml +54 -0
- data/spec/cassettes/csv_import/users_exist.yml +273 -0
- data/spec/cassettes/csv_import/users_missing.yml +381 -0
- data/spec/cassettes/delete_list/exists.yml +57 -0
- data/spec/cassettes/delete_list/fail.yml +54 -0
- data/spec/cassettes/delete_list/not_exists.yml +56 -0
- data/spec/cassettes/delete_list/success.yml +54 -0
- data/spec/cassettes/delete_list/users_exist.yml +129 -0
- data/spec/cassettes/list_members/multiple.yml +68 -0
- data/spec/cassettes/list_members/single.yml +68 -0
- data/spec/cassettes/lists/multiple.yml +56 -0
- data/spec/cassettes/lists/single.yml +55 -0
- data/spec/cassettes/mailing_stats/mailing_does_not_exist.yml +50 -0
- data/spec/cassettes/mailing_stats/promotion_and_mailing_exist.yml +57 -0
- data/spec/cassettes/mailing_stats/promotion_does_not_exist.yml +50 -0
- data/spec/cassettes/members/multiple.yml +174 -0
- data/spec/cassettes/members/single.yml +61 -0
- data/spec/cassettes/memberships/multiple.yml +56 -0
- data/spec/cassettes/memberships/single.yml +108 -0
- data/spec/cassettes/new_list/exists.yml +57 -0
- data/spec/cassettes/new_list/fail.yml +52 -0
- data/spec/cassettes/new_list/not_exists.yml +56 -0
- data/spec/cassettes/new_list/success.yml +52 -0
- data/spec/cassettes/promotions/multiple.yml +63 -0
- data/spec/cassettes/promotions/single.yml +61 -0
- data/spec/cassettes/remove_from_all_list/user_does_not_have_memberships.yml +60 -0
- data/spec/cassettes/remove_from_all_lists/user_has_memberships.yml +113 -0
- data/spec/cassettes/remove_from_all_lists/user_with_memberships.yml +49 -0
- data/spec/cassettes/remove_from_list/user_does_not_exist.yml +49 -0
- data/spec/cassettes/remove_from_list/user_in_list_does_not_exist.yml +62 -0
- data/spec/cassettes/remove_from_list/user_in_list_exists.yml +68 -0
- data/spec/cassettes/remove_from_list/user_in_the_list.yml +49 -0
- data/spec/cassettes/remove_from_list/user_not_in_the_list.yml +49 -0
- data/spec/cassettes/save_promotion/only_plain_text.yml +56 -0
- data/spec/cassettes/save_promotion/only_raw_html.yml +56 -0
- data/spec/cassettes/save_promotion/promotion_exists.yml +65 -0
- data/spec/cassettes/save_promotion/promotion_missing.yml +63 -0
- data/spec/cassettes/save_promotion/raw_html_and_plain_text.yml +56 -0
- data/spec/cassettes/send_html/promotion_does_not_exist.yml +56 -0
- data/spec/cassettes/send_html/send_single.yml +53 -0
- data/spec/cassettes/send_html/send_to_all.yml +56 -0
- data/spec/cassettes/send_html/send_to_list.yml +56 -0
- data/spec/cassettes/send_mail/promotion_does_not_exist.yml +54 -0
- data/spec/cassettes/send_mail/send_single.yml +53 -0
- data/spec/cassettes/send_mail/send_to_all.yml +56 -0
- data/spec/cassettes/send_mail/send_to_list.yml +56 -0
- data/spec/cassettes/send_plaintext/promotion_does_not_exist.yml +56 -0
- data/spec/cassettes/send_plaintext/send_single.yml +53 -0
- data/spec/cassettes/send_plaintext/send_to_all.yml +56 -0
- data/spec/cassettes/send_plaintext/send_to_list.yml +56 -0
- data/spec/cassettes/send_plaintext/tracking_beacon_missing.yml +56 -0
- data/spec/cassettes/status/transactional_mail_does_not_exist.yml +51 -0
- data/spec/cassettes/status/transactional_mail_exists.yml +53 -0
- data/spec/cassettes/suppress_email/already_suppressed.yml +51 -0
- data/spec/cassettes/suppress_email/not_suppressed.yml +102 -0
- data/spec/cassettes/suppress_email/user_does_not_exist.yml +100 -0
- data/spec/cassettes/suppress_email/user_is_now_suppressed.yml +51 -0
- data/spec/cassettes/suppress_email/user_not_suppressed.yml +51 -0
- data/spec/cassettes/suppressed/member_does_not_exist.yml +49 -0
- data/spec/cassettes/suppressed/member_is_not_suppressed.yml +51 -0
- data/spec/cassettes/suppressed/member_is_suppressed.yml +51 -0
- data/spec/cassettes/suppressed_since/members_exist.yml +56 -0
- data/spec/cassettes/suppressed_since/no_members.yml +56 -0
- data/spec/cassettes/unsuppress_email/already_suppressed.yml +100 -0
- data/spec/cassettes/unsuppress_email/not_suppressed.yml +99 -0
- data/spec/cassettes/unsuppress_email/user_does_not_exist.yml +99 -0
- data/spec/cassettes/unsuppress_email/user_is_now_unsuppressed.yml +49 -0
- data/spec/cassettes/unsuppress_email/user_suppressed.yml +51 -0
- data/spec/cassettes/update_email/user_does_not_have_permission.yml +52 -0
- data/spec/cassettes/update_email/user_existed.yml +54 -0
- data/spec/cassettes/update_email/user_missing.yml +52 -0
- data/spec/cassettes/update_email/user_with_new_email.yml +345 -0
- data/spec/cassettes/update_email/user_with_old_email.yml +345 -0
- data/spec/madmimi_spec.rb +1166 -0
- data/spec/spec_helper.rb +15 -0
- metadata +210 -96
- data/test/fixtures/lists.xml +0 -7
- data/test/fixtures/promotions.xml +0 -10
- data/test/fixtures/search.xml +0 -38
- data/test/helper.rb +0 -43
- data/test/test_madmimi.rb +0 -63
data/test/test_madmimi.rb
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
require "#{File.dirname(__FILE__)}/helper"
|
2
|
-
|
3
|
-
class TestMadmimi < Test::Unit::TestCase
|
4
|
-
context "An API call" do
|
5
|
-
setup do
|
6
|
-
@mimi = MadMimi.new('email@example.com', 'testapikey')
|
7
|
-
end
|
8
|
-
|
9
|
-
should "retrieve a hash of promotions" do
|
10
|
-
stub_get('/promotions.xml', { :filename => 'promotions.xml'})
|
11
|
-
response = @mimi.promotions
|
12
|
-
flunk "I couldn't find any promotions." unless response.kind_of?(Hash) || !response.empty?
|
13
|
-
end
|
14
|
-
|
15
|
-
should "retrieve a hash of lists" do
|
16
|
-
stub_get('/audience_lists/lists.xml', { :filename => 'lists.xml'})
|
17
|
-
response = @mimi.lists
|
18
|
-
flunk "Doesn't return any lists." unless response.kind_of?(Hash) || !response.empty?
|
19
|
-
end
|
20
|
-
|
21
|
-
should "retrieve a hash of users found with the search term nicholas" do
|
22
|
-
stub_get('/audience_members/search.xml?query=nicholas', { :filename => 'search.xml'})
|
23
|
-
response = @mimi.audience_search('nicholas')
|
24
|
-
flunk "No users found." unless response.kind_of?(Hash) || !response.empty?
|
25
|
-
end
|
26
|
-
|
27
|
-
should "save a raw html promotion" do
|
28
|
-
response_body = 'Saved test_promotion (1)'
|
29
|
-
stub_post('/promotions/save', { :body => response_body })
|
30
|
-
response = @mimi.save_promotion('test_promotion', '<html><body>Hi there!<br>[[unsubscribe]][[tracking_beacon]]</body></html>')
|
31
|
-
assert_equal response_body, response
|
32
|
-
end
|
33
|
-
|
34
|
-
should "save a text promotion" do
|
35
|
-
response_body = 'Saved test_promotion (1)'
|
36
|
-
stub_post('/promotions/save', { :body => response_body })
|
37
|
-
response = @mimi.save_promotion('test_promotion', nil, "Hi there!\n\n[[unsubscribe]]")
|
38
|
-
assert_equal response_body, response
|
39
|
-
end
|
40
|
-
|
41
|
-
should "raise exception on saving a raw html promotion without the required macros" do
|
42
|
-
assert_raises MadMimi::MadMimiError do
|
43
|
-
@mimi.save_promotion('test_promotion', '<html><body>Hi there!<br>[[tracking_beacon]]</body></html>')
|
44
|
-
end
|
45
|
-
|
46
|
-
assert_raises MadMimi::MadMimiError do
|
47
|
-
@mimi.save_promotion('test_promotion', '<html><body>Hi there!<br>[[unsubscribe]]</body></html>')
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
should "raise exception on saving a plain text promotion without the required macro" do
|
52
|
-
assert_raises MadMimi::MadMimiError do
|
53
|
-
@mimi.save_promotion('test_promotion', 'Hi there')
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
should "get a transactional mailing status" do
|
58
|
-
stub_get('/mailers/status/1234', { :https => true, :body => "sent" })
|
59
|
-
response = @mimi.status(1234)
|
60
|
-
assert_equal "sent", response
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|