From 2817a1d5e9a9f6dd57ba377424ffc11544a87aeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Guzm=C3=A1n=20Sierra?= <97761783+FelipeGuzmanSierra@users.noreply.github.com> Date: Fri, 6 Sep 2024 17:43:07 -0500 Subject: [PATCH] Improve web availability bot notification message (#100) --- lib/bas/bot/fetch_billing_from_digital_ocean.rb | 4 +--- lib/bas/bot/review_domain_availability.rb | 7 +------ spec/bas/bot/fetch_billing_from_digital_ocean_spec.rb | 2 +- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/lib/bas/bot/fetch_billing_from_digital_ocean.rb b/lib/bas/bot/fetch_billing_from_digital_ocean.rb index 6ce49fb..d157abd 100644 --- a/lib/bas/bot/fetch_billing_from_digital_ocean.rb +++ b/lib/bas/bot/fetch_billing_from_digital_ocean.rb @@ -81,9 +81,7 @@ def params end def last_billing - return read_response.data["billing"] unless read_response.data.nil? - - { month_to_date_balance: 0 } + read_response.data.nil? ? nil : read_response.data["billing"] end end end diff --git a/lib/bas/bot/review_domain_availability.rb b/lib/bas/bot/review_domain_availability.rb index 279e644..3097d41 100644 --- a/lib/bas/bot/review_domain_availability.rb +++ b/lib/bas/bot/review_domain_availability.rb @@ -90,12 +90,7 @@ def availability end def notification(response) - data = { - domain: read_response.data["url"], - status_code: response.code - } - - ":warning: Domain is down: #{data}" + ":warning: The Domain #{read_response.data["url"]} is down with an error code of #{response.code}" end end end diff --git a/spec/bas/bot/fetch_billing_from_digital_ocean_spec.rb b/spec/bas/bot/fetch_billing_from_digital_ocean_spec.rb index 40fbce6..5a42e97 100644 --- a/spec/bas/bot/fetch_billing_from_digital_ocean_spec.rb +++ b/spec/bas/bot/fetch_billing_from_digital_ocean_spec.rb @@ -110,7 +110,7 @@ processed = @bot.process - expect(processed).to eq({ success: { billing: do_bill, last_billing: { month_to_date_balance: 0 } } }) + expect(processed).to eq({ success: { billing: do_bill, last_billing: nil } }) end it "returns a success hash with the digital ocean bill when a last billing was not found" do