pew_pew 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/.gitignore +19 -0
  2. data/.rspec +2 -0
  3. data/.yardopts +1 -0
  4. data/Gemfile +3 -0
  5. data/LICENSE +22 -0
  6. data/README.md +84 -0
  7. data/Rakefile +3 -0
  8. data/lib/pew_pew.rb +32 -0
  9. data/lib/pew_pew/client.rb +90 -0
  10. data/lib/pew_pew/config.rb +15 -0
  11. data/lib/pew_pew/domain.rb +9 -0
  12. data/lib/pew_pew/resource.rb +52 -0
  13. data/lib/pew_pew/resources/bounces.rb +41 -0
  14. data/lib/pew_pew/resources/campaigns.rb +141 -0
  15. data/lib/pew_pew/resources/complaints.rb +40 -0
  16. data/lib/pew_pew/resources/lists.rb +121 -0
  17. data/lib/pew_pew/resources/logs.rb +12 -0
  18. data/lib/pew_pew/resources/mailboxes.rb +41 -0
  19. data/lib/pew_pew/resources/messages.rb +37 -0
  20. data/lib/pew_pew/resources/routes.rb +57 -0
  21. data/lib/pew_pew/resources/stats.rb +12 -0
  22. data/lib/pew_pew/resources/unsubscribes.rb +43 -0
  23. data/lib/pew_pew/response.rb +11 -0
  24. data/lib/pew_pew/version.rb +3 -0
  25. data/pew_pew.gemspec +20 -0
  26. data/spec/fixtures/bounces.yml +144 -0
  27. data/spec/fixtures/campaigns.yml +368 -0
  28. data/spec/fixtures/complaints.yml +142 -0
  29. data/spec/fixtures/image.png +0 -0
  30. data/spec/fixtures/lists.yml +403 -0
  31. data/spec/fixtures/logs.yml +133 -0
  32. data/spec/fixtures/mailboxes.yml +141 -0
  33. data/spec/fixtures/messages.yml +196 -0
  34. data/spec/fixtures/mime.eml +34 -0
  35. data/spec/fixtures/routes.yml +225 -0
  36. data/spec/fixtures/stats.yml +61 -0
  37. data/spec/fixtures/unsubscribes.yml +219 -0
  38. data/spec/pew_pew/client_spec.rb +51 -0
  39. data/spec/pew_pew/config_spec.rb +38 -0
  40. data/spec/pew_pew/resource_spec.rb +46 -0
  41. data/spec/pew_pew/resources/bounces_spec.rb +78 -0
  42. data/spec/pew_pew/resources/campaigns_spec.rb +228 -0
  43. data/spec/pew_pew/resources/complaints_spec.rb +69 -0
  44. data/spec/pew_pew/resources/lists_spec.rb +283 -0
  45. data/spec/pew_pew/resources/logs_spec.rb +28 -0
  46. data/spec/pew_pew/resources/mailboxes_spec.rb +59 -0
  47. data/spec/pew_pew/resources/messages_spec.rb +53 -0
  48. data/spec/pew_pew/resources/routes_spec.rb +135 -0
  49. data/spec/pew_pew/resources/stats_spec.rb +26 -0
  50. data/spec/pew_pew/resources/unsubscribes_spec.rb +99 -0
  51. data/spec/pew_pew/response_spec.rb +21 -0
  52. data/spec/pew_pew_spec.rb +13 -0
  53. data/spec/spec_helper.rb +17 -0
  54. data/spec/support/contexts/api_requests.rb +23 -0
  55. data/spec/support/contexts/domain_resource.rb +17 -0
  56. data/spec/support/vcr.rb +6 -0
  57. metadata +211 -0
