pew_pew 0.0.2 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,99 +1,43 @@
1
- require 'spec_helper'
2
-
3
- describe PewPew::Resources::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
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
- subject { response }
33
+ context '#find' do
34
+ let(:response) { resource.find('8ben') }
89
35
 
90
- specify { should be_success }
36
+ subject { response }
91
37
 
92
- its(:status) { should == 200 }
93
- its(:message) { should == 'Campaign created' }
38
+ specify { should be_success }
94
39
 
95
- context 'campaign' do
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
- context '#remove' do
114
- let(:response) { resource.remove('test') }
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
- subject { response }
113
+ context '#remove' do
114
+ let(:response) { resource.remove('test') }
117
115
 
118
- specify { should be_success }
116
+ subject { response }
119
117
 
120
- its(:status) { should == 200 }
121
- its(:message) { should == 'Campaign deleted' }
118
+ specify { should be_success }
122
119
 
123
- its(:id) { should == 'test' }
124
- end
120
+ its(:status) { should == 200 }
121
+ its(:message) { should == 'Campaign deleted' }
125
122
 
126
- context '#events' do
127
- let(:response) { resource.events('8ben') }
123
+ its(:id) { should == 'test' }
124
+ end
128
125
 
129
- subject { response }
126
+ context '#events' do
127
+ let(:response) { resource.events('8ben') }
130
128
 
131
- specify { should be_success }
129
+ subject { response }
132
130
 
133
- its(:status) { should == 200 }
134
- its(:total_count) { should == 0 }
131
+ specify { should be_success }
135
132
 
136
- its(:items) { should == [] }
137
- end
133
+ its(:status) { should == 200 }
134
+ its(:total_count) { should == 0 }
138
135
 
139
- context '#stats' do
140
- let(:response) { resource.stats('8ben') }
136
+ its(:items) { should == [] }
137
+ end
141
138
 
142
- subject { response }
139
+ context '#stats' do
140
+ let(:response) { resource.stats('8ben') }
143
141
 
144
- specify { should be_success }
142
+ subject { response }
145
143
 
146
- its(:status) { should == 200 }
144
+ specify { should be_success }
147
145
 
148
- context 'total' do
149
- subject { response.total }
146
+ its(:status) { should == 200 }
150
147
 
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
148
+ context 'total' do
149
+ subject { response.total }
160
150
 
161
- context 'unique' do
162
- context 'clicked' do
163
- subject { response.unique.clicked }
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
- its(:link) { should == 0 }
166
- its(:recipient) { should == 0 }
167
- end
161
+ context 'unique' do
162
+ context 'clicked' do
163
+ subject { response.unique.clicked }
168
164
 
169
- context 'opened' do
170
- subject { response.unique.opened }
165
+ its(:link) { should == 0 }
166
+ its(:recipient) { should == 0 }
167
+ end
171
168
 
172
- its(:recipient) { should == 0 }
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
- context '#clicks' do
178
- let(:response) { resource.clicks('8ben', group_by: 'domain') }
177
+ context '#clicks' do
178
+ let(:response) { resource.clicks('8ben', group_by: 'domain') }
179
179
 
180
- subject { response }
180
+ subject { response }
181
181
 
182
- specify { should be_success }
182
+ specify { should be_success }
183
183
 
184
- its(:status) { should == 200 }
185
- its(:total_count) { should == 0 }
184
+ its(:status) { should == 200 }
185
+ its(:total_count) { should == 0 }
186
186
 
187
- its(:items) { should == [] }
188
- end
187
+ its(:items) { should == [] }
188
+ end
189
189
 
190
- context '#opens' do
191
- let(:response) { resource.opens('8ben', group_by: 'domain') }
190
+ context '#opens' do
191
+ let(:response) { resource.opens('8ben', group_by: 'domain') }
192
192
 
193
- subject { response }
193
+ subject { response }
194
194
 
195
- specify { should be_success }
195
+ specify { should be_success }
196
196
 
197
- its(:status) { should == 200 }
198
- its(:total_count) { should == 0 }
197
+ its(:status) { should == 200 }
198
+ its(:total_count) { should == 0 }
199
199
 
200
- its(:items) { should == [] }
201
- end
200
+ its(:items) { should == [] }
201
+ end
202
202
 
203
- context '#unsubscribes' do
204
- let(:response) { resource.unsubscribes('8ben', group_by: 'domain') }
203
+ context '#unsubscribes' do
204
+ let(:response) { resource.unsubscribes('8ben', group_by: 'domain') }
205
205
 
