From 63964116cae72f0874160753d93504646f2acf50 Mon Sep 17 00:00:00 2001 From: Dominic Date: Thu, 12 Jan 2023 11:21:54 -0800 Subject: [PATCH 1/3] Add functions to delete by alias and braze id --- lib/braze_ruby/endpoints/delete_users.rb | 8 +++ lib/braze_ruby/rest/delete_users.rb | 6 +- .../braze_ruby/endpoints/delete_users_spec.rb | 26 +++++++ spec/braze_ruby/rest/delete_users_spec.rb | 8 ++- .../responds_with_unauthorized.yml | 67 +++++++++++++++++++ .../with_success/responds_with_created.yml | 67 +++++++++++++++++++ .../responds_with_success_message.yml | 67 +++++++++++++++++++ .../responds_with_unauthorized.yml | 67 +++++++++++++++++++ .../with_success/responds_with_created.yml | 67 +++++++++++++++++++ .../responds_with_success_message.yml | 67 +++++++++++++++++++ spec/integrations/delete_users_spec.rb | 58 ++++++++++++++++ 11 files changed, 505 insertions(+), 3 deletions(-) create mode 100644 spec/fixtures/responses/delete_users_by_alias/unauthorized/responds_with_unauthorized.yml create mode 100644 spec/fixtures/responses/delete_users_by_alias/with_success/responds_with_created.yml create mode 100644 spec/fixtures/responses/delete_users_by_alias/with_success/responds_with_success_message.yml create mode 100644 spec/fixtures/responses/delete_users_by_braze_id/unauthorized/responds_with_unauthorized.yml create mode 100644 spec/fixtures/responses/delete_users_by_braze_id/with_success/responds_with_created.yml create mode 100644 spec/fixtures/responses/delete_users_by_braze_id/with_success/responds_with_success_message.yml diff --git a/lib/braze_ruby/endpoints/delete_users.rb b/lib/braze_ruby/endpoints/delete_users.rb index 1dfeeaa..b15001e 100644 --- a/lib/braze_ruby/endpoints/delete_users.rb +++ b/lib/braze_ruby/endpoints/delete_users.rb @@ -13,6 +13,14 @@ def delete_users(payload) delete_users_action(external_ids: payload.compact.uniq) end + def delete_users_by_alias(payload) + delete_users_action(user_aliases: payload.compact.uniq) + end + + def delete_users_by_braze_id(payload) + delete_users_action(braze_ids: payload.compact.uniq) + end + private def delete_users_service diff --git a/lib/braze_ruby/rest/delete_users.rb b/lib/braze_ruby/rest/delete_users.rb index e15f862..70a352a 100644 --- a/lib/braze_ruby/rest/delete_users.rb +++ b/lib/braze_ruby/rest/delete_users.rb @@ -3,9 +3,11 @@ module BrazeRuby module REST class DeleteUsers < Base - def perform(external_ids: []) + def perform(external_ids: [], user_aliases: [], braze_ids: []) http.post "/users/delete", { - external_ids: external_ids + external_ids: external_ids, + user_aliases: user_aliases, + braze_ids: braze_ids, } end end diff --git a/spec/braze_ruby/endpoints/delete_users_spec.rb b/spec/braze_ruby/endpoints/delete_users_spec.rb index 0290123..f89944d 100644 --- a/spec/braze_ruby/endpoints/delete_users_spec.rb +++ b/spec/braze_ruby/endpoints/delete_users_spec.rb @@ -28,4 +28,30 @@ def api_key delete_users! end end + + describe "#delete_users_by_alias" do + let(:payload) { [1, 2, 3] } + + subject(:delete_users_by_alias!) { api.delete_users_by_alias(payload) } + + it "deletes users by alias" do + expect(delete_users_service).to receive(:perform) + .with(user_aliases: payload) + + delete_users_by_alias! + end + end + + describe "#delete_users_by_braze_id" do + let(:payload) { [1, 2, 3] } + + subject(:delete_users_by_braze_id!) { api.delete_users_by_braze_id(payload) } + + it "deletes users by braze id" do + expect(delete_users_service).to receive(:perform) + .with(braze_ids: payload) + + delete_users_by_braze_id! + end + end end diff --git a/spec/braze_ruby/rest/delete_users_spec.rb b/spec/braze_ruby/rest/delete_users_spec.rb index 7e04139..5e8c5f8 100644 --- a/spec/braze_ruby/rest/delete_users_spec.rb +++ b/spec/braze_ruby/rest/delete_users_spec.rb @@ -5,7 +5,13 @@ describe BrazeRuby::REST::DeleteUsers do let(:http) { double(:http) } - let(:payload) { {external_ids: [1, 2, 3]} } + let(:payload) do + { + external_ids: [1, 2, 3], + user_aliases: [4, 5, 6], + braze_ids: [7, 8, 9], + } + end subject { described_class.new :api_key, :rest_url, {} } diff --git a/spec/fixtures/responses/delete_users_by_alias/unauthorized/responds_with_unauthorized.yml b/spec/fixtures/responses/delete_users_by_alias/unauthorized/responds_with_unauthorized.yml new file mode 100644 index 0000000..07b5e8a --- /dev/null +++ b/spec/fixtures/responses/delete_users_by_alias/unauthorized/responds_with_unauthorized.yml @@ -0,0 +1,67 @@ +--- +http_interactions: +- request: + method: post + uri: "/users/delete" + body: + encoding: UTF-8 + string: '{"external_ids":[],"user_aliases":["alias1","alias2","alias3"],"braze_ids":[]}' + headers: + Content-Type: + - application/json + Accept: + - application/json + User-Agent: + - Braze Ruby gem v0.8.0 + Authorization: + - Bearer non-existent + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 401 + message: Unauthorized + headers: + Connection: + - keep-alive + Content-Type: + - application/json + Server: + - nginx + X-Ratelimit-Limit: + - '' + X-Ratelimit-Remaining: + - '' + X-Ratelimit-Reset: + - '' + Cache-Control: + - no-cache + X-Request-Id: + - be73e5ce-a55d-4847-9097-eee433855120 + X-Runtime: + - '0.001345' + Accept-Ranges: + - bytes + Date: + - Thu, 12 Jan 2023 19:19:06 GMT + Via: + - 1.1 varnish + X-Served-By: + - cache-sjc10052-SJC + X-Cache: + - MISS + X-Cache-Hits: + - '0' + X-Timer: + - S1673551147.709402,VS0,VE78 + Vary: + - Origin,Accept-Encoding + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Transfer-Encoding: + - chunked + body: + encoding: ASCII-8BIT + string: '{"message":"Invalid API key: non-existent"}' + recorded_at: Thu, 12 Jan 2023 19:19:06 GMT +recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/responses/delete_users_by_alias/with_success/responds_with_created.yml b/spec/fixtures/responses/delete_users_by_alias/with_success/responds_with_created.yml new file mode 100644 index 0000000..d832be1 --- /dev/null +++ b/spec/fixtures/responses/delete_users_by_alias/with_success/responds_with_created.yml @@ -0,0 +1,67 @@ +--- +http_interactions: +- request: + method: post + uri: "/users/delete" + body: + encoding: UTF-8 + string: '{"external_ids":[],"user_aliases":["alias1","alias2","alias3"],"braze_ids":[]}' + headers: + Content-Type: + - application/json + Accept: + - application/json + User-Agent: + - Braze Ruby gem v0.8.0 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 401 + message: Unauthorized + headers: + Connection: + - keep-alive + Content-Type: + - application/json + Server: + - nginx + X-Ratelimit-Limit: + - '' + X-Ratelimit-Remaining: + - '' + X-Ratelimit-Reset: + - '' + Cache-Control: + - no-cache + X-Request-Id: + - 567c3f18-74a9-409b-8613-36b44b2def95 + X-Runtime: + - '0.001085' + Accept-Ranges: + - bytes + Date: + - Thu, 12 Jan 2023 19:19:06 GMT + Via: + - 1.1 varnish + X-Served-By: + - cache-sjc10044-SJC + X-Cache: + - MISS + X-Cache-Hits: + - '0' + X-Timer: + - S1673551146.027343,VS0,VE79 + Vary: + - Origin,Accept-Encoding + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Transfer-Encoding: + - chunked + body: + encoding: ASCII-8BIT + string: '{"message":"Invalid API key: "}' + recorded_at: Thu, 12 Jan 2023 19:19:06 GMT +recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/responses/delete_users_by_alias/with_success/responds_with_success_message.yml b/spec/fixtures/responses/delete_users_by_alias/with_success/responds_with_success_message.yml new file mode 100644 index 0000000..eed8cf9 --- /dev/null +++ b/spec/fixtures/responses/delete_users_by_alias/with_success/responds_with_success_message.yml @@ -0,0 +1,67 @@ +--- +http_interactions: +- request: + method: post + uri: "/users/delete" + body: + encoding: UTF-8 + string: '{"external_ids":[],"user_aliases":["alias1","alias2","alias3"],"braze_ids":[]}' + headers: + Content-Type: + - application/json + Accept: + - application/json + User-Agent: + - Braze Ruby gem v0.8.0 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 401 + message: Unauthorized + headers: + Connection: + - keep-alive + Content-Type: + - application/json + Server: + - nginx + X-Ratelimit-Limit: + - '' + X-Ratelimit-Remaining: + - '' + X-Ratelimit-Reset: + - '' + Cache-Control: + - no-cache + X-Request-Id: + - 0c0d2727-88f7-4e51-8c1f-fbf0fcd7d3f6 + X-Runtime: + - '0.001838' + Accept-Ranges: + - bytes + Date: + - Thu, 12 Jan 2023 19:19:06 GMT + Via: + - 1.1 varnish + X-Served-By: + - cache-sjc10063-SJC + X-Cache: + - MISS + X-Cache-Hits: + - '0' + X-Timer: + - S1673551146.275128,VS0,VE307 + Vary: + - Origin,Accept-Encoding + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Transfer-Encoding: + - chunked + body: + encoding: ASCII-8BIT + string: '{"message":"Invalid API key: "}' + recorded_at: Thu, 12 Jan 2023 19:19:06 GMT +recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/responses/delete_users_by_braze_id/unauthorized/responds_with_unauthorized.yml b/spec/fixtures/responses/delete_users_by_braze_id/unauthorized/responds_with_unauthorized.yml new file mode 100644 index 0000000..0e87964 --- /dev/null +++ b/spec/fixtures/responses/delete_users_by_braze_id/unauthorized/responds_with_unauthorized.yml @@ -0,0 +1,67 @@ +--- +http_interactions: +- request: + method: post + uri: "/users/delete" + body: + encoding: UTF-8 + string: '{"external_ids":[],"user_aliases":[],"braze_ids":["id1","id2","id3"]}' + headers: + Content-Type: + - application/json + Accept: + - application/json + User-Agent: + - Braze Ruby gem v0.8.0 + Authorization: + - Bearer non-existent + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 401 + message: Unauthorized + headers: + Connection: + - keep-alive + Content-Type: + - application/json + Server: + - nginx + X-Ratelimit-Limit: + - '' + X-Ratelimit-Remaining: + - '' + X-Ratelimit-Reset: + - '' + Cache-Control: + - no-cache + X-Request-Id: + - a9eda6a8-75eb-4f7e-abbb-a654bbf48783 + X-Runtime: + - '0.001064' + Accept-Ranges: + - bytes + Date: + - Thu, 12 Jan 2023 19:19:07 GMT + Via: + - 1.1 varnish + X-Served-By: + - cache-sjc10034-SJC + X-Cache: + - MISS + X-Cache-Hits: + - '0' + X-Timer: + - S1673551148.691738,VS0,VE78 + Vary: + - Origin,Accept-Encoding + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Transfer-Encoding: + - chunked + body: + encoding: ASCII-8BIT + string: '{"message":"Invalid API key: non-existent"}' + recorded_at: Thu, 12 Jan 2023 19:19:07 GMT +recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/responses/delete_users_by_braze_id/with_success/responds_with_created.yml b/spec/fixtures/responses/delete_users_by_braze_id/with_success/responds_with_created.yml new file mode 100644 index 0000000..6411dea --- /dev/null +++ b/spec/fixtures/responses/delete_users_by_braze_id/with_success/responds_with_created.yml @@ -0,0 +1,67 @@ +--- +http_interactions: +- request: + method: post + uri: "/users/delete" + body: + encoding: UTF-8 + string: '{"external_ids":[],"user_aliases":[],"braze_ids":["id1","id2","id3"]}' + headers: + Content-Type: + - application/json + Accept: + - application/json + User-Agent: + - Braze Ruby gem v0.8.0 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 401 + message: Unauthorized + headers: + Connection: + - keep-alive + Content-Type: + - application/json + Server: + - nginx + X-Ratelimit-Limit: + - '' + X-Ratelimit-Remaining: + - '' + X-Ratelimit-Reset: + - '' + Cache-Control: + - no-cache + X-Request-Id: + - 26610db5-d837-47e8-9a1d-1a06a76871bb + X-Runtime: + - '0.001316' + Accept-Ranges: + - bytes + Date: + - Thu, 12 Jan 2023 19:19:07 GMT + Via: + - 1.1 varnish + X-Served-By: + - cache-sjc10066-SJC + X-Cache: + - MISS + X-Cache-Hits: + - '0' + X-Timer: + - S1673551147.969212,VS0,VE230 + Vary: + - Origin,Accept-Encoding + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Transfer-Encoding: + - chunked + body: + encoding: ASCII-8BIT + string: '{"message":"Invalid API key: "}' + recorded_at: Thu, 12 Jan 2023 19:19:07 GMT +recorded_with: VCR 6.1.0 diff --git a/spec/fixtures/responses/delete_users_by_braze_id/with_success/responds_with_success_message.yml b/spec/fixtures/responses/delete_users_by_braze_id/with_success/responds_with_success_message.yml new file mode 100644 index 0000000..f2221b0 --- /dev/null +++ b/spec/fixtures/responses/delete_users_by_braze_id/with_success/responds_with_success_message.yml @@ -0,0 +1,67 @@ +--- +http_interactions: +- request: + method: post + uri: "/users/delete" + body: + encoding: UTF-8 + string: '{"external_ids":[],"user_aliases":[],"braze_ids":["id1","id2","id3"]}' + headers: + Content-Type: + - application/json + Accept: + - application/json + User-Agent: + - Braze Ruby gem v0.8.0 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 401 + message: Unauthorized + headers: + Connection: + - keep-alive + Content-Type: + - application/json + Server: + - nginx + X-Ratelimit-Limit: + - '' + X-Ratelimit-Remaining: + - '' + X-Ratelimit-Reset: + - '' + Cache-Control: + - no-cache + X-Request-Id: + - 930cc725-8ee6-4300-a8b7-260aadee586b + X-Runtime: + - '0.001912' + Accept-Ranges: + - bytes + Date: + - Thu, 12 Jan 2023 19:19:07 GMT + Via: + - 1.1 varnish + X-Served-By: + - cache-sjc10053-SJC + X-Cache: + - MISS + X-Cache-Hits: + - '0' + X-Timer: + - S1673551147.370901,VS0,VE164 + Vary: + - Origin,Accept-Encoding + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Transfer-Encoding: + - chunked + body: + encoding: ASCII-8BIT + string: '{"message":"Invalid API key: "}' + recorded_at: Thu, 12 Jan 2023 19:19:07 GMT +recorded_with: VCR 6.1.0 diff --git a/spec/integrations/delete_users_spec.rb b/spec/integrations/delete_users_spec.rb index 25b984b..3647fb7 100644 --- a/spec/integrations/delete_users_spec.rb +++ b/spec/integrations/delete_users_spec.rb @@ -30,3 +30,61 @@ end end end + +describe "delete users by alias" do + let(:user_aliases) { ["alias1", "alias2", "alias3"] } + + subject(:delete_users_by_alias) do + api.delete_users_by_alias(user_aliases) + end + + context "with success", vcr: true do + it "responds with created" do + expect(delete_users_by_alias.status).to be 201 + end + + it "responds with success message" do + expect(JSON.parse(delete_users_by_alias.body)).to include( + "deleted" => 3, + "message" => "success" + ) + end + end + + context "unauthorized", vcr: true do + let(:api_key) { "non-existent" } + + it "responds with unauthorized" do + expect(delete_users_by_alias.status).to be 401 + end + end +end + +describe "delete users by braze id" do + let(:braze_ids) { ["id1", "id2", "id3"] } + + subject(:delete_users_by_braze_id) do + api.delete_users_by_braze_id(braze_ids) + end + + context "with success", vcr: true do + it "responds with created" do + expect(delete_users_by_braze_id.status).to be 201 + end + + it "responds with success message" do + expect(JSON.parse(delete_users_by_braze_id.body)).to include( + "deleted" => 3, + "message" => "success" + ) + end + end + + context "unauthorized", vcr: true do + let(:api_key) { "non-existent" } + + it "responds with unauthorized" do + expect(delete_users_by_braze_id.status).to be 401 + end + end +end \ No newline at end of file From 0ebf05bd3f96bbc8e7fe074eabfa4daf602062e7 Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 23 Jan 2023 14:24:39 -0800 Subject: [PATCH 2/3] Clean up --- spec/integrations/delete_users_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/integrations/delete_users_spec.rb b/spec/integrations/delete_users_spec.rb index 3647fb7..7e687d2 100644 --- a/spec/integrations/delete_users_spec.rb +++ b/spec/integrations/delete_users_spec.rb @@ -87,4 +87,4 @@ expect(delete_users_by_braze_id.status).to be 401 end end -end \ No newline at end of file +end From d7ee5398cf970ab8f860624a09bea3928c1a3aae Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 23 Jan 2023 14:41:32 -0800 Subject: [PATCH 3/3] Update cassettes --- .../responds_with_unauthorized.yml | 2 +- .../with_success/responds_with_created.yml | 2 +- .../responds_with_success_message.yml | 2 +- .../with_success/responds_with_created.yml | 134 +++++++++--------- .../responds_with_success_message.yml | 134 +++++++++--------- .../with_success/responds_with_created.yml | 134 +++++++++--------- .../responds_with_success_message.yml | 134 +++++++++--------- 7 files changed, 279 insertions(+), 263 deletions(-) diff --git a/spec/fixtures/responses/delete_users/unauthorized/responds_with_unauthorized.yml b/spec/fixtures/responses/delete_users/unauthorized/responds_with_unauthorized.yml index 201c0bf..92a450b 100644 --- a/spec/fixtures/responses/delete_users/unauthorized/responds_with_unauthorized.yml +++ b/spec/fixtures/responses/delete_users/unauthorized/responds_with_unauthorized.yml @@ -5,7 +5,7 @@ http_interactions: uri: "/users/delete" body: encoding: UTF-8 - string: '{"external_ids":[400,401,402]}' + string: '{"external_ids":[400,401,402],"user_aliases":[],"braze_ids":[]}' headers: Content-Type: - application/json diff --git a/spec/fixtures/responses/delete_users/with_success/responds_with_created.yml b/spec/fixtures/responses/delete_users/with_success/responds_with_created.yml index 1920156..961ce6a 100644 --- a/spec/fixtures/responses/delete_users/with_success/responds_with_created.yml +++ b/spec/fixtures/responses/delete_users/with_success/responds_with_created.yml @@ -5,7 +5,7 @@ http_interactions: uri: "/users/delete" body: encoding: UTF-8 - string: '{"external_ids":[400,401,402]}' + string: '{"external_ids":[400,401,402],"user_aliases":[],"braze_ids":[]}' headers: Content-Type: - application/json diff --git a/spec/fixtures/responses/delete_users/with_success/responds_with_success_message.yml b/spec/fixtures/responses/delete_users/with_success/responds_with_success_message.yml index f67b78d..303935a 100644 --- a/spec/fixtures/responses/delete_users/with_success/responds_with_success_message.yml +++ b/spec/fixtures/responses/delete_users/with_success/responds_with_success_message.yml @@ -5,7 +5,7 @@ http_interactions: uri: "/users/delete" body: encoding: UTF-8 - string: '{"external_ids":[400,401,402]}' + string: '{"external_ids":[400,401,402],"user_aliases":[],"braze_ids":[]}' headers: Content-Type: - application/json diff --git a/spec/fixtures/responses/delete_users_by_alias/with_success/responds_with_created.yml b/spec/fixtures/responses/delete_users_by_alias/with_success/responds_with_created.yml index d832be1..5b97f6f 100644 --- a/spec/fixtures/responses/delete_users_by_alias/with_success/responds_with_created.yml +++ b/spec/fixtures/responses/delete_users_by_alias/with_success/responds_with_created.yml @@ -1,67 +1,71 @@ --- http_interactions: -- request: - method: post - uri: "/users/delete" - body: - encoding: UTF-8 - string: '{"external_ids":[],"user_aliases":["alias1","alias2","alias3"],"braze_ids":[]}' - headers: - Content-Type: - - application/json - Accept: - - application/json - User-Agent: - - Braze Ruby gem v0.8.0 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 401 - message: Unauthorized - headers: - Connection: - - keep-alive - Content-Type: - - application/json - Server: - - nginx - X-Ratelimit-Limit: - - '' - X-Ratelimit-Remaining: - - '' - X-Ratelimit-Reset: - - '' - Cache-Control: - - no-cache - X-Request-Id: - - 567c3f18-74a9-409b-8613-36b44b2def95 - X-Runtime: - - '0.001085' - Accept-Ranges: - - bytes - Date: - - Thu, 12 Jan 2023 19:19:06 GMT - Via: - - 1.1 varnish - X-Served-By: - - cache-sjc10044-SJC - X-Cache: - - MISS - X-Cache-Hits: - - '0' - X-Timer: - - S1673551146.027343,VS0,VE79 - Vary: - - Origin,Accept-Encoding - Strict-Transport-Security: - - max-age=31536000; includeSubDomains - Transfer-Encoding: - - chunked - body: - encoding: ASCII-8BIT - string: '{"message":"Invalid API key: "}' - recorded_at: Thu, 12 Jan 2023 19:19:06 GMT -recorded_with: VCR 6.1.0 + - request: + method: post + uri: "/users/delete" + body: + encoding: UTF-8 + string: '{"external_ids":[],"user_aliases":["alias1","alias2","alias3"],"braze_ids":[]}' + headers: + Content-Type: + - application/json + Accept: + - application/json + User-Agent: + - Braze Ruby gem v0.3.3 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Connection: + - keep-alive + Content-Length: + - '58' + Cache-Control: + - max-age=0, private, must-revalidate + Content-Type: + - application/json + Etag: + - W/"9a22d0f53e9efcbef8e52c6a21060bc1" + Server: + - nginx + Strict-Transport-Security: + - max-age=0; includeSubDomains + - max-age=31536000; includeSubDomains + X-Ratelimit-Limit: + - '250000' + X-Ratelimit-Remaining: + - '249937' + X-Ratelimit-Reset: + - '1592427600' + X-Request-Id: + - dd8e1db7-bb0d-4e71-a14a-c4c5c9322f49 + X-Runtime: + - '0.005861' + Accept-Ranges: + - bytes + Date: + - Wed, 17 Jun 2020 20:59:32 GMT + Via: + - 1.1 varnish + X-Served-By: + - cache-hhn4035-HHN + X-Cache: + - MISS + X-Cache-Hits: + - '0' + X-Timer: + - S1592427572.293833,VS0,VE9 + Vary: + - Origin,Accept-Encoding + body: + encoding: ASCII-8BIT + string: '{"deleted":3,"message":"success"}' + http_version: + recorded_at: Wed, 17 Jun 2020 20:59:32 GMT +recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/responses/delete_users_by_alias/with_success/responds_with_success_message.yml b/spec/fixtures/responses/delete_users_by_alias/with_success/responds_with_success_message.yml index eed8cf9..6dfd0eb 100644 --- a/spec/fixtures/responses/delete_users_by_alias/with_success/responds_with_success_message.yml +++ b/spec/fixtures/responses/delete_users_by_alias/with_success/responds_with_success_message.yml @@ -1,67 +1,71 @@ --- http_interactions: -- request: - method: post - uri: "/users/delete" - body: - encoding: UTF-8 - string: '{"external_ids":[],"user_aliases":["alias1","alias2","alias3"],"braze_ids":[]}' - headers: - Content-Type: - - application/json - Accept: - - application/json - User-Agent: - - Braze Ruby gem v0.8.0 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 401 - message: Unauthorized - headers: - Connection: - - keep-alive - Content-Type: - - application/json - Server: - - nginx - X-Ratelimit-Limit: - - '' - X-Ratelimit-Remaining: - - '' - X-Ratelimit-Reset: - - '' - Cache-Control: - - no-cache - X-Request-Id: - - 0c0d2727-88f7-4e51-8c1f-fbf0fcd7d3f6 - X-Runtime: - - '0.001838' - Accept-Ranges: - - bytes - Date: - - Thu, 12 Jan 2023 19:19:06 GMT - Via: - - 1.1 varnish - X-Served-By: - - cache-sjc10063-SJC - X-Cache: - - MISS - X-Cache-Hits: - - '0' - X-Timer: - - S1673551146.275128,VS0,VE307 - Vary: - - Origin,Accept-Encoding - Strict-Transport-Security: - - max-age=31536000; includeSubDomains - Transfer-Encoding: - - chunked - body: - encoding: ASCII-8BIT - string: '{"message":"Invalid API key: "}' - recorded_at: Thu, 12 Jan 2023 19:19:06 GMT -recorded_with: VCR 6.1.0 + - request: + method: post + uri: "/users/delete" + body: + encoding: UTF-8 + string: '{"external_ids":[],"user_aliases":["alias1","alias2","alias3"],"braze_ids":[]}' + headers: + Content-Type: + - application/json + Accept: + - application/json + User-Agent: + - Braze Ruby gem v0.3.3 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Connection: + - keep-alive + Content-Length: + - '58' + Cache-Control: + - max-age=0, private, must-revalidate + Content-Type: + - application/json + Etag: + - W/"9a22d0f53e9efcbef8e52c6a21060bc1" + Server: + - nginx + Strict-Transport-Security: + - max-age=0; includeSubDomains + - max-age=31536000; includeSubDomains + X-Ratelimit-Limit: + - '250000' + X-Ratelimit-Remaining: + - '249936' + X-Ratelimit-Reset: + - '1592427600' + X-Request-Id: + - '096a3b98-e784-4eb4-ba32-dd18749c3ceb' + X-Runtime: + - '0.006707' + Accept-Ranges: + - bytes + Date: + - Wed, 17 Jun 2020 20:59:32 GMT + Via: + - 1.1 varnish + X-Served-By: + - cache-hhn4059-HHN + X-Cache: + - MISS + X-Cache-Hits: + - '0' + X-Timer: + - S1592427572.403094,VS0,VE9 + Vary: + - Origin,Accept-Encoding + body: + encoding: ASCII-8BIT + string: '{"deleted":3,"message":"success"}' + http_version: + recorded_at: Wed, 17 Jun 2020 20:59:32 GMT +recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/responses/delete_users_by_braze_id/with_success/responds_with_created.yml b/spec/fixtures/responses/delete_users_by_braze_id/with_success/responds_with_created.yml index 6411dea..ceb3583 100644 --- a/spec/fixtures/responses/delete_users_by_braze_id/with_success/responds_with_created.yml +++ b/spec/fixtures/responses/delete_users_by_braze_id/with_success/responds_with_created.yml @@ -1,67 +1,71 @@ --- http_interactions: -- request: - method: post - uri: "/users/delete" - body: - encoding: UTF-8 - string: '{"external_ids":[],"user_aliases":[],"braze_ids":["id1","id2","id3"]}' - headers: - Content-Type: - - application/json - Accept: - - application/json - User-Agent: - - Braze Ruby gem v0.8.0 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 401 - message: Unauthorized - headers: - Connection: - - keep-alive - Content-Type: - - application/json - Server: - - nginx - X-Ratelimit-Limit: - - '' - X-Ratelimit-Remaining: - - '' - X-Ratelimit-Reset: - - '' - Cache-Control: - - no-cache - X-Request-Id: - - 26610db5-d837-47e8-9a1d-1a06a76871bb - X-Runtime: - - '0.001316' - Accept-Ranges: - - bytes - Date: - - Thu, 12 Jan 2023 19:19:07 GMT - Via: - - 1.1 varnish - X-Served-By: - - cache-sjc10066-SJC - X-Cache: - - MISS - X-Cache-Hits: - - '0' - X-Timer: - - S1673551147.969212,VS0,VE230 - Vary: - - Origin,Accept-Encoding - Strict-Transport-Security: - - max-age=31536000; includeSubDomains - Transfer-Encoding: - - chunked - body: - encoding: ASCII-8BIT - string: '{"message":"Invalid API key: "}' - recorded_at: Thu, 12 Jan 2023 19:19:07 GMT -recorded_with: VCR 6.1.0 + - request: + method: post + uri: "/users/delete" + body: + encoding: UTF-8 + string: '{"external_ids":[],"user_aliases":[],"braze_ids":["id1","id2","id3"]}' + headers: + Content-Type: + - application/json + Accept: + - application/json + User-Agent: + - Braze Ruby gem v0.3.3 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Connection: + - keep-alive + Content-Length: + - '58' + Cache-Control: + - max-age=0, private, must-revalidate + Content-Type: + - application/json + Etag: + - W/"9a22d0f53e9efcbef8e52c6a21060bc1" + Server: + - nginx + Strict-Transport-Security: + - max-age=0; includeSubDomains + - max-age=31536000; includeSubDomains + X-Ratelimit-Limit: + - '250000' + X-Ratelimit-Remaining: + - '249937' + X-Ratelimit-Reset: + - '1592427600' + X-Request-Id: + - dd8e1db7-bb0d-4e71-a14a-c4c5c9322f49 + X-Runtime: + - '0.005861' + Accept-Ranges: + - bytes + Date: + - Wed, 17 Jun 2020 20:59:32 GMT + Via: + - 1.1 varnish + X-Served-By: + - cache-hhn4035-HHN + X-Cache: + - MISS + X-Cache-Hits: + - '0' + X-Timer: + - S1592427572.293833,VS0,VE9 + Vary: + - Origin,Accept-Encoding + body: + encoding: ASCII-8BIT + string: '{"deleted":3,"message":"success"}' + http_version: + recorded_at: Wed, 17 Jun 2020 20:59:32 GMT +recorded_with: VCR 5.0.0 diff --git a/spec/fixtures/responses/delete_users_by_braze_id/with_success/responds_with_success_message.yml b/spec/fixtures/responses/delete_users_by_braze_id/with_success/responds_with_success_message.yml index f2221b0..24cc772 100644 --- a/spec/fixtures/responses/delete_users_by_braze_id/with_success/responds_with_success_message.yml +++ b/spec/fixtures/responses/delete_users_by_braze_id/with_success/responds_with_success_message.yml @@ -1,67 +1,71 @@ --- http_interactions: -- request: - method: post - uri: "/users/delete" - body: - encoding: UTF-8 - string: '{"external_ids":[],"user_aliases":[],"braze_ids":["id1","id2","id3"]}' - headers: - Content-Type: - - application/json - Accept: - - application/json - User-Agent: - - Braze Ruby gem v0.8.0 - Authorization: - - Bearer - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - response: - status: - code: 401 - message: Unauthorized - headers: - Connection: - - keep-alive - Content-Type: - - application/json - Server: - - nginx - X-Ratelimit-Limit: - - '' - X-Ratelimit-Remaining: - - '' - X-Ratelimit-Reset: - - '' - Cache-Control: - - no-cache - X-Request-Id: - - 930cc725-8ee6-4300-a8b7-260aadee586b - X-Runtime: - - '0.001912' - Accept-Ranges: - - bytes - Date: - - Thu, 12 Jan 2023 19:19:07 GMT - Via: - - 1.1 varnish - X-Served-By: - - cache-sjc10053-SJC - X-Cache: - - MISS - X-Cache-Hits: - - '0' - X-Timer: - - S1673551147.370901,VS0,VE164 - Vary: - - Origin,Accept-Encoding - Strict-Transport-Security: - - max-age=31536000; includeSubDomains - Transfer-Encoding: - - chunked - body: - encoding: ASCII-8BIT - string: '{"message":"Invalid API key: "}' - recorded_at: Thu, 12 Jan 2023 19:19:07 GMT -recorded_with: VCR 6.1.0 + - request: + method: post + uri: "/users/delete" + body: + encoding: UTF-8 + string: '{"external_ids":[],"user_aliases":[],"braze_ids":["id1","id2","id3"]}' + headers: + Content-Type: + - application/json + Accept: + - application/json + User-Agent: + - Braze Ruby gem v0.3.3 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Connection: + - keep-alive + Content-Length: + - '58' + Cache-Control: + - max-age=0, private, must-revalidate + Content-Type: + - application/json + Etag: + - W/"9a22d0f53e9efcbef8e52c6a21060bc1" + Server: + - nginx + Strict-Transport-Security: + - max-age=0; includeSubDomains + - max-age=31536000; includeSubDomains + X-Ratelimit-Limit: + - '250000' + X-Ratelimit-Remaining: + - '249936' + X-Ratelimit-Reset: + - '1592427600' + X-Request-Id: + - '096a3b98-e784-4eb4-ba32-dd18749c3ceb' + X-Runtime: + - '0.006707' + Accept-Ranges: + - bytes + Date: + - Wed, 17 Jun 2020 20:59:32 GMT + Via: + - 1.1 varnish + X-Served-By: + - cache-hhn4059-HHN + X-Cache: + - MISS + X-Cache-Hits: + - '0' + X-Timer: + - S1592427572.403094,VS0,VE9 + Vary: + - Origin,Accept-Encoding + body: + encoding: ASCII-8BIT + string: '{"deleted":3,"message":"success"}' + http_version: + recorded_at: Wed, 17 Jun 2020 20:59:32 GMT +recorded_with: VCR 5.0.0