appboy 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/appboy.gemspec +2 -2
- data/lib/appboy/api.rb +2 -0
- data/lib/appboy/endpoints/delete_users.rb +15 -0
- data/lib/appboy/rest.rb +1 -0
- data/lib/appboy/rest/delete_users.rb +21 -0
- data/lib/appboy/version.rb +1 -1
- data/spec/appboy/rest/delete_users_spec.rb +23 -0
- data/spec/factories.rb +12 -0
- data/spec/fixtures/responses/delete_users/unauthorized/responds_with_unauthorized.yml +58 -0
- data/spec/fixtures/responses/delete_users/with_success/responds_with_created.yml +58 -0
- data/spec/fixtures/responses/delete_users/with_success/responds_with_success_message.yml +58 -0
- data/spec/integrations/delete_users_spec.rb +30 -0
- metadata +22 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2539aee6f4676b905088a742fd7f4483940c1dd92357bb90b80429c9c8f39be
|
4
|
+
data.tar.gz: f50416d403099d46c0756415e532f0bf756a63bcc81ed46a5c6f7d1738e2e303
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86539b94ede05d465e58499621ed49b10779a2bf3ecf4c6d175f0cd7c03c1987b5c03122a7d0b1ad09cee2d1b5e2fd7e2a0359d15ea78588a6cf9a11ce667495
|
7
|
+
data.tar.gz: 2a95b92212b4e434257edf59c5c0dd18287b328c6222c14da6a5b31b1f3616398ee4556d61af1dae894146b1a3c2b113c475f4a2ef9bed6a32cac6fd2d745dd8
|
data/appboy.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_development_dependency 'dotenv'
|
28
28
|
spec.add_development_dependency 'vcr'
|
29
29
|
spec.add_development_dependency 'webmock'
|
30
|
-
spec.add_development_dependency 'pry'
|
30
|
+
spec.add_development_dependency 'pry', '~> 0.9.12'
|
31
31
|
spec.add_development_dependency 'activesupport'
|
32
|
-
spec.add_development_dependency 'factory_girl'
|
32
|
+
spec.add_development_dependency 'factory_girl', '~> 4.4.0'
|
33
33
|
end
|
data/lib/appboy/api.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'appboy/deprecated'
|
2
2
|
require 'appboy/endpoints/track_users'
|
3
|
+
require 'appboy/endpoints/delete_users'
|
3
4
|
require 'appboy/endpoints/send_messages'
|
4
5
|
require 'appboy/endpoints/schedule_messages'
|
5
6
|
require 'appboy/endpoints/email_status'
|
@@ -9,6 +10,7 @@ module Appboy
|
|
9
10
|
include Appboy::Deprecated
|
10
11
|
|
11
12
|
include Appboy::Endpoints::TrackUsers
|
13
|
+
include Appboy::Endpoints::DeleteUsers
|
12
14
|
include Appboy::Endpoints::SendMessages
|
13
15
|
include Appboy::Endpoints::ScheduleMessages
|
14
16
|
include Appboy::Endpoints::EmailStatus
|
data/lib/appboy/rest.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
module Appboy
|
2
|
+
module REST
|
3
|
+
class DeleteUsers < Base
|
4
|
+
attr_reader :app_group_id, :external_ids, :appboy_ids
|
5
|
+
|
6
|
+
def initialize(app_group_id, external_ids: [], appboy_ids: [])
|
7
|
+
@app_group_id = app_group_id
|
8
|
+
@external_ids = external_ids
|
9
|
+
@appboy_ids = appboy_ids
|
10
|
+
end
|
11
|
+
|
12
|
+
def perform
|
13
|
+
http.post '/users/delete', {
|
14
|
+
app_group_id: app_group_id,
|
15
|
+
external_ids: external_ids,
|
16
|
+
appboy_ids: appboy_ids
|
17
|
+
}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/appboy/version.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Appboy::REST::DeleteUsers do
|
4
|
+
let(:http) { double(:http) }
|
5
|
+
|
6
|
+
let(:payload) {{
|
7
|
+
external_ids: :external_ids,
|
8
|
+
appboy_ids: :appboy_ids
|
9
|
+
}}
|
10
|
+
|
11
|
+
let(:app_group_id) { :app_group_id }
|
12
|
+
|
13
|
+
subject { described_class.new(:app_group_id, external_ids: :external_ids, appboy_ids: :appboy_ids) }
|
14
|
+
|
15
|
+
before { subject.http = http }
|
16
|
+
|
17
|
+
it 'makes an http call to the track user endpoint' do
|
18
|
+
expect(http).to receive(:post).with '/users/delete',
|
19
|
+
payload.merge({ app_group_id: :app_group_id })
|
20
|
+
|
21
|
+
subject.perform
|
22
|
+
end
|
23
|
+
end
|
data/spec/factories.rb
CHANGED
@@ -29,4 +29,16 @@ FactoryGirl.define do
|
|
29
29
|
|
30
30
|
initialize_with { attributes }
|
31
31
|
end
|
32
|
+
|
33
|
+
factory :recipients, class: Array do
|
34
|
+
sequence(:external_user_id)
|
35
|
+
|
36
|
+
initialize_with { attributes }
|
37
|
+
end
|
38
|
+
|
39
|
+
factory :external_ids, class: Hash do
|
40
|
+
external_ids { [1,2] }
|
41
|
+
|
42
|
+
initialize_with { attributes }
|
43
|
+
end
|
32
44
|
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.appboy.com/users/delete
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"app_group_id":"non-existent","external_ids":[1,2],"appboy_ids":[]}'
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.12.1
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
+
Accept:
|
17
|
+
- "*/*"
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 401
|
21
|
+
message: Unauthorized
|
22
|
+
headers:
|
23
|
+
Cache-Control:
|
24
|
+
- no-cache
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Server:
|
28
|
+
- nginx/1.10.2
|
29
|
+
X-Request-Id:
|
30
|
+
- 90baa9c2-258b-4231-8308-0153e89dffe2
|
31
|
+
X-Runtime:
|
32
|
+
- '0.005878'
|
33
|
+
Content-Length:
|
34
|
+
- '85'
|
35
|
+
Accept-Ranges:
|
36
|
+
- bytes
|
37
|
+
Date:
|
38
|
+
- Tue, 27 Jun 2017 14:45:31 GMT
|
39
|
+
Via:
|
40
|
+
- 1.1 varnish
|
41
|
+
Connection:
|
42
|
+
- keep-alive
|
43
|
+
X-Served-By:
|
44
|
+
- cache-ord1737-ORD
|
45
|
+
X-Cache:
|
46
|
+
- MISS
|
47
|
+
X-Cache-Hits:
|
48
|
+
- '0'
|
49
|
+
X-Timer:
|
50
|
+
- S1498574732.800538,VS0,VE27
|
51
|
+
Vary:
|
52
|
+
- Accept-Encoding
|
53
|
+
body:
|
54
|
+
encoding: ASCII-8BIT
|
55
|
+
string: '{"message":"Invalid App Group API Identifier: non-existent"}'
|
56
|
+
http_version:
|
57
|
+
recorded_at: Tue, 27 Jun 2017 14:45:31 GMT
|
58
|
+
recorded_with: VCR 3.0.3
|
@@ -0,0 +1,58 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.appboy.com/users/delete
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"app_group_id":"<APPBOY_GROUP_ID>","external_ids":[1,2],"appboy_ids":[]}'
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.12.1
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
+
Accept:
|
17
|
+
- "*/*"
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 201
|
21
|
+
message: Created
|
22
|
+
headers:
|
23
|
+
Cache-Control:
|
24
|
+
- no-cache
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Server:
|
28
|
+
- nginx/1.10.2
|
29
|
+
X-Request-Id:
|
30
|
+
- c0ea7c6b-9323-4e1d-9467-f04d29fd4084
|
31
|
+
X-Runtime:
|
32
|
+
- '0.005712'
|
33
|
+
Content-Length:
|
34
|
+
- '80'
|
35
|
+
Accept-Ranges:
|
36
|
+
- bytes
|
37
|
+
Date:
|
38
|
+
- Tue, 27 Jun 2017 14:44:20 GMT
|
39
|
+
Via:
|
40
|
+
- 1.1 varnish
|
41
|
+
Connection:
|
42
|
+
- keep-alive
|
43
|
+
X-Served-By:
|
44
|
+
- cache-ord1747-ORD
|
45
|
+
X-Cache:
|
46
|
+
- MISS
|
47
|
+
X-Cache-Hits:
|
48
|
+
- '0'
|
49
|
+
X-Timer:
|
50
|
+
- S1498574660.342690,VS0,VE121
|
51
|
+
Vary:
|
52
|
+
- Accept-Encoding
|
53
|
+
body:
|
54
|
+
encoding: ASCII-8BIT
|
55
|
+
string: '{"deleted":1,message":"success"}'
|
56
|
+
http_version:
|
57
|
+
recorded_at: Tue, 27 Jun 2017 14:44:20 GMT
|
58
|
+
recorded_with: VCR 3.0.3
|
@@ -0,0 +1,58 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.appboy.com/users/delete
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"app_group_id":"<APPBOY_GROUP_ID>","external_ids":[1,2],"appboy_ids":[]}'
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.12.1
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
+
Accept:
|
17
|
+
- "*/*"
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 201
|
21
|
+
message: Created
|
22
|
+
headers:
|
23
|
+
Cache-Control:
|
24
|
+
- no-cache
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Server:
|
28
|
+
- nginx/1.10.2
|
29
|
+
X-Request-Id:
|
30
|
+
- 1e432499-cdf9-49c6-abc5-00354e59fe6b
|
31
|
+
X-Runtime:
|
32
|
+
- '0.003536'
|
33
|
+
Content-Length:
|
34
|
+
- '80'
|
35
|
+
Accept-Ranges:
|
36
|
+
- bytes
|
37
|
+
Date:
|
38
|
+
- Tue, 27 Jun 2017 14:44:22 GMT
|
39
|
+
Via:
|
40
|
+
- 1.1 varnish
|
41
|
+
Connection:
|
42
|
+
- keep-alive
|
43
|
+
X-Served-By:
|
44
|
+
- cache-ord1729-ORD
|
45
|
+
X-Cache:
|
46
|
+
- MISS
|
47
|
+
X-Cache-Hits:
|
48
|
+
- '0'
|
49
|
+
X-Timer:
|
50
|
+
- S1498574662.030820,VS0,VE24
|
51
|
+
Vary:
|
52
|
+
- Accept-Encoding
|
53
|
+
body:
|
54
|
+
encoding: ASCII-8BIT
|
55
|
+
string: '{"deleted":2,"message":"success"}'
|
56
|
+
http_version:
|
57
|
+
recorded_at: Tue, 27 Jun 2017 14:44:22 GMT
|
58
|
+
recorded_with: VCR 3.0.3
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'delete users' do
|
4
|
+
let(:external_ids) { build(:external_ids) }
|
5
|
+
|
6
|
+
subject(:delete_users) do
|
7
|
+
api.delete_users(external_ids)
|
8
|
+
end
|
9
|
+
|
10
|
+
context 'with success', vcr: true do
|
11
|
+
it 'responds with created' do
|
12
|
+
expect(delete_users.status).to be 201
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'responds with success message' do
|
16
|
+
expect(JSON.parse(delete_users.body)).to eq(
|
17
|
+
'deleted' => 2,
|
18
|
+
'message' => 'success'
|
19
|
+
)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'unauthorized', vcr: true do
|
24
|
+
let(:app_group_id) { 'non-existent' }
|
25
|
+
|
26
|
+
it 'responds with unauthorized' do
|
27
|
+
expect(delete_users.status).to be 401
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appboy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Nussbaum
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-04-
|
12
|
+
date: 2018-04-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: virtus
|
@@ -141,16 +141,16 @@ dependencies:
|
|
141
141
|
name: pry
|
142
142
|
requirement: !ruby/object:Gem::Requirement
|
143
143
|
requirements:
|
144
|
-
- - "
|
144
|
+
- - "~>"
|
145
145
|
- !ruby/object:Gem::Version
|
146
|
-
version:
|
146
|
+
version: 0.9.12
|
147
147
|
type: :development
|
148
148
|
prerelease: false
|
149
149
|
version_requirements: !ruby/object:Gem::Requirement
|
150
150
|
requirements:
|
151
|
-
- - "
|
151
|
+
- - "~>"
|
152
152
|
- !ruby/object:Gem::Version
|
153
|
-
version:
|
153
|
+
version: 0.9.12
|
154
154
|
- !ruby/object:Gem::Dependency
|
155
155
|
name: activesupport
|
156
156
|
requirement: !ruby/object:Gem::Requirement
|
@@ -169,16 +169,16 @@ dependencies:
|
|
169
169
|
name: factory_girl
|
170
170
|
requirement: !ruby/object:Gem::Requirement
|
171
171
|
requirements:
|
172
|
-
- - "
|
172
|
+
- - "~>"
|
173
173
|
- !ruby/object:Gem::Version
|
174
|
-
version:
|
174
|
+
version: 4.4.0
|
175
175
|
type: :development
|
176
176
|
prerelease: false
|
177
177
|
version_requirements: !ruby/object:Gem::Requirement
|
178
178
|
requirements:
|
179
|
-
- - "
|
179
|
+
- - "~>"
|
180
180
|
- !ruby/object:Gem::Version
|
181
|
-
version:
|
181
|
+
version: 4.4.0
|
182
182
|
description: Appboy wrapper
|
183
183
|
email:
|
184
184
|
- josh@godynamo.com
|
@@ -197,6 +197,7 @@ files:
|
|
197
197
|
- lib/appboy.rb
|
198
198
|
- lib/appboy/api.rb
|
199
199
|
- lib/appboy/deprecated.rb
|
200
|
+
- lib/appboy/endpoints/delete_users.rb
|
200
201
|
- lib/appboy/endpoints/email_status.rb
|
201
202
|
- lib/appboy/endpoints/schedule_messages.rb
|
202
203
|
- lib/appboy/endpoints/send_messages.rb
|
@@ -204,6 +205,7 @@ files:
|
|
204
205
|
- lib/appboy/http.rb
|
205
206
|
- lib/appboy/rest.rb
|
206
207
|
- lib/appboy/rest/base.rb
|
208
|
+
- lib/appboy/rest/delete_users.rb
|
207
209
|
- lib/appboy/rest/email_status.rb
|
208
210
|
- lib/appboy/rest/export_users.rb
|
209
211
|
- lib/appboy/rest/list_segments.rb
|
@@ -214,12 +216,16 @@ files:
|
|
214
216
|
- spec/appboy/api_spec.rb
|
215
217
|
- spec/appboy/endpoints/track_users_spec.rb
|
216
218
|
- spec/appboy/http_spec.rb
|
219
|
+
- spec/appboy/rest/delete_users_spec.rb
|
217
220
|
- spec/appboy/rest/email_status_spec.rb
|
218
221
|
- spec/appboy/rest/export_users_spec.rb
|
219
222
|
- spec/appboy/rest/schedule_messages_spec.rb
|
220
223
|
- spec/appboy/rest/send_messages_spec.rb
|
221
224
|
- spec/appboy/rest/track_users_spec.rb
|
222
225
|
- spec/factories.rb
|
226
|
+
- spec/fixtures/responses/delete_users/unauthorized/responds_with_unauthorized.yml
|
227
|
+
- spec/fixtures/responses/delete_users/with_success/responds_with_created.yml
|
228
|
+
- spec/fixtures/responses/delete_users/with_success/responds_with_success_message.yml
|
223
229
|
- spec/fixtures/responses/email_status/existing_email/responds_with_created.yml
|
224
230
|
- spec/fixtures/responses/email_status/existing_email/responds_with_success_message.yml
|
225
231
|
- spec/fixtures/responses/email_status/unknown_email/responds_with_bad_request.yml
|
@@ -237,6 +243,7 @@ files:
|
|
237
243
|
- spec/fixtures/responses/track_users/unauthorized/responds_with_unauthorized.yml
|
238
244
|
- spec/fixtures/responses/track_users/with_success/responds_with_created.yml
|
239
245
|
- spec/fixtures/responses/track_users/with_success/responds_with_success_message.yml
|
246
|
+
- spec/integrations/delete_users_spec.rb
|
240
247
|
- spec/integrations/email_status_spec.rb
|
241
248
|
- spec/integrations/export_users_spec.rb
|
242
249
|
- spec/integrations/list_segments_spec.rb
|
@@ -276,12 +283,16 @@ test_files:
|
|
276
283
|
- spec/appboy/api_spec.rb
|
277
284
|
- spec/appboy/endpoints/track_users_spec.rb
|
278
285
|
- spec/appboy/http_spec.rb
|
286
|
+
- spec/appboy/rest/delete_users_spec.rb
|
279
287
|
- spec/appboy/rest/email_status_spec.rb
|
280
288
|
- spec/appboy/rest/export_users_spec.rb
|
281
289
|
- spec/appboy/rest/schedule_messages_spec.rb
|
282
290
|
- spec/appboy/rest/send_messages_spec.rb
|
283
291
|
- spec/appboy/rest/track_users_spec.rb
|
284
292
|
- spec/factories.rb
|
293
|
+
- spec/fixtures/responses/delete_users/unauthorized/responds_with_unauthorized.yml
|
294
|
+
- spec/fixtures/responses/delete_users/with_success/responds_with_created.yml
|
295
|
+
- spec/fixtures/responses/delete_users/with_success/responds_with_success_message.yml
|
285
296
|
- spec/fixtures/responses/email_status/existing_email/responds_with_created.yml
|
286
297
|
- spec/fixtures/responses/email_status/existing_email/responds_with_success_message.yml
|
287
298
|
- spec/fixtures/responses/email_status/unknown_email/responds_with_bad_request.yml
|
@@ -299,6 +310,7 @@ test_files:
|
|
299
310
|
- spec/fixtures/responses/track_users/unauthorized/responds_with_unauthorized.yml
|
300
311
|
- spec/fixtures/responses/track_users/with_success/responds_with_created.yml
|
301
312
|
- spec/fixtures/responses/track_users/with_success/responds_with_success_message.yml
|
313
|
+
- spec/integrations/delete_users_spec.rb
|
302
314
|
- spec/integrations/email_status_spec.rb
|
303
315
|
- spec/integrations/export_users_spec.rb
|
304
316
|
- spec/integrations/list_segments_spec.rb
|