From 73fc7a786eaeeb71b0476695085cb4a78fb4aa85 Mon Sep 17 00:00:00 2001 From: aurelien-reeves-scalingo Date: Tue, 3 Jan 2023 10:03:42 +0100 Subject: [PATCH 1/3] fix(backups#restore): Unpack response from backups#restore properly fix #44 --- lib/scalingo/regional_database/backups.rb | 2 +- .../regional_database/backups/create-201.json | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/scalingo/regional_database/backups.rb b/lib/scalingo/regional_database/backups.rb index 1b9c361..bf01800 100644 --- a/lib/scalingo/regional_database/backups.rb +++ b/lib/scalingo/regional_database/backups.rb @@ -12,7 +12,7 @@ def create(addon_id, headers = nil, &block) &block ) - unpack { response } + unpack (:database_backup) { response } end def for(addon_id, headers = nil, &block) diff --git a/samples/regional_database/backups/create-201.json b/samples/regional_database/backups/create-201.json index ef43b33..96c1d0d 100644 --- a/samples/regional_database/backups/create-201.json +++ b/samples/regional_database/backups/create-201.json @@ -18,13 +18,15 @@ "Referrer-Policy": "strict-origin-when-cross-origin" }, "json_body": { - "id": "5b8b36104ffb090be1ac3ce1", - "created_at": "2019-07-18T03:00:00.178+02:00", - "name": "20180902010000_kibana-3938", - "size": 0, - "status": "pending", - "database_id": "597601234ffb097af4f3099b", - "type": "postgresql" + "database_backup": { + "id": "5b8b36104ffb090be1ac3ce1", + "created_at": "2019-07-18T03:00:00.178+02:00", + "name": "20180902010000_kibana-3938", + "size": 0, + "status": "pending", + "database_id": "597601234ffb097af4f3099b", + "type": "postgresql" + } } } } From e4eb884b081be05fabe20215a42f7ade8e8de751 Mon Sep 17 00:00:00 2001 From: aurelien-reeves-scalingo Date: Tue, 3 Jan 2023 10:06:47 +0100 Subject: [PATCH 2/3] fix(lint): Remove extra whitespace --- lib/scalingo/regional_database/backups.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/scalingo/regional_database/backups.rb b/lib/scalingo/regional_database/backups.rb index bf01800..0b835b0 100644 --- a/lib/scalingo/regional_database/backups.rb +++ b/lib/scalingo/regional_database/backups.rb @@ -12,7 +12,7 @@ def create(addon_id, headers = nil, &block) &block ) - unpack (:database_backup) { response } + unpack(:database_backup) { response } end def for(addon_id, headers = nil, &block) From 905a37db5bbad0f3301739714402a6db45460d37 Mon Sep 17 00:00:00 2001 From: aurelien-reeves-scalingo Date: Tue, 3 Jan 2023 10:09:22 +0100 Subject: [PATCH 3/3] Add changelog entry --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5619af..2f118a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Unreleased +* Bugfix: response of Backups#create was not properly unpacked ([#44](https://github.com/Scalingo/scalingo-ruby-api/issues/44)) + ## 3.2.0 - 2022-12-23 * Removal: `Scalingo::Client#agora_fr1` had been removed since the region no longer exists.