@@ -0,0 +1,368 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.mailgun.net/v2/<%= domain %>/campaigns
6
+ body:
7
+ encoding: US-ASCII
8
+ string: name=Test&id=test
9
+ headers:
10
+ User-Agent:
11
+ - PewPew Ruby Gem 0.0.1
12
+ Authorization:
13
+ - Basic <%= basic_auth %>
14
+ Content-Type:
15
+ - application/x-www-form-urlencoded
16
+ response:
17
+ status:
18
+ code: 200
19
+ message:
20
+ headers:
21
+ server:
22
+ - nginx/1.0.14
23
+ date:
24
+ - Sun, 03 Jun 2012 07:28:25 GMT
25
+ content-type:
26
+ - text/html; charset=utf-8
27
+ connection:
28
+ - close
29
+ content-length:
30
+ - '293'
31
+ body:
32
+ encoding: US-ASCII
33
+ string: ! '{"message": "Campaign created", "campaign": {"clicked_count": 0,
34
+ "opened_count": 0, "submitted_count": 0, "unsubscribed_count": 0, "bounced_count":
35
+ 0, "id": "test", "name": "Test", "created_at": "Sun, 03 Jun 2012 07:28:25
36
+ GMT", "delivered_count": 0, "complained_count": 0, "dropped_count": 0}}'
37
+ http_version:
38
+ recorded_at: Sun, 03 Jun 2012 07:28:25 GMT
39
+ - request:
40
+ method: delete
41
+ uri: https://api.mailgun.net/v2/<%= domain %>/campaigns/test
42
+ body:
43
+ encoding: US-ASCII
44
+ string: ''
45
+ headers:
46
+ User-Agent:
47
+ - PewPew Ruby Gem 0.0.1
48
+ Authorization:
49
+ - Basic <%= basic_auth %>
50
+ response:
51
+ status:
52
+ code: 200
53
+ message:
54
+ headers:
55
+ server:
56
+ - nginx/1.0.14
57
+ date:
58
+ - Sun, 03 Jun 2012 07:35:39 GMT
59
+ content-type:
60
+ - application/json
61
+ connection:
62
+ - close
63
+ content-length:
64
+ - '52'
65
+ content-disposition:
66
+ - inline
67
+ body:
68
+ encoding: US-ASCII
69
+ string: ! "{\n \"message\": \"Campaign deleted\", \n \"id\": \"test\"\n}"
70
+ http_version:
71
+ recorded_at: Sun, 03 Jun 2012 07:35:40 GMT
72
+ - request:
73
+ method: post
74
+ uri: https://api.mailgun.net/v2/<%= domain %>/campaigns
75
+ body:
76
+ encoding: US-ASCII
77
+ string: name=Test
78
+ headers:
79
+ User-Agent:
80
+ - PewPew Ruby Gem 0.0.1
81
+ Authorization:
82
+ - Basic <%= basic_auth %>
83
+ Content-Type:
84
+ - application/x-www-form-urlencoded
85
+ response:
86
+ status:
87
+ code: 200
88
+ message:
89
+ headers:
90
+ server:
91
+ - nginx/1.0.14
92
+ date:
93
+ - Sun, 03 Jun 2012 07:36:36 GMT
94
+ content-type:
95
+ - text/html; charset=utf-8
96
+ connection:
97
+ - close
98
+ content-length:
99
+ - '293'
100
+ body:
101
+ encoding: US-ASCII
102
+ string: ! '{"message": "Campaign created", "campaign": {"clicked_count": 0,
103
+ "opened_count": 0, "submitted_count": 0, "unsubscribed_count": 0, "bounced_count":
104
+ 0, "id": "8ben", "name": "Test", "created_at": "Sun, 03 Jun 2012 07:36:36
105
+ GMT", "delivered_count": 0, "complained_count": 0, "dropped_count": 0}}'
106
+ http_version:
107
+ recorded_at: Sun, 03 Jun 2012 07:36:36 GMT
108
+ - request:
109
+ method: get
110
+ uri: https://api.mailgun.net/v2/<%= domain %>/campaigns
111
+ body:
112
+ encoding: US-ASCII
113
+ string: ''
114
+ headers:
115
+ User-Agent:
116
+ - PewPew Ruby Gem 0.0.1
117
+ Authorization:
118
+ - Basic <%= basic_auth %>
119
+ response:
120
+ status:
121
+ code: 200
122
+ message:
123
+ headers:
124
+ server:
125
+ - nginx/1.0.14
126
+ date:
127
+ - Sun, 03 Jun 2012 07:38:42 GMT
128
+ content-type:
129
+ - application/json
130
+ connection:
131
+ - close
132
+ content-length:
133
+ - '376'
134
+ content-disposition:
135
+ - inline
136
+ body:
137
+ encoding: US-ASCII
138
+ string: ! "{\n \"total_count\": 1, \n \"items\": [\n {\n \"clicked_count\":
139
+ 0, \n \"opened_count\": 0, \n \"submitted_count\": 0, \n \"unsubscribed_count\":
140
+ 0, \n \"bounced_count\": 0, \n \"id\": \"8ben\", \n \"name\":
141
+ \"Test\", \n \"created_at\": \"Sun, 03 Jun 2012 07:36:36 GMT\", \n \"delivered_count\":
142
+ 0, \n \"complained_count\": 0, \n \"dropped_count\": 0\n }\n
143
+ \ ]\n}"
144
+ http_version:
145
+ recorded_at: Sun, 03 Jun 2012 07:38:43 GMT
146
+ - request:
147
+ method: get
148
+ uri: https://api.mailgun.net/v2/<%= domain %>/campaigns/8ben
149
+ body:
150
+ encoding: US-ASCII
151
+ string: ''
152
+ headers:
153
+ User-Agent:
154
+ - PewPew Ruby Gem 0.0.1
155
+ Authorization:
156
+ - Basic <%= basic_auth %>
157
+ response:
158
+ status:
159
+ code: 200
160
+ message:
161
+ headers:
162
+ server:
163
+ - nginx/1.0.14
164
+ date:
165
+ - Sun, 03 Jun 2012 07:39:58 GMT
166
+ content-type:
167
+ - text/html; charset=utf-8
168
+ connection:
169
+ - close
170
+ content-length:
171
+ - '248'
172
+ body:
173
+ encoding: US-ASCII
174
+ string: ! '{"clicked_count": 0, "opened_count": 0, "submitted_count": 0, "unsubscribed_count":
175
+ 0, "bounced_count": 0, "id": "8ben", "name": "Test", "created_at": "Sun, 03
176
+ Jun 2012 07:36:36 GMT", "delivered_count": 0, "complained_count": 0, "dropped_count":
177
+ 0}'
178
+ http_version:
179
+ recorded_at: Sun, 03 Jun 2012 07:39:58 GMT
180
+ - request:
181
+ method: get
182
+ uri: https://api.mailgun.net/v2/<%= domain %>/campaigns/8ben/events
183
+ body:
184
+ encoding: US-ASCII
185
+ string: ''
186
+ headers:
187
+ User-Agent:
188
+ - PewPew Ruby Gem 0.0.1
189
+ Authorization:
190
+ - Basic <%= basic_auth %>
191
+ response:
192
+ status:
193
+ code: 200
194
+ message:
195
+ headers:
196
+ server:
197
+ - nginx/1.0.14
198
+ date:
199
+ - Sun, 03 Jun 2012 08:21:01 GMT
200
+ content-type:
201
+ - text/html; charset=utf-8
202
+ connection:
203
+ - close
204
+ content-length:
205
+ - '2'
206
+ body:
207
+ encoding: US-ASCII
208
+ string: ! '[]'
209
+ http_version:
210
+ recorded_at: Sun, 03 Jun 2012 08:21:01 GMT
211
+ - request:
212
+ method: get
213
+ uri: https://api.mailgun.net/v2/<%= domain %>/campaigns/8ben/stats
214
+ body:
215
+ encoding: US-ASCII
216
+ string: ''
217
+ headers:
218
+ User-Agent:
219
+ - PewPew Ruby Gem 0.0.1
220
+ Authorization:
221
+ - Basic <%= basic_auth %>
222
+ response:
223
+ status:
224
+ code: 200
225
+ message:
226
+ headers:
227
+ server:
228
+ - nginx/1.0.14
229
+ date:
230
+ - Sun, 03 Jun 2012 09:21:23 GMT
231
+ content-type:
232
+ - text/html; charset=utf-8
233
+ connection:
234
+ - close
235
+ content-length:
236
+ - '209'
237
+ body:
238
+ encoding: US-ASCII
239
+ string: ! '{"total": {"complained": 0, "delivered": 0, "clicked": 0, "opened":
240
+ 0, "dropped": 0, "bounced": 0, "sent": 0, "unsubscribed": 0}, "unique": {"clicked":
241
+ {"recipient": 0, "link": 0}, "opened": {"recipient": 0}}}'
242
+ http_version:
243
+ recorded_at: Sun, 03 Jun 2012 09:21:23 GMT
244
+ - request:
245
+ method: get
246
+ uri: https://api.mailgun.net/v2/<%= domain %>/campaigns/8ben/clicks?groupby=domain
247
+ body:
248
+ encoding: US-ASCII
249
+ string: ''
250
+ headers:
251
+ User-Agent:
252
+ - PewPew Ruby Gem 0.0.1
253
+ Authorization:
254
+ - Basic <%= basic_auth %>
255
+ response:
256
+ status:
257
+ code: 200
258
+ message:
259
+ headers:
260
+ server:
261
+ - nginx/1.0.14
262
+ date:
263
+ - Sun, 03 Jun 2012 09:27:27 GMT
264
+ content-type:
265
+ - text/html; charset=utf-8
266
+ connection:
267
+ - close
268
+ content-length:
269
+ - '2'
270
+ body:
271
+ encoding: US-ASCII
272
+ string: ! '[]'
273
+ http_version:
274
+ recorded_at: Sun, 03 Jun 2012 09:27:27 GMT
275
+ - request:
276
+ method: get
277
+ uri: https://api.mailgun.net/v2/<%= domain %>/campaigns/8ben/opens?groupby=domain
278
+ body:
279
+ encoding: US-ASCII
280
+ string: ''
281
+ headers:
282
+ User-Agent:
283
+ - PewPew Ruby Gem 0.0.1
284
+ Authorization:
285
+ - Basic <%= basic_auth %>
286
+ response:
287
+ status:
288
+ code: 200
289
+ message:
290
+ headers:
291
+ server:
292
+ - nginx/1.0.14
293
+ date:
294
+ - Sun, 03 Jun 2012 09:30:32 GMT
295
+ content-type:
296
+ - text/html; charset=utf-8
297
+ connection:
298
+ - close
299
+ content-length:
300
+ - '2'
301
+ body:
302
+ encoding: US-ASCII
303
+ string: ! '[]'
304
+ http_version:
305
+ recorded_at: Sun, 03 Jun 2012 09:30:32 GMT
306
+ - request:
307
+ method: get
308
+ uri: https://api.mailgun.net/v2/<%= domain %>/campaigns/8ben/unsubscribes?groupby=domain
309
+ body:
310
+ encoding: US-ASCII
311
+ string: ''
312
+ headers:
313
+ User-Agent:
314
+ - PewPew Ruby Gem 0.0.1
315
+ Authorization:
316
+ - Basic <%= basic_auth %>
317
+ response:
318
+ status:
319
+ code: 200
320
+ message:
321
+ headers:
322
+ server:
323
+ - nginx/1.0.14
324
+ date:
325
+ - Sun, 03 Jun 2012 09:34:11 GMT
326
+ content-type:
327
+ - text/html; charset=utf-8
328
+ connection:
329
+ - close
330
+ content-length:
331
+ - '2'
332
+ body:
333
+ encoding: US-ASCII
334
+ string: ! '[]'
335
+ http_version:
336
+ recorded_at: Sun, 03 Jun 2012 09:34:11 GMT
337
+ - request:
338
+ method: get
339
+ uri: https://api.mailgun.net/v2/<%= domain %>/campaigns/8ben/complaints?groupby=domain
340
+ body:
341
+ encoding: US-ASCII
342
+ string: ''
343
+ headers:
344
+ User-Agent:
345
+ - PewPew Ruby Gem 0.0.1
346
+ Authorization:
347
+ - Basic <%= basic_auth %>
348
+ response:
349
+ status:
350
+ code: 200
351
+ message:
352
+ headers:
353
+ server:
354
+ - nginx/1.0.14
355
+ date:
356
+ - Sun, 03 Jun 2012 09:35:54 GMT
357
+ content-type:
358
+ - text/html; charset=utf-8
359
+ connection:
360
+ - close
361
+ content-length:
362
+ - '2'
363
+ body:
364
+ encoding: US-ASCII
365
+ string: ! '[]'
366
+ http_version:
367
+ recorded_at: Sun, 03 Jun 2012 09:35:54 GMT
368
+ recorded_with: VCR 2.2.0
@@ -0,0 +1,142 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.mailgun.net/v2/<%= domain %>/complaints
6
+ body:
7
+ encoding: US-ASCII
8
+ string: address=test%40example.com
9
+ headers:
10
+ User-Agent:
11
+ - PewPew Ruby Gem 0.0.1
12
+ Authorization:
13
+ - Basic <%= basic_auth %>
14
+ Content-Type:
15
+ - application/x-www-form-urlencoded
16
+ response:
17
+ status:
18
+ code: 200
19
+ message:
20
+ headers:
21
+ server:
22
+ - nginx/1.0.14
23
+ date:
24
+ - Sat, 02 Jun 2012 06:55:56 GMT
25
+ content-type:
26
+ - application/json
27
+ connection:
28
+ - close
29
+ content-length:
30
+ - '98'
31
+ content-disposition:
32
+ - inline
33
+ body:
34
+ encoding: US-ASCII
35
+ string: ! "{\n \"message\": \"Address has been added to the complaints table\",\n
36
+ \ \"address\": \"test@example.com\"\n}"
37
+ http_version:
38
+ recorded_at: Sat, 02 Jun 2012 06:55:56 GMT
39
+ - request:
40
+ method: get
41
+ uri: https://api.mailgun.net/v2/<%= domain %>/complaints/test@example.com
42
+ body:
43
+ encoding: US-ASCII
44
+ string: ''
45
+ headers:
46
+ User-Agent:
47
+ - PewPew Ruby Gem 0.0.1
48
+ Authorization:
49
+ - Basic <%= basic_auth %>
50
+ response:
51
+ status:
52
+ code: 200
53
+ message:
54
+ headers:
55
+ server:
56
+ - nginx/1.0.14
57
+ date:
58
+ - Sat, 02 Jun 2012 06:56:33 GMT
59
+ content-type:
60
+ - application/json
61
+ connection:
62
+ - close
63
+ content-length:
64
+ - '125'
65
+ content-disposition:
66
+ - inline
67
+ body:
68
+ encoding: US-ASCII
69
+ string: ! "{\n \"complaint\": {\n \"count\": 1,\n \"created_at\": \"Sat,
70
+ 02 Jun 2012 06:55:56 GMT\",\n \"address\": \"test@example.com\"\n }\n}"
71
+ http_version:
72
+ recorded_at: Sat, 02 Jun 2012 06:56:33 GMT
73
+ - request:
74
+ method: get
75
+ uri: https://api.mailgun.net/v2/<%= domain %>/complaints
76
+ body:
77
+ encoding: US-ASCII
78
+ string: ''
79
+ headers:
80
+ User-Agent:
81
+ - PewPew Ruby Gem 0.0.1
82
+ Authorization:
83
+ - Basic <%= basic_auth %>
84
+ response:
85
+ status:
86
+ code: 200
87
+ message:
88
+ headers:
89
+ server:
90
+ - nginx/1.0.14
91
+ date:
92
+ - Sat, 02 Jun 2012 07:10:16 GMT
93
+ content-type:
94
+ - application/json
95
+ connection:
96
+ - close
97
+ content-length:
98
+ - '159'
99
+ content-disposition:
100
+ - inline
101
+ body:
102
+ encoding: US-ASCII
103
+ string: ! "{\n \"total_count\": 1,\n \"items\": [\n {\n \"count\":
104
+ 1,\n \"created_at\": \"Sat, 02 Jun 2012 06:55:56 GMT\",\n \"address\":
105
+ \"test@example.com\"\n }\n ]\n}"
106
+ http_version:
107
+ recorded_at: Sat, 02 Jun 2012 07:10:16 GMT
108
+ - request:
109
+ method: delete
110
+ uri: https://api.mailgun.net/v2/<%= domain %>/complaints/test@example.com
111
+ body:
112
+ encoding: US-ASCII
113
+ string: ''
114
+ headers:
115
+ User-Agent:
116
+ - PewPew Ruby Gem 0.0.1
117
+ Authorization:
118
+ - Basic <%= basic_auth %>
119
+ response:
120
+ status:
121
+ code: 200
122
+ message:
123
+ headers:
124
+ server:
125
+ - nginx/1.0.14
126
+ date:
127
+ - Sat, 02 Jun 2012 07:11:04 GMT
128
+ content-type:
129
+ - application/json
130
+ connection:
131
+ - close
132
+ content-length:
133
+ - '83'
134
+ content-disposition:
135
+ - inline
136
+ body:
137
+ encoding: US-ASCII
138
+ string: ! "{\n \"message\": \"Spam complaint has been removed\",\n \"address\":
139
+ \"test@example.com\"\n}"
140
+ http_version:
141
+ recorded_at: Sat, 02 Jun 2012 07:11:04 GMT
142
+ recorded_with: VCR 2.2.0