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,99 +1,43 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
context '#find' do
|
34
|
-
let(:response) { resource.find('8ben') }
|
35
|
-
|
36
|
-
subject { response }
|
37
|
-
|
38
|
-
specify { should be_success }
|
39
|
-
|
40
|
-
its(:status) { should == 200 }
|
41
|
-
|
42
|
-
its(:bounced_count) { should == 0 }
|
43
|
-
its(:clicked_count) { should == 0 }
|
44
|
-
its(:complained_count) { should == 0 }
|
45
|
-
its(:created_at) { should == 'Sun, 03 Jun 2012 07:36:36 GMT' }
|
46
|
-
its(:delivered_count) { should == 0 }
|
47
|
-
its(:dropped_count) { should == 0 }
|
48
|
-
its(:id) { should == '8ben' }
|
49
|
-
its(:name) { should == 'Test' }
|
50
|
-
its(:opened_count) { should == 0 }
|
51
|
-
its(:submitted_count) { should == 0 }
|
52
|
-
its(:unsubscribed_count) { should == 0 }
|
53
|
-
end
|
54
|
-
|
55
|
-
context '#create' do
|
56
|
-
let(:response) { resource.create(params) }
|
57
|
-
|
58
|
-
context 'with an ID' do
|
59
|
-
let(:params) { { name: 'Test', id: 'test' } }
|
60
|
-
|
61
|
-
subject { response }
|
62
|
-
|
63
|
-
specify { should be_success }
|
64
|
-
|
65
|
-
its(:status) { should == 200 }
|
66
|
-
its(:message) { should == 'Campaign created' }
|
67
|
-
|
68
|
-
context 'campaign' do
|
69
|
-
subject { response.campaign }
|
70
|
-
|
71
|
-
its(:bounced_count) { should == 0 }
|
72
|
-
its(:clicked_count) { should == 0 }
|
73
|
-
its(:complained_count) { should == 0 }
|
74
|
-
its(:created_at) { should == 'Sun, 03 Jun 2012 07:28:25 GMT' }
|
75
|
-
its(:delivered_count) { should == 0 }
|
76
|
-
its(:dropped_count) { should == 0 }
|
77
|
-
its(:id) { should == 'test' }
|
78
|
-
its(:name) { should == 'Test' }
|
79
|
-
its(:opened_count) { should == 0 }
|
80
|
-
its(:submitted_count) { should == 0 }
|
81
|
-
its(:unsubscribed_count) { should == 0 }
|
1
|
+
module PewPew
|
2
|
+
module Resources
|
3
|
+
RSpec.describe Campaigns, :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 == 1 }
|
15
|
+
|
16
|
+
context 'item' do
|
17
|
+
subject { response.items.first }
|
18
|
+
|
19
|
+
its(:bounced_count) { should == 0 }
|
20
|
+
its(:clicked_count) { should == 0 }
|
21
|
+
its(:complained_count) { should == 0 }
|
22
|
+
its(:created_at) { should == 'Sun, 03 Jun 2012 07:36:36 GMT' }
|
23
|
+
its(:delivered_count) { should == 0 }
|
24
|
+
its(:dropped_count) { should == 0 }
|
25
|
+
its(:id) { should == '8ben' }
|
26
|
+
its(:name) { should == 'Test' }
|
27
|
+
its(:opened_count) { should == 0 }
|
28
|
+
its(:submitted_count) { should == 0 }
|
29
|
+
its(:unsubscribed_count) { should == 0 }
|
30
|
+
end
|
82
31
|
end
|
83
|
-
end
|
84
|
-
|
85
|
-
context 'without an ID' do
|
86
|
-
let(:params) { { name: 'Test' } }
|
87
32
|
|
88
|
-
|
33
|
+
context '#find' do
|
34
|
+
let(:response) { resource.find('8ben') }
|
89
35
|
|
90
|
-
|
36
|
+
subject { response }
|
91
37
|
|
92
|
-
|
93
|
-
its(:message) { should == 'Campaign created' }
|
38
|
+
specify { should be_success }
|
94
39
|
|
95
|
-
|
96
|
-
subject { response.campaign }
|
40
|
+
its(:status) { should == 200 }
|
97
41
|
|
98
42
|
its(:bounced_count) { should == 0 }
|
99
43
|
its(:clicked_count) { should == 0 }
|
@@ -107,122 +51,180 @@ describe PewPew::Resources::Campaigns, :resource, :domain do
|
|
107
51
|
its(:submitted_count) { should == 0 }
|
108
52
|
its(:unsubscribed_count) { should == 0 }
|
109
53
|
end
|
110
|
-
end
|
111
|
-
end
|
112
54
|
|
113
|
-
|
114
|
-
|
55
|
+
context '#create' do
|
56
|
+
let(:response) { resource.create(params) }
|
57
|
+
|
58
|
+
context 'with an ID' do
|
59
|
+
let(:params) { { name: 'Test', id: 'test' } }
|
60
|
+
|
61
|
+
subject { response }
|
62
|
+
|
63
|
+
specify { should be_success }
|
64
|
+
|
65
|
+
its(:status) { should == 200 }
|
66
|
+
its(:message) { should == 'Campaign created' }
|
67
|
+
|
68
|
+
context 'campaign' do
|
69
|
+
subject { response.campaign }
|
70
|
+
|
71
|
+
its(:bounced_count) { should == 0 }
|
72
|
+
its(:clicked_count) { should == 0 }
|
73
|
+
its(:complained_count) { should == 0 }
|
74
|
+
its(:created_at) { should == 'Sun, 03 Jun 2012 07:28:25 GMT' }
|
75
|
+
its(:delivered_count) { should == 0 }
|
76
|
+
its(:dropped_count) { should == 0 }
|
77
|
+
its(:id) { should == 'test' }
|
78
|
+
its(:name) { should == 'Test' }
|
79
|
+
its(:opened_count) { should == 0 }
|
80
|
+
its(:submitted_count) { should == 0 }
|
81
|
+
its(:unsubscribed_count) { should == 0 }
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
context 'without an ID' do
|
86
|
+
let(:params) { { name: 'Test' } }
|
87
|
+
|
88
|
+
subject { response }
|
89
|
+
|
90
|
+
specify { should be_success }
|
91
|
+
|
92
|
+
its(:status) { should == 200 }
|
93
|
+
its(:message) { should == 'Campaign created' }
|
94
|
+
|
95
|
+
context 'campaign' do
|
96
|
+
subject { response.campaign }
|
97
|
+
|
98
|
+
its(:bounced_count) { should == 0 }
|
99
|
+
its(:clicked_count) { should == 0 }
|
100
|
+
its(:complained_count) { should == 0 }
|
101
|
+
its(:created_at) { should == 'Sun, 03 Jun 2012 07:36:36 GMT' }
|
102
|
+
its(:delivered_count) { should == 0 }
|
103
|
+
its(:dropped_count) { should == 0 }
|
104
|
+
its(:id) { should == '8ben' }
|
105
|
+
its(:name) { should == 'Test' }
|
106
|
+
its(:opened_count) { should == 0 }
|
107
|
+
its(:submitted_count) { should == 0 }
|
108
|
+
its(:unsubscribed_count) { should == 0 }
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
115
112
|
|
116
|
-
|
113
|
+
context '#remove' do
|
114
|
+
let(:response) { resource.remove('test') }
|
117
115
|
|
118
|
-
|
116
|
+
subject { response }
|
119
117
|
|
120
|
-
|
121
|
-
its(:message) { should == 'Campaign deleted' }
|
118
|
+
specify { should be_success }
|
122
119
|
|
123
|
-
|
124
|
-
|
120
|
+
its(:status) { should == 200 }
|
121
|
+
its(:message) { should == 'Campaign deleted' }
|
125
122
|
|
126
|
-
|
127
|
-
|
123
|
+
its(:id) { should == 'test' }
|
124
|
+
end
|
128
125
|
|
129
|
-
|
126
|
+
context '#events' do
|
127
|
+
let(:response) { resource.events('8ben') }
|
130
128
|
|
131
|
-
|
129
|
+
subject { response }
|
132
130
|
|
133
|
-
|
134
|
-
its(:total_count) { should == 0 }
|
131
|
+
specify { should be_success }
|
135
132
|
|
136
|
-
|
137
|
-
|
133
|
+
its(:status) { should == 200 }
|
134
|
+
its(:total_count) { should == 0 }
|
138
135
|
|
139
|
-
|
140
|
-
|
136
|
+
its(:items) { should == [] }
|
137
|
+
end
|
141
138
|
|
142
|
-
|
139
|
+
context '#stats' do
|
140
|
+
let(:response) { resource.stats('8ben') }
|
143
141
|
|
144
|
-
|
142
|
+
subject { response }
|
145
143
|
|
146
|
-
|
144
|
+
specify { should be_success }
|
147
145
|
|
148
|
-
|
149
|
-
subject { response.total }
|
146
|
+
its(:status) { should == 200 }
|
150
147
|
|
151
|
-
|
152
|
-
|
153
|
-
its(:complained) { should == 0 }
|
154
|
-
its(:delivered) { should == 0 }
|
155
|
-
its(:dropped) { should == 0 }
|
156
|
-
its(:opened) { should == 0 }
|
157
|
-
its(:sent) { should == 0 }
|
158
|
-
its(:unsubscribed) { should == 0 }
|
159
|
-
end
|
148
|
+
context 'total' do
|
149
|
+
subject { response.total }
|
160
150
|
|
161
|
-
|
162
|
-
|
163
|
-
|
151
|
+
its(:bounced) { should == 0 }
|
152
|
+
its(:clicked) { should == 0 }
|
153
|
+
its(:complained) { should == 0 }
|
154
|
+
its(:delivered) { should == 0 }
|
155
|
+
its(:dropped) { should == 0 }
|
156
|
+
its(:opened) { should == 0 }
|
157
|
+
its(:sent) { should == 0 }
|
158
|
+
its(:unsubscribed) { should == 0 }
|
159
|
+
end
|
164
160
|
|
165
|
-
|
166
|
-
|
167
|
-
|
161
|
+
context 'unique' do
|
162
|
+
context 'clicked' do
|
163
|
+
subject { response.unique.clicked }
|
168
164
|
|
169
|
-
|
170
|
-
|
165
|
+
its(:link) { should == 0 }
|
166
|
+
its(:recipient) { should == 0 }
|
167
|
+
end
|
171
168
|
|
172
|
-
|
169
|
+
context 'opened' do
|
170
|
+
subject { response.unique.opened }
|
171
|
+
|
172
|
+
its(:recipient) { should == 0 }
|
173
|
+
end
|
174
|
+
end
|
173
175
|
end
|
174
|
-
end
|
175
|
-
end
|
176
176
|
|
177
|
-
|
178
|
-
|
177
|
+
context '#clicks' do
|
178
|
+
let(:response) { resource.clicks('8ben', group_by: 'domain') }
|
179
179
|
|
180
|
-
|
180
|
+
subject { response }
|
181
181
|
|
182
|
-
|
182
|
+
specify { should be_success }
|
183
183
|
|
184
|
-
|
185
|
-
|
184
|
+
its(:status) { should == 200 }
|
185
|
+
its(:total_count) { should == 0 }
|
186
186
|
|
187
|
-
|
188
|
-
|
187
|
+
its(:items) { should == [] }
|
188
|
+
end
|
189
189
|
|
190
|
-
|
191
|
-
|
190
|
+
context '#opens' do
|
191
|
+
let(:response) { resource.opens('8ben', group_by: 'domain') }
|
192
192
|
|
193
|
-
|
193
|
+
subject { response }
|
194
194
|
|
195
|
-
|
195
|
+
specify { should be_success }
|
196
196
|
|
197
|
-
|
198
|
-
|
197
|
+
its(:status) { should == 200 }
|
198
|
+
its(:total_count) { should == 0 }
|
199
199
|
|
200
|
-
|
201
|
-
|
200
|
+
its(:items) { should == [] }
|
201
|
+
end
|
202
202
|
|
203
|
-
|
204
|
-
|
203
|
+
context '#unsubscribes' do
|
204
|
+
let(:response) { resource.unsubscribes('8ben', group_by: 'domain') }
|
205
205
|
|
206
|
-
|
206
|
+
subject { response }
|
207
207
|
|
208
|
-
|
208
|
+
specify { should be_success }
|
209
209
|
|
210
|
-
|
211
|
-
|
210
|
+
its(:status) { should == 200 }
|
211
|
+
its(:total_count) { should == 0 }
|
212
212
|
|
213
|
-
|
214
|
-
|
213
|
+
its(:items) { should == [] }
|
214
|
+
end
|
215
215
|
|
216
|
-
|
217
|
-
|
216
|
+
context '#complaints' do
|
217
|
+
let(:response) { resource.complaints('8ben', group_by: 'domain') }
|
218
218
|
|
219
|
-
|
219
|
+
subject { response }
|
220
220
|
|
221
|
-
|
221
|
+
specify { should be_success }
|
222
222
|
|
223
|
-
|
224
|
-
|
223
|
+
its(:status) { should == 200 }
|
224
|
+
its(:total_count) { should == 0 }
|
225
225
|
|
226
|
-
|
226
|
+
its(:items) { should == [] }
|
227
|
+
end
|
228
|
+
end
|
227
229
|
end
|
228
230
|
end
|
@@ -1,69 +1,73 @@
|
|
1
|
-
|
1
|
+
module PewPew
|
2
|
+
module Resources
|
3
|
+
RSpec.describe Complaints, :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(:address) { should == 'test@example.com' }
|
20
|
+
its(:count) { should == 1 }
|
21
|
+
its(:created_at) { should == 'Sat, 02 Jun 2012 06:55:56 GMT' }
|
22
|
+
end
|
23
|
+
end
|
18
24
|
|
19
|
-
|
20
|
-
|
21
|
-
its(:created_at) { should == 'Sat, 02 Jun 2012 06:55:56 GMT' }
|
22
|
-
end
|
23
|
-
end
|
25
|
+
context '#find' do
|
26
|
+
let(:response) { resource.find('test@example.com') }
|
24
27
|
|
25
|
-
|
26
|
-
let(:response) { resource.find('test@example.com') }
|
28
|
+
subject { response }
|
27
29
|
|
28
|
-
|
30
|
+
specify { should be_success }
|
29
31
|
|
30
|
-
|
32
|
+
its(:status) { should == 200 }
|
31
33
|
|
32
|
-
|
34
|
+
context 'complaint' do
|
35
|
+
subject { response.complaint }
|
33
36
|
|
34
|
-
|
35
|
-
|
37
|
+
its(:address) { should == 'test@example.com' }
|
38
|
+
its(:count) { should == 1 }
|
39
|
+
its(:created_at) { should == 'Sat, 02 Jun 2012 06:55:56 GMT' }
|
40
|
+
end
|
41
|
+
end
|
36
42
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
end
|
41
|
-
end
|
43
|
+
context '#create' do
|
44
|
+
let(:params) { { address: 'test@example.com' } }
|
45
|
+
let(:response) { resource.create(params) }
|
42
46
|
|
43
|
-
|
44
|
-
let(:params) { { address: 'test@example.com' } }
|
45
|
-
let(:response) { resource.create(params) }
|
47
|
+
subject { response }
|
46
48
|
|
47
|
-
|
49
|
+
specify { should be_success }
|
48
50
|
|
49
|
-
|
51
|
+
its(:status) { should == 200 }
|
52
|
+
its(:message) {
|
53
|
+
should == 'Address has been added to the complaints table'
|
54
|
+
}
|
50
55
|
|
51
|
-
|
52
|
-
|
56
|
+
its(:address) { should == 'test@example.com' }
|
57
|
+
end
|
53
58
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
context '#remove' do
|
58
|
-
subject { response }
|
59
|
+
context '#remove' do
|
60
|
+
subject { response }
|
59
61
|
|
60
|
-
|
62
|
+
let(:response) { resource.remove('test@example.com') }
|
61
63
|
|
62
|
-
|
64
|
+
specify { should be_success }
|
63
65
|
|
64
|
-
|
65
|
-
|
66
|
+
its(:status) { should == 200 }
|
67
|
+
its(:message) { should == 'Spam complaint has been removed' }
|
66
68
|
|
67
|
-
|
69
|
+
its(:address) { should == 'test@example.com' }
|
70
|
+
end
|
71
|
+
end
|
68
72
|
end
|
69
73
|
end
|