diff --git a/CorvallisBus.Core/Models/ServiceAlert.cs b/CorvallisBus.Core/Models/ServiceAlert.cs
deleted file mode 100644
index 44b5e9e..0000000
--- a/CorvallisBus.Core/Models/ServiceAlert.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-
-namespace CorvallisBus.Core.Models
-{
- ///
- /// The publish date of the service alert.
- /// Matches the format "yyyy-MM-dd'T'HH:mm:ssZ".
- ///
- public record ServiceAlert(
- string Title,
- string PublishDate,
- string Link);
-}
diff --git a/CorvallisBus.Core/WebClients/ITransitClient.cs b/CorvallisBus.Core/WebClients/ITransitClient.cs
index 8d945cf..ca54243 100644
--- a/CorvallisBus.Core/WebClients/ITransitClient.cs
+++ b/CorvallisBus.Core/WebClients/ITransitClient.cs
@@ -12,6 +12,5 @@ public interface ITransitClient
{
(BusSystemData data, List errors) LoadTransitData();
Task GetEta(int platformTag);
- Task> GetServiceAlerts();
}
}
diff --git a/CorvallisBus.Core/WebClients/ServiceAlertsClient.cs b/CorvallisBus.Core/WebClients/ServiceAlertsClient.cs
deleted file mode 100644
index e00cbe1..0000000
--- a/CorvallisBus.Core/WebClients/ServiceAlertsClient.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-using System;
-using System.Linq;
-using System.Collections.Generic;
-using System.Net.Http;
-using System.Threading.Tasks;
-using CorvallisBus.Core.Models;
-using HtmlAgilityPack;
-
-namespace CorvallisBus.Core.WebClients
-{
- public static class ServiceAlertsClient
- {
- static readonly Uri FEED_URL = new Uri("https://www.corvallisoregon.gov/news?field_microsite_tid=581");
- static readonly HttpClient httpClient = new HttpClient();
-
- public static Task> GetServiceAlerts()
- {
- return Task.FromResult(new List()
- {
- new ServiceAlert(
- "View Service Alerts website",
- "2023-01-01T08:00:00Z",
- "https://www.corvallisoregon.gov/news?field_microsite_tid=581")
- });
- }
-
- public static async Task> GetServiceAlerts_Original()
- {
- var responseStream = await httpClient.GetStreamAsync(FEED_URL);
- var htmlDocument = new HtmlDocument();
- htmlDocument.Load(responseStream);
-
- var alerts = htmlDocument.DocumentNode
- .SelectNodes("//tbody/tr")
- ?.Select(ParseRow)
- .ToList() ?? new List();
-
- return alerts;
- }
-
- private static ServiceAlert ParseRow(HtmlNode row)
- {
- var anchor = row.Descendants("a").First();
- var relativeLink = anchor.Attributes["href"].Value;
- var link = new Uri(FEED_URL, relativeLink).ToString();
- var title = HtmlEntity.DeEntitize(anchor.InnerText);
-
- var publishDate = row.Descendants("span")
- .First(node => node.HasClass("date-display-single"))
- .Attributes["content"]
- .Value;
-
- return new ServiceAlert(title, publishDate, link);
- }
- }
-}
diff --git a/CorvallisBus.Core/WebClients/TransitClient.cs b/CorvallisBus.Core/WebClients/TransitClient.cs
index 7de5f6d..c5837dc 100644
--- a/CorvallisBus.Core/WebClients/TransitClient.cs
+++ b/CorvallisBus.Core/WebClients/TransitClient.cs
@@ -221,7 +221,5 @@ public ServerBusSchedule CreateSchedule(
return result;
}
-
- public Task> GetServiceAlerts() => ServiceAlertsClient.GetServiceAlerts();
}
}
\ No newline at end of file
diff --git a/CorvallisBus.Web/Controllers/TransitApiController.cs b/CorvallisBus.Web/Controllers/TransitApiController.cs
index b46461d..96b04cf 100644
--- a/CorvallisBus.Web/Controllers/TransitApiController.cs
+++ b/CorvallisBus.Web/Controllers/TransitApiController.cs
@@ -190,12 +190,6 @@ public async Task GetArrivalsSummary(string stopIds)
}
[HttpGet("service-alerts")]
- public Task> GetServiceAlerts()
- {
- return _client.GetServiceAlerts();
- }
-
- [HttpGet("service-alerts/html")]
public ActionResult GetServiceAlertsWebsite()
{
return Redirect("https://www.corvallisoregon.gov/news?field_microsite_tid=581");
diff --git a/CorvallisBus.Web/wwwroot/swagger.yaml b/CorvallisBus.Web/wwwroot/swagger.yaml
index c4fb62d..4fe61a0 100644
--- a/CorvallisBus.Web/wwwroot/swagger.yaml
+++ b/CorvallisBus.Web/wwwroot/swagger.yaml
@@ -213,32 +213,6 @@ paths:
items:
$ref: "#/definitions/RouteArrivalsSummary"
/service-alerts:
- get:
- operationId: getServiceAlerts
- description: |
- Gets service alerts from CTS which inform the user of holidays with no bus service, temporary route changes due to construction, etc.
-
- Sample URL: https://corvallisb.us/api/service-alerts
- responses:
- 200:
- examples:
- application/json:
- - title: Holiday Service
- publishDate: '2017-12-18T00:00:00-08:00'
- link: 'https://www.corvallisoregon.gov/cts/page/holiday-service'
- - title: Philomath Connection Offers Saturday Service
- publishDate: '2017-12-12T00:00:00-08:00'
- link: 'https://www.corvallisoregon.gov/cts/page/philomath-connection-offers-saturday-service'
- - title: Upcoming Schedule for CTS and Night Owl
- publishDate: '2017-11-29T00:00:00-08:00'
- link: 'https://www.corvallisoregon.gov/cts/page/upcoming-schedule-cts-and-night-owl'
-
- description: The service alerts.
- schema:
- type: array
- items:
- $ref: "#/definitions/ServiceAlert"
- /service-alerts/html:
get:
operationId: getServiceAlertsWebsite
description: |
@@ -371,22 +345,4 @@ definitions:
type: string
scheduleSummary:
description: A summary of the rest of the day's arrivals.
- type: string
- ServiceAlert:
- type: object
- description: A posting in the service alerts feed which may indicate interruptions or changes in service.
- required:
- - title
- - publishDate
- - link
- properties:
- title:
- description: The title of the posting.
- type: string
- publishDate:
- description: The date of publication.
- type: string
- format: date
- link:
- type: string
- format: url
\ No newline at end of file
+ type: string
\ No newline at end of file