mosaic-lyris 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. data/Gemfile +3 -0
  2. data/README +4 -0
  3. data/Rakefile +31 -0
  4. data/VERSION +1 -0
  5. data/init.rb +4 -0
  6. data/lib/lyris.rb +2 -0
  7. data/lib/mosaic/lyris.rb +12 -0
  8. data/lib/mosaic/lyris/demographic.rb +65 -0
  9. data/lib/mosaic/lyris/filter.rb +6 -0
  10. data/lib/mosaic/lyris/list.rb +73 -0
  11. data/lib/mosaic/lyris/message.rb +95 -0
  12. data/lib/mosaic/lyris/object.rb +227 -0
  13. data/lib/mosaic/lyris/partner.rb +6 -0
  14. data/lib/mosaic/lyris/record.rb +101 -0
  15. data/lib/mosaic/lyris/trigger.rb +113 -0
  16. data/lib/mosaic/lyris/upload.rb +89 -0
  17. data/lib/mosaic/lyris_mailer.rb +102 -0
  18. data/mosaic-lyris.gemspec +143 -0
  19. data/test/demographic_test.rb +176 -0
  20. data/test/filter_test.rb +6 -0
  21. data/test/http_responder.rb +88 -0
  22. data/test/list_test.rb +49 -0
  23. data/test/message_test.rb +6 -0
  24. data/test/partner_test.rb +6 -0
  25. data/test/record_test.rb +177 -0
  26. data/test/responses/demographic/add_error_name_already_exists.xml +2 -0
  27. data/test/responses/demographic/add_success_12345.xml +2 -0
  28. data/test/responses/demographic/query_all_success.xml +19 -0
  29. data/test/responses/demographic/query_enabled_details_success.xml +12 -0
  30. data/test/responses/demographic/query_enabled_success.xml +13 -0
  31. data/test/responses/list/add_error_name_already_exists.xml +2 -0
  32. data/test/responses/list/add_success_12345.xml +2 -0
  33. data/test/responses/list/delete_error_not_found_99999.xml +2 -0
  34. data/test/responses/list/delete_success_12345.xml +2 -0
  35. data/test/responses/list/query_list_data_success.xml +20 -0
  36. data/test/responses/record/add_error_email_already_exists.xml +2 -0
  37. data/test/responses/record/add_success.xml +2 -0
  38. data/test/responses/record/query_all_success.xml +94 -0
  39. data/test/responses/record/query_all_success_empty.xml +2 -0
  40. data/test/responses/record/query_all_success_page_1.xml +54 -0
  41. data/test/responses/record/query_all_success_page_2.xml +34 -0
  42. data/test/responses/record/query_all_success_page_3.xml +14 -0
  43. data/test/responses/record/query_email_error_not_found.xml +2 -0
  44. data/test/responses/record/query_email_success_active.xml +14 -0
  45. data/test/responses/record/query_email_success_admin_trashed.xml +14 -0
  46. data/test/responses/record/query_email_success_bounced.xml +14 -0
  47. data/test/responses/record/query_email_success_unsubscribed.xml +14 -0
  48. data/test/responses/record/update_error_not_found.xml +2 -0
  49. data/test/responses/record/update_success.xml +2 -0
  50. data/test/responses/triggers/fire_error_invalid_recipients.xml +2 -0
  51. data/test/responses/triggers/fire_error_invalid_trigger_id.xml +2 -0
  52. data/test/responses/triggers/fire_success.xml +2 -0
  53. data/test/test_helper.rb +68 -0
  54. data/test/trigger_test.rb +45 -0
  55. metadata +342 -0
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <DATASET><TYPE>error</TYPE><DATA>A demographic with this name already exists</DATA></DATASET>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <DATASET><TYPE>success</TYPE><DATA>12345</DATA></DATASET>
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <DATASET><TYPE>success</TYPE>
3
+ <RECORD><DATA type="name">enabled checkbox</DATA><DATA type="id">1</DATA><DATA type="type">Checkbox</DATA><DATA type="group">Custom</DATA><DATA type="state">enabled</DATA></RECORD>
4
+ <RECORD><DATA type="name">enabled date</DATA><DATA type="id">2</DATA><DATA type="type">Date</DATA><DATA type="group">Custom</DATA><DATA type="state">enabled</DATA></RECORD>
5
+ <RECORD><DATA type="name">enabled multiple checkbox</DATA><DATA type="id">3</DATA><DATA type="type">Multiple Checkbox</DATA><DATA type="group">Custom</DATA><DATA type="state">enabled</DATA></RECORD>
6
+ <RECORD><DATA type="name">enabled multiple select list</DATA><DATA type="id">4</DATA><DATA type="type">Multiple Select List</DATA><DATA type="group">Custom</DATA><DATA type="state">enabled</DATA></RECORD>
7
+ <RECORD><DATA type="name">enabled radio button</DATA><DATA type="id">5</DATA><DATA type="type">Radio Button</DATA><DATA type="group">Custom</DATA><DATA type="state">enabled</DATA></RECORD>
8
+ <RECORD><DATA type="name">enabled select list</DATA><DATA type="id">6</DATA><DATA type="type">Select List</DATA><DATA type="group">Custom</DATA><DATA type="state">enabled</DATA></RECORD>
9
+ <RECORD><DATA type="name">enabled text</DATA><DATA type="id">7</DATA><DATA type="type">Text</DATA><DATA type="group">Custom</DATA><DATA type="state">enabled</DATA></RECORD>
10
+ <RECORD><DATA type="name">enabled textarea</DATA><DATA type="id">8</DATA><DATA type="type">Textarea</DATA><DATA type="group">Custom</DATA><DATA type="state">enabled</DATA></RECORD>
11
+ <RECORD><DATA type="name">disabled checkbox</DATA><DATA type="id">11</DATA><DATA type="type">Checkbox</DATA><DATA type="group">Custom</DATA><DATA type="state">disabled</DATA></RECORD>
12
+ <RECORD><DATA type="name">disabled date</DATA><DATA type="id">12</DATA><DATA type="type">Date</DATA><DATA type="group">Custom</DATA><DATA type="state">disabled</DATA></RECORD>
13
+ <RECORD><DATA type="name">disabled multiple checkbox</DATA><DATA type="id">13</DATA><DATA type="type">Multiple Checkbox</DATA><DATA type="group">Custom</DATA><DATA type="state">disabled</DATA></RECORD>
14
+ <RECORD><DATA type="name">disabled multiple select list</DATA><DATA type="id">14</DATA><DATA type="type">Multiple Select List</DATA><DATA type="group">Custom</DATA><DATA type="state">disabled</DATA></RECORD>
15
+ <RECORD><DATA type="name">disabled radio button</DATA><DATA type="id">15</DATA><DATA type="type">Radio Button</DATA><DATA type="group">Custom</DATA><DATA type="state">disabled</DATA></RECORD>
16
+ <RECORD><DATA type="name">disabled select list</DATA><DATA type="id">16</DATA><DATA type="type">Select List</DATA><DATA type="group">Custom</DATA><DATA type="state">disabled</DATA></RECORD>
17
+ <RECORD><DATA type="name">disabled text</DATA><DATA type="id">17</DATA><DATA type="type">Text</DATA><DATA type="group">Custom</DATA><DATA type="state">disabled</DATA></RECORD>
18
+ <RECORD><DATA type="name">disabled textarea</DATA><DATA type="id">18</DATA><DATA type="type">Textarea</DATA><DATA type="group">Custom</DATA><DATA type="state">disabled</DATA></RECORD>
19
+ </DATASET>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <DATASET>
3
+ <TYPE>success</TYPE>
4
+ <RECORD><DATA type="name">enabled checkbox</DATA><DATA type="id">1</DATA><DATA type="type">Checkbox</DATA></RECORD>
5
+ <RECORD><DATA type="name">enabled date</DATA><DATA type="id">2</DATA><DATA type="type">Date</DATA></RECORD>
6
+ <RECORD><DATA type="name">enabled multiple checkbox</DATA><DATA type="id">3</DATA><DATA type="type">Multiple Checkbox</DATA><DATA type="option">one</DATA><DATA type="option">two</DATA><DATA type="option">three</DATA><DATA type="option">four</DATA><DATA type="option">five</DATA></RECORD>
7
+ <RECORD><DATA type="name">enabled multiple select list</DATA><DATA type="id">4</DATA><DATA type="type">Multiple Select List</DATA><DATA type="option">one</DATA><DATA type="option">two</DATA><DATA type="option">three</DATA><DATA type="option">four</DATA><DATA type="option">five</DATA><DATA type="option">six</DATA><DATA type="option">seven</DATA><DATA type="option">eight</DATA><DATA type="option">nine</DATA><DATA type="option">ten</DATA></RECORD>
8
+ <RECORD><DATA type="name">enabled radio button</DATA><DATA type="id">5</DATA><DATA type="type">Radio Button</DATA><DATA type="option">one</DATA><DATA type="option">two</DATA><DATA type="option">three</DATA></RECORD>
9
+ <RECORD><DATA type="name">enabled select list</DATA><DATA type="id">6</DATA><DATA type="type">Select List</DATA><DATA type="option">one</DATA><DATA type="option">two</DATA><DATA type="option">three</DATA><DATA type="option">four</DATA><DATA type="option">five</DATA><DATA type="option">six</DATA><DATA type="option">seven</DATA><DATA type="option">eight</DATA></RECORD>
10
+ <RECORD><DATA type="name">enabled text</DATA><DATA type="id">7</DATA><DATA type="type">Text</DATA></RECORD>
11
+ <RECORD><DATA type="name">enabled textarea</DATA><DATA type="id">8</DATA><DATA type="type">Textarea</DATA></RECORD>
12
+ </DATASET>
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <DATASET>
3
+ <TYPE>success</TYPE>
4
+ <RECORD><DATA type="name">EMAIL_ADDRESS</DATA><DATA type="id">0</DATA><DATA type="type">EMAIL</DATA></RECORD>
5
+ <RECORD><DATA type="name">enabled checkbox</DATA><DATA type="id">1</DATA><DATA type="type">Checkbox</DATA></RECORD>
6
+ <RECORD><DATA type="name">enabled date</DATA><DATA type="id">2</DATA><DATA type="type">Date</DATA></RECORD>
7
+ <RECORD><DATA type="name">enabled multiple checkbox</DATA><DATA type="id">3</DATA><DATA type="type">Multiple Checkbox</DATA></RECORD>
8
+ <RECORD><DATA type="name">enabled multiple select list</DATA><DATA type="id">4</DATA><DATA type="type">Multiple Select List</DATA></RECORD>
9
+ <RECORD><DATA type="name">enabled radio button</DATA><DATA type="id">5</DATA><DATA type="type">Radio Button</DATA></RECORD>
10
+ <RECORD><DATA type="name">enabled select list</DATA><DATA type="id">6</DATA><DATA type="type">Select List</DATA></RECORD>
11
+ <RECORD><DATA type="name">enabled text</DATA><DATA type="id">7</DATA><DATA type="type">Text</DATA></RECORD>
12
+ <RECORD><DATA type="name">enabled textarea</DATA><DATA type="id">8</DATA><DATA type="type">Textarea</DATA></RECORD>
13
+ </DATASET>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <DATASET><TYPE>error</TYPE><DATA>Another mailing list with this name already exists</DATA></DATASET>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <DATASET><TYPE>success</TYPE><DATA type="mlid">12345</DATA></DATASET>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <DATASET><TYPE>error</TYPE><DATA>Mailing List (99999) not found</DATA></DATASET>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <DATASET><TYPE>success</TYPE><DATA>Mailing List (12345) deleted.</DATA></DATASET>
@@ -0,0 +1,20 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <DATASET>
3
+ <TYPE>success</TYPE>
4
+ <RECORD>
5
+ <DATA type="name" id="1">list one</DATA>
6
+ <DATA type="messages">11</DATA>
7
+ <DATA type="last-sent">Jan. 1, 2001</DATA>
8
+ <DATA type="members">1,111</DATA>
9
+ <DATA type="status">active</DATA>
10
+ <DATA type="cache-time">2001-01-01T01:01:01+00:00</DATA>
11
+ </RECORD>
12
+ <RECORD>
13
+ <DATA type="name" id="2">list two</DATA>
14
+ <DATA type="messages">22</DATA>
15
+ <DATA type="last-sent">Feb. 2, 2002</DATA>
16
+ <DATA type="members">2,222</DATA>
17
+ <DATA type="status">active</DATA>
18
+ <DATA type="cache-time">2002-02-02T02:02:02+00:00</DATA>
19
+ </RECORD>
20
+ </DATASET>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <DATASET><TYPE>error</TYPE><DATA>Email address already exists</DATA></DATASET>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <DATASET><TYPE>success</TYPE><DATA>abcdef1967</DATA></DATASET>
@@ -0,0 +1,94 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <DATASET>
3
+ <TYPE>success</TYPE>
4
+ <RECORD>
5
+ <DATA type="email">one@one.not</DATA>
6
+ <DATA type="extra" id="proof">yes</DATA>
7
+ <DATA type="extra" id="trashed">n</DATA>
8
+ <DATA type="extra" id="uid">abcdef0001</DATA>
9
+ <DATA type="demographic" id="1">on</DATA>
10
+ <DATA type="demographic" id="2">01/02/03</DATA>
11
+ <DATA type="demographic" id="3">one</DATA>
12
+ <DATA type="demographic" id="3">three</DATA>
13
+ <DATA type="demographic" id="4">two</DATA>
14
+ <DATA type="demographic" id="4">four</DATA>
15
+ <DATA type="demographic" id="5">three</DATA>
16
+ <DATA type="demographic" id="6">six</DATA>
17
+ <DATA type="demographic" id="7">value for every demographic</DATA>
18
+ <DATA type="demographic" id="8">the date value in demographic 2 should be Jan 2, 2003</DATA>
19
+ </RECORD>
20
+ <RECORD>
21
+ <DATA type="email">two@two.not</DATA>
22
+ <DATA type="extra" id="proof">yes</DATA>
23
+ <DATA type="extra" id="trashed">n</DATA>
24
+ <DATA type="extra" id="uid">abcdef0002</DATA>
25
+ <DATA type="demographic" id="1">on</DATA>
26
+ <DATA type="demographic" id="2">02/22/22</DATA>
27
+ <DATA type="demographic" id="5">three</DATA>
28
+ <DATA type="demographic" id="6">six</DATA>
29
+ <DATA type="demographic" id="7">no value for multiple selection demographics</DATA>
30
+ <DATA type="demographic" id="8">the date value in demographic 2 should be Feb 22, 1922</DATA>
31
+ </RECORD>
32
+ <RECORD>
33
+ <DATA type="email">three@three.not</DATA>
34
+ <DATA type="extra" id="proof">yes</DATA>
35
+ <DATA type="extra" id="trashed">n</DATA>
36
+ <DATA type="extra" id="uid">abcdef0003</DATA>
37
+ <DATA type="demographic" id="1">on</DATA>
38
+ <DATA type="demographic" id="2">03/03/33</DATA>
39
+ <DATA type="demographic" id="3">one</DATA>
40
+ <DATA type="demographic" id="3">three</DATA>
41
+ <DATA type="demographic" id="4">two</DATA>
42
+ <DATA type="demographic" id="4">four</DATA>
43
+ <DATA type="demographic" id="5">three</DATA>
44
+ <DATA type="demographic" id="6">six</DATA>
45
+ <DATA type="demographic" id="7">every attribute enabled</DATA>
46
+ <DATA type="demographic" id="8">the date value in demographic 2 should be Mar 3, 1933</DATA>
47
+ </RECORD>
48
+ <RECORD>
49
+ <DATA type="email">four@four.not</DATA>
50
+ <DATA type="extra" id="proof">yes</DATA>
51
+ <DATA type="extra" id="trashed">n</DATA>
52
+ <DATA type="extra" id="uid">abcdef0004</DATA>
53
+ </RECORD>
54
+ <RECORD>
55
+ <DATA type="email">five@five.not</DATA>
56
+ <DATA type="extra" id="trashed">n</DATA>
57
+ <DATA type="extra" id="uid">abcdef0005</DATA>
58
+ <DATA type="demographic" id="7">active</DATA>
59
+ </RECORD>
60
+ <RECORD>
61
+ <DATA type="email">six@six.not</DATA>
62
+ <DATA type="extra" id="state">admin</DATA>
63
+ <DATA type="extra" id="statedate">2006-06-01</DATA>
64
+ <DATA type="extra" id="trashed">y</DATA>
65
+ <DATA type="extra" id="uid">abcdef0006</DATA>
66
+ <DATA type="demographic" id="7">trashed by administrator</DATA>
67
+ </RECORD>
68
+ <RECORD>
69
+ <DATA type="email">seven@seven.not</DATA>
70
+ <DATA type="extra" id="state">unsubscribed</DATA>
71
+ <DATA type="extra" id="statedate">2007-07-01</DATA>
72
+ <DATA type="extra" id="trashed">y</DATA>
73
+ <DATA type="extra" id="uid">abcdef0007</DATA>
74
+ <DATA type="demographic" id="7">unsubscribed</DATA>
75
+ </RECORD>
76
+ <RECORD>
77
+ <DATA type="email">eight@eight.not</DATA>
78
+ <DATA type="extra" id="state">bounced</DATA>
79
+ <DATA type="extra" id="statedate">2008-08-01</DATA>
80
+ <DATA type="extra" id="trashed">y</DATA>
81
+ <DATA type="extra" id="uid">abcdef0008</DATA>
82
+ <DATA type="demographic" id="7">bounced</DATA>
83
+ </RECORD>
84
+ <RECORD>
85
+ <DATA type="email">nine@nine.not</DATA>
86
+ <DATA type="extra" id="trashed">n</DATA>
87
+ <DATA type="extra" id="uid">abcdef0009</DATA>
88
+ </RECORD>
89
+ <RECORD>
90
+ <DATA type="email">ten@ten.not</DATA>
91
+ <DATA type="extra" id="trashed">n</DATA>
92
+ <DATA type="extra" id="uid">abcdef0010</DATA>
93
+ </RECORD>
94
+ </DATASET>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <DATASET><TYPE>success</TYPE></DATASET>
@@ -0,0 +1,54 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <DATASET>
3
+ <TYPE>success</TYPE>
4
+ <RECORD>
5
+ <DATA type="email">one@one.not</DATA>
6
+ <DATA type="extra" id="proof">yes</DATA>
7
+ <DATA type="extra" id="trashed">n</DATA>
8
+ <DATA type="extra" id="uid">abcdef0001</DATA>
9
+ <DATA type="demographic" id="1">on</DATA>
10
+ <DATA type="demographic" id="2">01/02/03</DATA>
11
+ <DATA type="demographic" id="3">one</DATA>
12
+ <DATA type="demographic" id="3">three</DATA>
13
+ <DATA type="demographic" id="4">two</DATA>
14
+ <DATA type="demographic" id="4">four</DATA>
15
+ <DATA type="demographic" id="5">three</DATA>
16
+ <DATA type="demographic" id="6">six</DATA>
17
+ <DATA type="demographic" id="7">value for every demographic</DATA>
18
+ <DATA type="demographic" id="8">the date value in demographic 2 should be Jan 2, 2003</DATA>
19
+ </RECORD>
20
+ <RECORD>
21
+ <DATA type="email">two@two.not</DATA>
22
+ <DATA type="extra" id="proof">yes</DATA>
23
+ <DATA type="extra" id="trashed">n</DATA>
24
+ <DATA type="extra" id="uid">abcdef0002</DATA>
25
+ <DATA type="demographic" id="1">on</DATA>
26
+ <DATA type="demographic" id="2">02/22/22</DATA>
27
+ <DATA type="demographic" id="5">three</DATA>
28
+ <DATA type="demographic" id="6">six</DATA>
29
+ <DATA type="demographic" id="7">no value for multiple selection demographics</DATA>
30
+ <DATA type="demographic" id="8">the date value in demographic 2 should be Feb 22, 1922</DATA>
31
+ </RECORD>
32
+ <RECORD>
33
+ <DATA type="email">three@three.not</DATA>
34
+ <DATA type="extra" id="proof">yes</DATA>
35
+ <DATA type="extra" id="trashed">n</DATA>
36
+ <DATA type="extra" id="uid">abcdef0003</DATA>
37
+ <DATA type="demographic" id="1">on</DATA>
38
+ <DATA type="demographic" id="2">03/03/33</DATA>
39
+ <DATA type="demographic" id="3">one</DATA>
40
+ <DATA type="demographic" id="3">three</DATA>
41
+ <DATA type="demographic" id="4">two</DATA>
42
+ <DATA type="demographic" id="4">four</DATA>
43
+ <DATA type="demographic" id="5">three</DATA>
44
+ <DATA type="demographic" id="6">six</DATA>
45
+ <DATA type="demographic" id="7">every attribute enabled</DATA>
46
+ <DATA type="demographic" id="8">the date value in demographic 2 should be Mar 3, 1933</DATA>
47
+ </RECORD>
48
+ <RECORD>
49
+ <DATA type="email">four@four.not</DATA>
50
+ <DATA type="extra" id="proof">yes</DATA>
51
+ <DATA type="extra" id="trashed">n</DATA>
52
+ <DATA type="extra" id="uid">abcdef0004</DATA>
53
+ </RECORD>
54
+ </DATASET>
@@ -0,0 +1,34 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <DATASET>
3
+ <TYPE>success</TYPE>
4
+ <RECORD>
5
+ <DATA type="email">five@five.not</DATA>
6
+ <DATA type="extra" id="trashed">n</DATA>
7
+ <DATA type="extra" id="uid">abcdef0005</DATA>
8
+ <DATA type="demographic" id="7">active</DATA>
9
+ </RECORD>
10
+ <RECORD>
11
+ <DATA type="email">six@six.not</DATA>
12
+ <DATA type="extra" id="state">admin</DATA>
13
+ <DATA type="extra" id="statedate">2006-06-01</DATA>
14
+ <DATA type="extra" id="trashed">y</DATA>
15
+ <DATA type="extra" id="uid">abcdef0006</DATA>
16
+ <DATA type="demographic" id="7">trashed by administrator</DATA>
17
+ </RECORD>
18
+ <RECORD>
19
+ <DATA type="email">seven@seven.not</DATA>
20
+ <DATA type="extra" id="state">unsubscribed</DATA>
21
+ <DATA type="extra" id="statedate">2007-07-01</DATA>
22
+ <DATA type="extra" id="trashed">y</DATA>
23
+ <DATA type="extra" id="uid">abcdef0007</DATA>
24
+ <DATA type="demographic" id="7">unsubscribed</DATA>
25
+ </RECORD>
26
+ <RECORD>
27
+ <DATA type="email">eight@eight.not</DATA>
28
+ <DATA type="extra" id="state">bounced</DATA>
29
+ <DATA type="extra" id="statedate">2008-08-01</DATA>
30
+ <DATA type="extra" id="trashed">y</DATA>
31
+ <DATA type="extra" id="uid">abcdef0008</DATA>
32
+ <DATA type="demographic" id="7">bounced</DATA>
33
+ </RECORD>
34
+ </DATASET>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <DATASET>
3
+ <TYPE>success</TYPE>
4
+ <RECORD>
5
+ <DATA type="email">nine@nine.not</DATA>
6
+ <DATA type="extra" id="trashed">n</DATA>
7
+ <DATA type="extra" id="uid">abcdef0009</DATA>
8
+ </RECORD>
9
+ <RECORD>
10
+ <DATA type="email">ten@ten.not</DATA>
11
+ <DATA type="extra" id="trashed">n</DATA>
12
+ <DATA type="extra" id="uid">abcdef0010</DATA>
13
+ </RECORD>
14
+ </DATASET>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <DATASET><TYPE>error</TYPE><DATA>Can't find email address or unique id</DATA></DATASET>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <DATASET>
3
+ <TYPE>success</TYPE>
4
+ <RECORD>
5
+ <DATA type="extra" id="state">active</DATA>
6
+ <DATA type="extra" id="joindate">2001-01-11 01:01:01</DATA>
7
+ <DATA type="extra" id="proof">yes</DATA>
8
+ <DATA type="extra" id="trashed">n</DATA>
9
+ <DATA type="extra" id="uid">abcdef1111</DATA>
10
+ <DATA type="extra" id="email">active@email.not</DATA>
11
+ <DATA type="demographic" id="2">01/11/81</DATA>
12
+ <DATA type="demographic" id="7">this email is active</DATA>
13
+ </RECORD>
14
+ </DATASET>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <DATASET>
3
+ <TYPE>success</TYPE>
4
+ <RECORD>
5
+ <DATA type="extra" id="state">admin</DATA>
6
+ <DATA type="extra" id="statedate">2009-11-17</DATA>
7
+ <DATA type="extra" id="joindate">2002-02-12 02:02:02</DATA>
8
+ <DATA type="extra" id="trashed">y</DATA>
9
+ <DATA type="extra" id="uid">abcdef2222</DATA>
10
+ <DATA type="extra" id="email">admin.trashed@email.not</DATA>
11
+ <DATA type="demographic" id="2">02/12/82</DATA>
12
+ <DATA type="demographic" id="7">this email is admin trashed</DATA>
13
+ </RECORD>
14
+ </DATASET>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <DATASET>
3
+ <TYPE>success</TYPE>
4
+ <RECORD>
5
+ <DATA type="extra" id="state">bounced</DATA>
6
+ <DATA type="extra" id="statedate">2009-11-17</DATA>
7
+ <DATA type="extra" id="joindate">2003-03-13 03:03:03</DATA>
8
+ <DATA type="extra" id="trashed">y</DATA>
9
+ <DATA type="extra" id="uid">abcdef3333</DATA>
10
+ <DATA type="extra" id="email">bounced@email.not</DATA>
11
+ <DATA type="demographic" id="2">03/13/93</DATA>
12
+ <DATA type="demographic" id="7">this email is bounced</DATA>
13
+ </RECORD>
14
+ </DATASET>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <DATASET>
3
+ <TYPE>success</TYPE>
4
+ <RECORD>
5
+ <DATA type="extra" id="state">unsubscribed</DATA>
6
+ <DATA type="extra" id="statedate">2009-11-17</DATA>
7
+ <DATA type="extra" id="joindate">2004-04-14 04:04:04</DATA>
8
+ <DATA type="extra" id="trashed">y</DATA>
9
+ <DATA type="extra" id="uid">abcdef4444</DATA>
10
+ <DATA type="extra" id="email">unsubscribed@email.not</DATA>
11
+ <DATA type="demographic" id="2">04/14/94</DATA>
12
+ <DATA type="demographic" id="7">this email is unsubscribed</DATA>
13
+ </RECORD>
14
+ </DATASET>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <DATASET><TYPE>error</TYPE><DATA>Can't find email address</DATA></DATASET
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <DATASET><TYPE>success</TYPE><DATA>abcdef1111</DATA></DATASET>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <DATASET><TYPE>error</TYPE><DATA>Invalid Recipients</DATA></DATASET>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <DATASET><TYPE>error</TYPE><DATA>Invalid Trigger ID</DATA></DATASET>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <DATASET><TYPE>success</TYPE><DATA type="sent">one@email.not,two@email.not,three@email.not</DATA><DATA type="not sent">four@email.not</DATA></DATASET>
@@ -0,0 +1,68 @@
1
+ require 'test/unit'
2
+ require 'mocha/setup'
3
+
4
+ require 'active_support/core_ext/time/calculations'
5
+
6
+ require File.join(File.dirname(__FILE__),'http_responder')
7
+
8
+ require File.join(File.dirname(__FILE__),'..','lib','mosaic','lyris.rb')
9
+
10
+ begin
11
+ config_path = File.expand_path("../config.yml", __FILE__)
12
+ Mosaic::Lyris::Object.configuration = YAML.load_file(config_path)
13
+ rescue Errno::ENOENT => e
14
+ STDERR.puts "WARNING: For tests to succeed, you must set valid configuration parameters in '#{config_path}'"
15
+ STDERR.puts "Sample configuration..."
16
+ STDERR.puts <<SAMPLECONFIG
17
+ server: 'www.elabs6.com'
18
+ site_id: 99999999
19
+ password: 'xxxxxxxx'
20
+ SAMPLECONFIG
21
+ STDERR.puts
22
+ raise
23
+ end
24
+
25
+ Time.zone_default = ActiveSupport::TimeZone['Eastern Time (US & Canada)']
26
+
27
+ Net::HTTP.block_requests
28
+
29
+ def lyris_response(file, type, activity, input = nil)
30
+ conditions = { :type => type, :activity => activity }
31
+ conditions[:input] = input if input
32
+ Net::HTTP.respond_to :post, '/API/mailing_list.html', File.join(File.dirname(__FILE__),'responses',type,file), conditions
33
+ end
34
+
35
+ # list requests
36
+ lyris_response 'add_success_12345.xml', 'list', 'add', %r(<DATA type="name">new list</DATA>)m
37
+ lyris_response 'add_error_name_already_exists.xml', 'list', 'add', %r(<DATA type="name">duplicate list</DATA>)m
38
+ lyris_response 'delete_error_not_found_99999.xml', 'list', 'delete', %r(<MLID>99999</MLID>)m
39
+ lyris_response 'delete_success_12345.xml', 'list', 'delete', %r(<MLID>12345</MLID>)m
40
+ lyris_response 'query_list_data_success.xml', 'list', 'query-listdata'
41
+
42
+ # demographic requests
43
+ lyris_response 'add_success_12345.xml', 'demographic', 'add', %r(<MLID>.*?</MLID>.*?<DATA type=".*?">new .*?</DATA>)m
44
+ lyris_response 'add_error_name_already_exists.xml', 'demographic', 'add', %r(<MLID>.*?</MLID>.*?<DATA type="text">duplicate text</DATA>)m
45
+ lyris_response 'query_all_success.xml', 'demographic', 'query-all', %r(<MLID>.*?</MLID>)m
46
+ lyris_response 'query_enabled_success.xml', 'demographic', 'query-enabled', %r(<MLID>.*?</MLID>)m
47
+ lyris_response 'query_enabled_details_success.xml', 'demographic', 'query-enabled-details', %r(<MLID>.*?</MLID>)m
48
+
49
+ # record requests
50
+ lyris_response 'query_all_success.xml', 'record', 'query-listdata', %r(<MLID>1</MLID>)m
51
+ lyris_response 'query_all_success_empty.xml', 'record', 'query-listdata', %r(<MLID>2</MLID>)m
52
+ lyris_response 'query_all_success_page_1.xml', 'record', 'query-listdata', %r(<MLID>3</MLID>.*?<DATA type="extra" id="page">1</DATA>)m
53
+ lyris_response 'query_all_success_page_2.xml', 'record', 'query-listdata', %r(<MLID>3</MLID>.*?<DATA type="extra" id="page">2</DATA>)m
54
+ lyris_response 'query_all_success_page_3.xml', 'record', 'query-listdata', %r(<MLID>3</MLID>.*?<DATA type="extra" id="page">3</DATA>)m
55
+ lyris_response 'add_success.xml', 'record', 'add', %r(<MLID>1</MLID>.*?<DATA type="email">new@email.not</DATA>)m
56
+ lyris_response 'add_error_email_already_exists.xml', 'record', 'add', %r(<MLID>1</MLID>.*?<DATA type="email">duplicate@email.not</DATA>)m
57
+ lyris_response 'query_email_error_not_found.xml', 'record', 'query-data', %r(<MLID>1</MLID>.*?<DATA type="email">missing@email.not</DATA>)m
58
+ lyris_response 'query_email_success_active.xml', 'record', 'query-data', %r(<MLID>1</MLID>.*?<DATA type="email">active@email.not</DATA>)m
59
+ lyris_response 'query_email_success_admin_trashed.xml', 'record', 'query-data', %r(<MLID>1</MLID>.*?<DATA type="email">admin.trashed@email.not</DATA>)m
60
+ lyris_response 'query_email_success_bounced.xml', 'record', 'query-data', %r(<MLID>1</MLID>.*?<DATA type="email">bounced@email.not</DATA>)m
61
+ lyris_response 'query_email_success_unsubscribed.xml', 'record', 'query-data', %r(<MLID>1</MLID>.*?<DATA type="email">unsubscribed@email.not</DATA>)m
62
+ lyris_response 'update_error_not_found.xml', 'record', 'update', %r(<MLID>1</MLID>.*?<DATA type="email">missing@email.not</DATA>)m
63
+ lyris_response 'update_success.xml', 'record', 'update', %r(<MLID>1</MLID>.*?<DATA type="email">active@email.not</DATA>)m
64
+
65
+ # trigger requests
66
+ lyris_response 'fire_error_invalid_trigger_id.xml', 'triggers', 'fire-trigger', %r(<MLID>1</MLID>.*?<DATA type="extra" id="trigger_id">666</DATA>)m
67
+ lyris_response 'fire_error_invalid_recipients.xml', 'triggers', 'fire-trigger', %r(<MLID>1</MLID>.*?<DATA type="extra" id="trigger_id">1</DATA>.*?<DATA type="extra" id="recipients">invalid@email.not</DATA>)m
68
+ lyris_response 'fire_success.xml', 'triggers', 'fire-trigger', %r(<MLID>1</MLID>.*?<DATA type="extra" id="trigger_id">1</DATA>.*?<DATA type="extra" id="recipients">one@email.not,two@email.not,three@email.not</DATA>)m