pew_pew 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/build.yml +36 -0
- data/.gitignore +1 -0
- data/.rspec +1 -2
- data/Appraisals +7 -0
- data/CHANGELOG.md +7 -2
- data/README.md +6 -0
- data/gemfiles/faraday_2.0.gemfile +7 -0
- data/gemfiles/faraday_2.7.gemfile +7 -0
- data/lib/pew_pew/resource.rb +12 -10
- data/lib/pew_pew/version.rb +1 -1
- data/pew_pew.gemspec +20 -16
- data/spec/fixtures/messages.yml +153 -111
- data/spec/pew_pew/client_spec.rb +47 -39
- data/spec/pew_pew/config_spec.rb +28 -28
- data/spec/pew_pew/resource_spec.rb +42 -36
- data/spec/pew_pew/resources/bounces_spec.rb +57 -53
- data/spec/pew_pew/resources/campaigns_spec.rb +169 -167
- data/spec/pew_pew/resources/complaints_spec.rb +49 -45
- data/spec/pew_pew/resources/lists_spec.rb +209 -195
- data/spec/pew_pew/resources/logs_spec.rb +30 -25
- data/spec/pew_pew/resources/mailboxes_spec.rb +41 -39
- data/spec/pew_pew/resources/messages_spec.rb +49 -45
- data/spec/pew_pew/resources/routes_spec.rb +105 -103
- data/spec/pew_pew/resources/stats_spec.rb +19 -17
- data/spec/pew_pew/resources/unsubscribes_spec.rb +71 -65
- data/spec/pew_pew/response_spec.rb +25 -13
- data/spec/pew_pew_spec.rb +4 -5
- data/spec/spec_helper.rb +1 -1
- data/spec/support/contexts/api_requests.rb +5 -3
- data/spec/support/contexts/domain_resource.rb +1 -1
- data/spec/support/vcr.rb +36 -1
- metadata +84 -50
@@ -1,283 +1,297 @@
|
|
1
|
-
|
1
|
+
module PewPew
|
2
|
+
module Resources
|
3
|
+
RSpec.describe Lists, :resource do
|
4
|
+
let(:resource) { described_class.new(client) }
|
2
5
|
|
3
|
-
|
4
|
-
|
6
|
+
context '#all' do
|
7
|
+
let(:response) { resource.all }
|
5
8
|
|
6
|
-
|
7
|
-
let(:response) { resource.all }
|
9
|
+
subject { response }
|
8
10
|
|
9
|
-
|
11
|
+
specify { should be_success }
|
10
12
|
|
11
|
-
|
13
|
+
its(:status) { should == 200 }
|
14
|
+
its(:total_count) { should == 1 }
|
12
15
|
|
13
|
-
|
14
|
-
|
16
|
+
context 'item' do
|
17
|
+
subject { response.items.first }
|
15
18
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
its(:name) { should == 'Newsletter' }
|
24
|
-
end
|
25
|
-
end
|
19
|
+
its(:address) { should == 'newsletter@pewpew.mailgun.org' }
|
20
|
+
its(:created_at) { should == 'Mon, 04 Jun 2012 16:56:58 GMT' }
|
21
|
+
its(:description) { should == 'Weekly News and Updates' }
|
22
|
+
its(:members_count) { should == 0 }
|
23
|
+
its(:name) { should == 'Newsletter' }
|
24
|
+
end
|
25
|
+
end
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
context '#find' do
|
28
|
+
let(:response) { resource.find('newsletter@pewpew.mailgun.org') }
|
29
29
|
|
30
|
-
|
30
|
+
subject { response }
|
31
31
|
|
32
|
-
|
32
|
+
specify { should be_success }
|
33
33
|
|
34
|
-
|
34
|
+
its(:status) { should == 200 }
|
35
35
|
|
36
|
-
|
37
|
-
|
36
|
+
context 'list' do
|
37
|
+
subject { response.list }
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
39
|
+
its(:address) { should == 'newsletter@pewpew.mailgun.org' }
|
40
|
+
its(:created_at) { should == 'Mon, 04 Jun 2012 16:56:58 GMT' }
|
41
|
+
its(:description) { should == 'Weekly News and Updates' }
|
42
|
+
its(:members_count) { should == 0 }
|
43
|
+
its(:name) { should == 'Newsletter' }
|
44
|
+
end
|
45
|
+
end
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
47
|
+
context '#create' do
|
48
|
+
let(:params) do
|
49
|
+
{
|
50
|
+
address: 'newsletter@pewpew.mailgun.org',
|
51
|
+
description: 'Weekly News and Updates',
|
52
|
+
name: 'Newsletter'
|
53
|
+
}
|
54
|
+
end
|
55
55
|
|
56
|
-
|
56
|
+
let(:response) { resource.create(params) }
|
57
57
|
|
58
|
-
|
58
|
+
subject { response }
|
59
59
|
|
60
|
-
|
60
|
+
specify { should be_success }
|
61
61
|
|
62
|
-
|
63
|
-
|
62
|
+
its(:status) { should == 200 }
|
63
|
+
its(:message) { should == 'Mailing list has been created' }
|
64
64
|
|
65
|
-
|
66
|
-
|
65
|
+
context 'list' do
|
66
|
+
subject { response.list }
|
67
67
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
68
|
+
its(:address) { should == 'newsletter@pewpew.mailgun.org' }
|
69
|
+
its(:created_at) { should == 'Mon, 04 Jun 2012 16:56:58 GMT' }
|
70
|
+
its(:description) { should == 'Weekly News and Updates' }
|
71
|
+
its(:members_count) { should == 0 }
|
72
|
+
its(:name) { should == 'Newsletter' }
|
73
|
+
end
|
74
|
+
end
|
75
75
|
|
76
|
-
|
77
|
-
|
78
|
-
|
76
|
+
context '#update' do
|
77
|
+
let(:params) { { description: 'Monthly News and Updates' } }
|
78
|
+
let(:response) {
|
79
|
+
resource.update('newsletter@pewpew.mailgun.org', params)
|
80
|
+
}
|
79
81
|
|
80
|
-
|
82
|
+
subject { response }
|
81
83
|
|
82
|
-
|
84
|
+
specify { should be_success }
|
83
85
|
|
84
|
-
|
85
|
-
|
86
|
+
its(:status) { should == 200 }
|
87
|
+
its(:message) { should == 'Mailing list has been updated' }
|
86
88
|
|
87
|
-
|
88
|
-
|
89
|
+
context 'list' do
|
90
|
+
subject { response.list }
|
89
91
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
92
|
+
its(:address) { should == 'newsletter@pewpew.mailgun.org' }
|
93
|
+
its(:created_at) { should == 'Mon, 04 Jun 2012 16:56:58 GMT' }
|
94
|
+
its(:description) { should == 'Monthly News and Updates' }
|
95
|
+
its(:members_count) { should == 0 }
|
96
|
+
its(:name) { should == 'Newsletter' }
|
97
|
+
end
|
98
|
+
end
|
97
99
|
|
98
|
-
|
99
|
-
|
100
|
+
context '#remove' do
|
101
|
+
let(:response) { resource.remove('newsletter@pewpew.mailgun.org') }
|
100
102
|
|
101
|
-
|
103
|
+
subject { response }
|
102
104
|
|
103
|
-
|
105
|
+
specify { should be_success }
|
104
106
|
|
105
|
-
|
106
|
-
|
107
|
+
its(:status) { should == 200 }
|
108
|
+
its(:message) { should == 'Mailing list has been deleted' }
|
107
109
|
|
108
|
-
|
109
|
-
|
110
|
+
its(:address) { should == 'newsletter@pewpew.mailgun.org' }
|
111
|
+
end
|
110
112
|
|
111
|
-
|
112
|
-
|
113
|
+
context '#stats' do
|
114
|
+
let(:response) { resource.stats('newsletter@pewpew.mailgun.org') }
|
113
115
|
|
114
|
-
|
116
|
+
subject { response }
|
115
117
|
|
116
|
-
|
118
|
+
specify { should be_success }
|
117
119
|
|
118
|
-
|
120
|
+
its(:status) { should == 200 }
|
119
121
|
|
120
|
-
|
121
|
-
|
122
|
+
context 'total' do
|
123
|
+
subject { response.total }
|
122
124
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
125
|
+
its(:bounced) { should == 0 }
|
126
|
+
its(:clicked) { should == 0 }
|
127
|
+
its(:complained) { should == 0 }
|
128
|
+
its(:delivered) { should == 0 }
|
129
|
+
its(:dropped) { should == 0 }
|
130
|
+
its(:opened) { should == 0 }
|
131
|
+
its(:unsubscribed) { should == 0 }
|
132
|
+
end
|
131
133
|
|
132
|
-
|
133
|
-
|
134
|
-
|
134
|
+
context 'unique' do
|
135
|
+
context 'clicked' do
|
136
|
+
subject { response.unique.clicked }
|
135
137
|
|
136
|
-
|
137
|
-
|
138
|
-
|
138
|
+
its(:link) { should == 0 }
|
139
|
+
its(:recipient) { should == 0 }
|
140
|
+
end
|
139
141
|
|
140
|
-
|
141
|
-
|
142
|
+
context 'opened' do
|
143
|
+
subject { response.unique.opened }
|
142
144
|
|
143
|
-
|
145
|
+
its(:recipient) { should == 0 }
|
146
|
+
end
|
147
|
+
end
|
144
148
|
end
|
145
|
-
end
|
146
|
-
end
|
147
149
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
150
|
+
context '#all_members' do
|
151
|
+
let(:response) do
|
152
|
+
resource.all_members('newsletter@pewpew.mailgun.org')
|
153
|
+
end
|
152
154
|
|
153
|
-
|
155
|
+
subject { response }
|
154
156
|
|
155
|
-
|
157
|
+
specify { should be_success }
|
156
158
|
|
157
|
-
|
158
|
-
|
159
|
+
its(:status) { should == 200 }
|
160
|
+
its(:total_count) { should == 1 }
|
159
161
|
|
160
|
-
|
161
|
-
|
162
|
+
context 'member' do
|
163
|
+
subject { response.items.first }
|
162
164
|
|
163
|
-
|
164
|
-
|
165
|
-
|
165
|
+
its(:address) { should == 'member@example.com' }
|
166
|
+
its(:name) { should == 'Member Name' }
|
167
|
+
its(:subscribed) { should be_truthy }
|
166
168
|
|
167
|
-
|
168
|
-
|
169
|
+
context 'vars' do
|
170
|
+
subject { response.items.first.vars }
|
169
171
|
|
170
|
-
|
172
|
+
its(:awesome) { should be_truthy }
|
173
|
+
end
|
174
|
+
end
|
171
175
|
end
|
172
|
-
end
|
173
|
-
end
|
174
176
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
177
|
+
context '#find_member' do
|
178
|
+
let(:response) do
|
179
|
+
resource.find_member(
|
180
|
+
'newsletter@pewpew.mailgun.org',
|
181
|
+
'member@example.com',
|
182
|
+
)
|
183
|
+
end
|
179
184
|
|
180
|
-
|
185
|
+
subject { response }
|
181
186
|
|
182
|
-
|
187
|
+
specify { should be_success }
|
183
188
|
|
184
|
-
|
189
|
+
its(:status) { should == 200 }
|
185
190
|
|
186
|
-
|
187
|
-
|
191
|
+
context 'member' do
|
192
|
+
subject { response.member }
|
188
193
|
|
189
|
-
|
190
|
-
|
191
|
-
|
194
|
+
its(:address) { should == 'member@example.com' }
|
195
|
+
its(:name) { should == 'Member Name' }
|
196
|
+
its(:subscribed) { should be_truthy }
|
192
197
|
|
193
|
-
|
194
|
-
|
198
|
+
context 'vars' do
|
199
|
+
subject { response.member.vars }
|
195
200
|
|
196
|
-
|
201
|
+
its(:awesome) { should be_truthy }
|
202
|
+
end
|
203
|
+
end
|
197
204
|
end
|
198
|
-
end
|
199
|
-
end
|
200
205
|
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
206
|
+
context '#create_member' do
|
207
|
+
let(:params) do
|
208
|
+
{
|
209
|
+
address: 'member@example.com',
|
210
|
+
name: 'Member Name',
|
211
|
+
vars: { awesome: true },
|
212
|
+
}
|
213
|
+
end
|
209
214
|
|
210
|
-
|
211
|
-
|
212
|
-
|
215
|
+
let(:response) do
|
216
|
+
resource.create_member('newsletter@pewpew.mailgun.org', params)
|
217
|
+
end
|
213
218
|
|
214
|
-
|
219
|
+
subject { response }
|
215
220
|
|
216
|
-
|
221
|
+
specify { should be_success }
|
217
222
|
|
218
|
-
|
219
|
-
|
223
|
+
its(:status) { should == 200 }
|
224
|
+
its(:message) { should == 'Mailing list member has been created' }
|
220
225
|
|
221
|
-
|
222
|
-
|
226
|
+
context 'member' do
|
227
|
+
subject { response.member }
|
223
228
|
|
224
|
-
|
225
|
-
|
226
|
-
|
229
|
+
its(:address) { should == 'member@example.com' }
|
230
|
+
its(:name) { should == 'Member Name' }
|
231
|
+
its(:subscribed) { should be_truthy }
|
227
232
|
|
228
|
-
|
229
|
-
|
233
|
+
context 'vars' do
|
234
|
+
subject { response.member.vars }
|
230
235
|
|
231
|
-
|
236
|
+
its(:awesome) { should be_truthy }
|
237
|
+
end
|
238
|
+
end
|
232
239
|
end
|
233
|
-
end
|
234
|
-
end
|
235
240
|
|
236
|
-
|
237
|
-
|
241
|
+
context '#update_member' do
|
242
|
+
let(:params) { { subscribed: false } }
|
238
243
|
|
239
|
-
|
240
|
-
|
241
|
-
|
244
|
+
let(:response) do
|
245
|
+
resource.update_member(
|
246
|
+
'newsletter@pewpew.mailgun.org',
|
247
|
+
'member@example.com',
|
248
|
+
params,
|
249
|
+
)
|
250
|
+
end
|
242
251
|
|
243
|
-
|
252
|
+
subject { response }
|
244
253
|
|
245
|
-
|
254
|
+
specify { should be_success }
|
246
255
|
|
247
|
-
|
248
|
-
|
256
|
+
its(:status) { should == 200 }
|
257
|
+
its(:message) { should == 'Mailing list member has been updated' }
|
249
258
|
|
250
|
-
|
251
|
-
|
259
|
+
context 'member' do
|
260
|
+
subject { response.member }
|
252
261
|
|
253
|
-
|
254
|
-
|
255
|
-
|
262
|
+
its(:address) { should == 'member@example.com' }
|
263
|
+
its(:name) { should == 'Member Name' }
|
264
|
+
its(:subscribed) { should be_falsey }
|
256
265
|
|
257
|
-
|
258
|
-
|
266
|
+
context 'vars' do
|
267
|
+
subject { response.member.vars }
|
259
268
|
|
260
|
-
|
269
|
+
its(:awesome) { should be_truthy }
|
270
|
+
end
|
271
|
+
end
|
261
272
|
end
|
262
|
-
end
|
263
|
-
end
|
264
273
|
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
274
|
+
context '#remove_member' do
|
275
|
+
let(:response) do
|
276
|
+
resource.remove_member(
|
277
|
+
'newsletter@pewpew.mailgun.org',
|
278
|
+
'member@example.com',
|
279
|
+
)
|
280
|
+
end
|
269
281
|
|
270
|
-
|
282
|
+
subject { response }
|
271
283
|
|
272
|
-
|
284
|
+
specify { should be_success }
|
273
285
|
|
274
|
-
|
275
|
-
|
286
|
+
its(:status) { should == 200 }
|
287
|
+
its(:message) { should == 'Mailing list member has been deleted' }
|
276
288
|
|
277
|
-
|
278
|
-
|
289
|
+
context 'member' do
|
290
|
+
subject { response.member }
|
279
291
|
|
280
|
-
|
292
|
+
its(:address) { should == 'member@example.com' }
|
293
|
+
end
|
294
|
+
end
|
281
295
|
end
|
282
296
|
end
|
283
297
|
end
|
@@ -1,28 +1,33 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
1
|
+
module PewPew
|
2
|
+
module Resources
|
3
|
+
RSpec.describe Logs, :resource, :domain do
|
4
|
+
let(:resource) { described_class.new(client) }
|
5
|
+
|
6
|
+
context '#all' do
|
7
|
+
let(:response) { resource.all }
|
8
|
+
|
9
|
+
subject { response }
|
10
|
+
|
11
|
+
specify { should be_success }
|
12
|
+
|
13
|
+
its(:status) { should == 200 }
|
14
|
+
its(:total_count) { should == 27 }
|
15
|
+
|
16
|
+
context 'item' do
|
17
|
+
subject { response.items.first }
|
18
|
+
|
19
|
+
its(:created_at) { should == 'Fri, 01 Jun 2012 04:19:04 GMT' }
|
20
|
+
its(:hap) { should == 'delivered' }
|
21
|
+
its(:message) {
|
22
|
+
should == 'Delivered: postmaster@pewpew.mailgun.org ' \
|
23
|
+
"→ pewpew@devoh.com 'Test'"
|
24
|
+
}
|
25
|
+
its(:message_id) {
|
26
|
+
should == '4fc84273c474_48dd3fe70cc34cd05949d@rouge.local.mail'
|
27
|
+
}
|
28
|
+
its(:type) { should == 'info' }
|
29
|
+
end
|
30
|
+
end
|
26
31
|
end
|
27
32
|
end
|
28
33
|
end
|
@@ -1,59 +1,61 @@
|
|
1
|
-
|
1
|
+
module PewPew
|
2
|
+
module Resources
|
3
|
+
RSpec.describe Mailboxes, :resource, :domain do
|
4
|
+
let(:resource) { described_class.new(client) }
|
2
5
|
|
3
|
-
|
4
|
-
|
6
|
+
context '#all' do
|
7
|
+
let(:response) { resource.all }
|
5
8
|
|
6
|
-
|
7
|
-
let(:response) { resource.all }
|
9
|
+
subject { response }
|
8
10
|
|
9
|
-
|
11
|
+
specify { should be_success }
|
10
12
|
|
11
|
-
|
13
|
+
its(:status) { should == 200 }
|
14
|
+
its(:total_count) { should == 1 }
|
12
15
|
|
13
|
-
|
14
|
-
|
16
|
+
context 'item' do
|
17
|
+
subject { response.items.first }
|
15
18
|
|
16
|
-
|
17
|
-
|
19
|
+
its(:created_at) { should == 'Mon, 21 May 2012 22:12:54 GMT' }
|
20
|
+
its(:mailbox) { should == 'postmaster@pewpew.mailgun.org' }
|
21
|
+
its(:size_bytes) { should be_nil }
|
22
|
+
end
|
23
|
+
end
|
18
24
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
context '#create' do
|
26
|
-
let(:params) { { mailbox: 'test', password: 'secret' } }
|
27
|
-
let(:response) { resource.create(params) }
|
25
|
+
context '#create' do
|
26
|
+
let(:params) { { mailbox: 'test', password: 'secret' } }
|
27
|
+
let(:response) { resource.create(params) }
|
28
28
|
|
29
|
-
|
29
|
+
subject { response }
|
30
30
|
|
31
|
-
|
31
|
+
specify { should be_success }
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
its(:status) { should == 200 }
|
34
|
+
its(:message) { should == 'Created 1 mailboxes' }
|
35
|
+
end
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
context '#update' do
|
38
|
+
let(:params) { { password: 's3cr3t' } }
|
39
|
+
let(:response) { resource.update('test', params) }
|
40
40
|
|
41
|
-
|
41
|
+
subject { response }
|
42
42
|
|
43
|
-
|
43
|
+
specify { should be_success }
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
45
|
+
its(:status) { should == 200 }
|
46
|
+
its(:message) { should == 'Password changed' }
|
47
|
+
end
|
48
48
|
|
49
|
-
|
50
|
-
|
49
|
+
context '#remove' do
|
50
|
+
let(:response) { resource.remove('test') }
|
51
51
|
|
52
|
-
|
52
|
+
subject { response }
|
53
53
|
|
54
|
-
|
54
|
+
specify { should be_success }
|
55
55
|
|
56
|
-
|
57
|
-
|
56
|
+
its(:status) { should == 200 }
|
57
|
+
its(:message) { should == 'Mailbox has been deleted' }
|
58
|
+
end
|
59
|
+
end
|
58
60
|
end
|
59
61
|
end
|