206
- subject { response }
206
+ subject { response }
207
207
 
208
- specify { should be_success }
208
+ specify { should be_success }
209
209
 
210
- its(:status) { should == 200 }
211
- its(:total_count) { should == 0 }
210
+ its(:status) { should == 200 }
211
+ its(:total_count) { should == 0 }
212
212
 
213
- its(:items) { should == [] }
214
- end
213
+ its(:items) { should == [] }
214
+ end
215
215
 
216
- context '#complaints' do
217
- let(:response) { resource.complaints('8ben', group_by: 'domain') }
216
+ context '#complaints' do
217
+ let(:response) { resource.complaints('8ben', group_by: 'domain') }
218
218
 
219
- subject { response }
219
+ subject { response }
220
220
 
221
- specify { should be_success }
221
+ specify { should be_success }
222
222
 
223
- its(:status) { should == 200 }
224
- its(:total_count) { should == 0 }
223
+ its(:status) { should == 200 }
224
+ its(:total_count) { should == 0 }
225
225
 
226
- its(:items) { should == [] }
226
+ its(:items) { should == [] }
227
+ end
228
+ end
227
229
  end
228
230
  end
@@ -1,69 +1,73 @@
1
- require 'spec_helper'
1
+ module PewPew
2
+ module Resources
3
+ RSpec.describe Complaints, :resource, :domain do
4
+ let(:resource) { described_class.new(client) }
2
5
 
3
- describe PewPew::Resources::Complaints, :resource, :domain do
4
- let(:resource) { described_class.new(client) }
6
+ context '#all' do
7
+ let(:response) { resource.all }
5
8
 
6
- context '#all' do
7
- let(:response) { resource.all }
9
+ subject { response }
8
10
 
9
- subject { response }
11
+ specify { should be_success }
10
12
 
11
- specify { should be_success }
13
+ its(:status) { should == 200 }
14
+ its(:total_count) { should == 1 }
12
15
 
13
- its(:status) { should == 200 }
14
- its(:total_count) { should == 1 }
16
+ context 'item' do
17
+ subject { response.items.first }
15
18
 
16
- context 'item' do
17
- subject { response.items.first }
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
- 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
25
+ context '#find' do
26
+ let(:response) { resource.find('test@example.com') }
24
27
 
25
- context '#find' do
26
- let(:response) { resource.find('test@example.com') }
28
+ subject { response }
27
29
 
28
- subject { response }
30
+ specify { should be_success }
29
31
 
30
- specify { should be_success }
32
+ its(:status) { should == 200 }
31
33
 
32
- its(:status) { should == 200 }
34
+ context 'complaint' do
35
+ subject { response.complaint }
33
36
 
34
- context 'complaint' do
35
- subject { response.complaint }
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
- 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
43
+ context '#create' do
44
+ let(:params) { { address: 'test@example.com' } }
45
+ let(:response) { resource.create(params) }
42
46
 
43
- context '#create' do
44
- let(:params) { { address: 'test@example.com' } }
45
- let(:response) { resource.create(params) }
47
+ subject { response }
46
48
 
47
- subject { response }
49
+ specify { should be_success }
48
50
 
49
- specify { should be_success }
51
+ its(:status) { should == 200 }
52
+ its(:message) {
53
+ should == 'Address has been added to the complaints table'
54
+ }
50
55
 
51
- its(:status) { should == 200 }
52
- its(:message) { should == 'Address has been added to the complaints table' }
56
+ its(:address) { should == 'test@example.com' }
57
+ end
53
58
 
54
- its(:address) { should == 'test@example.com' }
55
- end
56
-
57
- context '#remove' do
58
- subject { response }
59
+ context '#remove' do
60
+ subject { response }
59
61
 
60
- let(:response) { resource.remove('test@example.com') }
62
+ let(:response) { resource.remove('test@example.com') }
61
63
 
62
- specify { should be_success }
64
+ specify { should be_success }
63
65
 
64
- its(:status) { should == 200 }
65
- its(:message) { should == 'Spam complaint has been removed' }
66
+ its(:status) { should == 200 }
67
+ its(:message) { should == 'Spam complaint has been removed' }
66
68
 
67
- its(:address) { should == 'test@example.com' }
69
+ its(:address) { should == 'test@example.com' }
70
+ end
71
+ end
68
72
  end
69
73
  end