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,45 @@
1
+ require File.join(File.dirname(__FILE__),'test_helper')
2
+
3
+ class TestTrigger < Test::Unit::TestCase
4
+ def teardown
5
+ Net::HTTP.block_requests
6
+ end
7
+
8
+ MESSAGE = <<END_OF_MESSAGE
9
+ <html>
10
+ <head>
11
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
12
+ <title>this is a test</title>
13
+ </head>
14
+ <body style="margin:0px;padding:0px; background-color: #333; outline:0px;">
15
+ <h1 style="color: #FFF;">THIS IS A TEST</h1>
16
+ <p style="color: #CCC;">hello</p>
17
+ <p style="color: #CCC;">test message to: <strong style="color: #FFF;">%%EMAIL_ADDRESS%%</strong></p>
18
+ <p style="color: #CCC;">goodbye</p>
19
+ </body>
20
+ </html>
21
+ END_OF_MESSAGE
22
+
23
+ def test_fire
24
+ trigger = Mosaic::Lyris::Trigger.fire(1, 'one@email.not', 'two@email.not', 'three@email.not', :list_id => 1, :subject => 'this is a test', :clickthru => true, :add => true, :message => MESSAGE)
25
+ assert_instance_of Mosaic::Lyris::Trigger, trigger
26
+ assert_equal %w(one@email.not two@email.not three@email.not), trigger.sent
27
+ assert_equal %w(four@email.not), trigger.not_sent
28
+ assert_equal 'this is a test', trigger.subject
29
+ assert_equal true, trigger.clickthru
30
+ assert_equal true, trigger.add
31
+ assert_equal MESSAGE, trigger.message
32
+ end
33
+
34
+ def test_fire_invalid_recipients
35
+ assert_raise Mosaic::Lyris::Error do
36
+ Mosaic::Lyris::Trigger.fire(1, 'invalid@email.not', :list_id => 1)
37
+ end
38
+ end
39
+
40
+ def test_fire_invalid_trigger_id
41
+ assert_raise Mosaic::Lyris::Error do
42
+ Mosaic::Lyris::Trigger.fire(666, 'one@email.not', :list_id => 1)
43
+ end
44
+ end
45
+ end
metadata ADDED
@@ -0,0 +1,342 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mosaic-lyris
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 0
8
+ - 1
9
+ version: 1.0.1
10
+ platform: ruby
11
+ authors:
12
+ - S. Brent Faulkner
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2013-03-07 00:00:00 -05:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ prerelease: false
22
+ type: :runtime
23
+ name: mosaic-lyris
24
+ version_requirements: &id001 !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ requirement: *id001
32
+ - !ruby/object:Gem::Dependency
33
+ prerelease: false
34
+ type: :development
35
+ name: jeweler
36
+ version_requirements: &id002 !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ segments:
41
+ - 0
42
+ version: "0"
43
+ requirement: *id002
44
+ - !ruby/object:Gem::Dependency
45
+ prerelease: false
46
+ type: :development
47
+ name: jeweler
48
+ version_requirements: &id003 !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ segments:
53
+ - 0
54
+ version: "0"
55
+ requirement: *id003
56
+ - !ruby/object:Gem::Dependency
57
+ prerelease: false
58
+ type: :development
59
+ name: mocha
60
+ version_requirements: &id004 !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ segments:
65
+ - 0
66
+ version: "0"
67
+ requirement: *id004
68
+ - !ruby/object:Gem::Dependency
69
+ prerelease: false
70
+ type: :development
71
+ name: mocha
72
+ version_requirements: &id005 !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ segments:
77
+ - 0
78
+ version: "0"
79
+ requirement: *id005
80
+ - !ruby/object:Gem::Dependency
81
+ prerelease: false
82
+ type: :development
83
+ name: mocha
84
+ version_requirements: &id006 !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ segments:
89
+ - 0
90
+ version: "0"
91
+ requirement: *id006
92
+ - !ruby/object:Gem::Dependency
93
+ prerelease: false
94
+ type: :development
95
+ name: mocha
96
+ version_requirements: &id007 !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ segments:
101
+ - 0
102
+ version: "0"
103
+ requirement: *id007
104
+ - !ruby/object:Gem::Dependency
105
+ prerelease: false
106
+ type: :development
107
+ name: mocha
108
+ version_requirements: &id008 !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ segments:
113
+ - 0
114
+ version: "0"
115
+ requirement: *id008
116
+ - !ruby/object:Gem::Dependency
117
+ prerelease: false
118
+ type: :development
119
+ name: mocha
120
+ version_requirements: &id009 !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ segments:
125
+ - 0
126
+ version: "0"
127
+ requirement: *id009
128
+ - !ruby/object:Gem::Dependency
129
+ prerelease: false
130
+ type: :development
131
+ name: mocha
132
+ version_requirements: &id010 !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ segments:
137
+ - 0
138
+ version: "0"
139
+ requirement: *id010
140
+ - !ruby/object:Gem::Dependency
141
+ prerelease: false
142
+ type: :development
143
+ name: mocha
144
+ version_requirements: &id011 !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ segments:
149
+ - 0
150
+ version: "0"
151
+ requirement: *id011
152
+ - !ruby/object:Gem::Dependency
153
+ prerelease: false
154
+ type: :development
155
+ name: mocha
156
+ version_requirements: &id012 !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ segments:
161
+ - 0
162
+ version: "0"
163
+ requirement: *id012
164
+ - !ruby/object:Gem::Dependency
165
+ prerelease: false
166
+ type: :development
167
+ name: mocha
168
+ version_requirements: &id013 !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ segments:
173
+ - 0
174
+ version: "0"
175
+ requirement: *id013
176
+ - !ruby/object:Gem::Dependency
177
+ prerelease: false
178
+ type: :runtime
179
+ name: builder
180
+ version_requirements: &id014 !ruby/object:Gem::Requirement
181
+ requirements:
182
+ - - ">="
183
+ - !ruby/object:Gem::Version
184
+ segments:
185
+ - 0
186
+ version: "0"
187
+ requirement: *id014
188
+ - !ruby/object:Gem::Dependency
189
+ prerelease: false
190
+ type: :runtime
191
+ name: active_support
192
+ version_requirements: &id015 !ruby/object:Gem::Requirement
193
+ requirements:
194
+ - - ">="
195
+ - !ruby/object:Gem::Version
196
+ segments:
197
+ - 0
198
+ version: "0"
199
+ requirement: *id015
200
+ - !ruby/object:Gem::Dependency
201
+ prerelease: false
202
+ type: :runtime
203
+ name: htmlentities
204
+ version_requirements: &id016 !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ segments:
209
+ - 0
210
+ version: "0"
211
+ requirement: *id016
212
+ - !ruby/object:Gem::Dependency
213
+ prerelease: false
214
+ type: :runtime
215
+ name: nokogiri
216
+ version_requirements: &id017 !ruby/object:Gem::Requirement
217
+ requirements:
218
+ - - ">="
219
+ - !ruby/object:Gem::Version
220
+ segments:
221
+ - 0
222
+ version: "0"
223
+ requirement: *id017
224
+ - !ruby/object:Gem::Dependency
225
+ prerelease: false
226
+ type: :runtime
227
+ name: tzinfo
228
+ version_requirements: &id018 !ruby/object:Gem::Requirement
229
+ requirements:
230
+ - - ">="
231
+ - !ruby/object:Gem::Version
232
+ segments:
233
+ - 0
234
+ version: "0"
235
+ requirement: *id018
236
+ - !ruby/object:Gem::Dependency
237
+ prerelease: false
238
+ type: :development
239
+ name: mocha
240
+ version_requirements: &id019 !ruby/object:Gem::Requirement
241
+ requirements:
242
+ - - ">="
243
+ - !ruby/object:Gem::Version
244
+ segments:
245
+ - 0
246
+ version: "0"
247
+ requirement: *id019
248
+ description: A wrapper for the Lyris/EmailLabs API to simplify integration
249
+ email: brent.faulkner@mosaic.com
250
+ executables: []
251
+
252
+ extensions: []
253
+
254
+ extra_rdoc_files:
255
+ - README
256
+ files:
257
+ - Gemfile
258
+ - README
259
+ - Rakefile
260
+ - VERSION
261
+ - init.rb
262
+ - lib/lyris.rb
263
+ - lib/mosaic/lyris.rb
264
+ - lib/mosaic/lyris/demographic.rb
265
+ - lib/mosaic/lyris/filter.rb
266
+ - lib/mosaic/lyris/list.rb
267
+ - lib/mosaic/lyris/message.rb
268
+ - lib/mosaic/lyris/object.rb
269
+ - lib/mosaic/lyris/partner.rb
270
+ - lib/mosaic/lyris/record.rb
271
+ - lib/mosaic/lyris/trigger.rb
272
+ - lib/mosaic/lyris/upload.rb
273
+ - lib/mosaic/lyris_mailer.rb
274
+ - mosaic-lyris.gemspec
275
+ - test/demographic_test.rb
276
+ - test/filter_test.rb
277
+ - test/http_responder.rb
278
+ - test/list_test.rb
279
+ - test/message_test.rb
280
+ - test/partner_test.rb
281
+ - test/record_test.rb
282
+ - test/responses/demographic/add_error_name_already_exists.xml
283
+ - test/responses/demographic/add_success_12345.xml
284
+ - test/responses/demographic/query_all_success.xml
285
+ - test/responses/demographic/query_enabled_details_success.xml
286
+ - test/responses/demographic/query_enabled_success.xml
287
+ - test/responses/list/add_error_name_already_exists.xml
288
+ - test/responses/list/add_success_12345.xml
289
+ - test/responses/list/delete_error_not_found_99999.xml
290
+ - test/responses/list/delete_success_12345.xml
291
+ - test/responses/list/query_list_data_success.xml
292
+ - test/responses/record/add_error_email_already_exists.xml
293
+ - test/responses/record/add_success.xml
294
+ - test/responses/record/query_all_success.xml
295
+ - test/responses/record/query_all_success_empty.xml
296
+ - test/responses/record/query_all_success_page_1.xml
297
+ - test/responses/record/query_all_success_page_2.xml
298
+ - test/responses/record/query_all_success_page_3.xml
299
+ - test/responses/record/query_email_error_not_found.xml
300
+ - test/responses/record/query_email_success_active.xml
301
+ - test/responses/record/query_email_success_admin_trashed.xml
302
+ - test/responses/record/query_email_success_bounced.xml
303
+ - test/responses/record/query_email_success_unsubscribed.xml
304
+ - test/responses/record/update_error_not_found.xml
305
+ - test/responses/record/update_success.xml
306
+ - test/responses/triggers/fire_error_invalid_recipients.xml
307
+ - test/responses/triggers/fire_error_invalid_trigger_id.xml
308
+ - test/responses/triggers/fire_success.xml
309
+ - test/test_helper.rb
310
+ - test/trigger_test.rb
311
+ has_rdoc: true
312
+ homepage: http://github.com/mosaicxm/mosaic-lyris
313
+ licenses: []
314
+
315
+ post_install_message:
316
+ rdoc_options: []
317
+
318
+ require_paths:
319
+ - lib
320
+ required_ruby_version: !ruby/object:Gem::Requirement
321
+ requirements:
322
+ - - ">="
323
+ - !ruby/object:Gem::Version
324
+ segments:
325
+ - 0
326
+ version: "0"
327
+ required_rubygems_version: !ruby/object:Gem::Requirement
328
+ requirements:
329
+ - - ">="
330
+ - !ruby/object:Gem::Version
331
+ segments:
332
+ - 0
333
+ version: "0"
334
+ requirements: []
335
+
336
+ rubyforge_project:
337
+ rubygems_version: 1.3.6
338
+ signing_key:
339
+ specification_version: 3
340
+ summary: Lyris/EmailLabs API
341
+ test_files: []
342
+