update naming convention for public methods
This commit is contained in:
@@ -24,7 +24,7 @@ namespace UptimeSharp.Tests
|
||||
[TearDown]
|
||||
public void Teardown()
|
||||
{
|
||||
List<Alert> alerts = client.RetrieveAlerts();
|
||||
List<Alert> alerts = client.GetAlerts();
|
||||
alerts.ForEach(alert => client.DeleteAlert(alert));
|
||||
}
|
||||
|
||||
@@ -77,11 +77,11 @@ namespace UptimeSharp.Tests
|
||||
"Response should be true for adding a new alert (bocar 4)"
|
||||
);
|
||||
|
||||
List<Alert> alerts = client.RetrieveAlerts();
|
||||
List<Alert> alerts = client.GetAlerts();
|
||||
|
||||
Assert.GreaterOrEqual(alerts.ToArray().Length, 2, "Alerts length should be at least 2", alerts);
|
||||
|
||||
List<Alert> specificAlerts = client.RetrieveAlerts(new int[] { alerts[0].ID, alerts[1].ID });
|
||||
List<Alert> specificAlerts = client.GetAlerts(new int[] { alerts[0].ID, alerts[1].ID });
|
||||
|
||||
Assert.AreEqual(2, specificAlerts.ToArray().Length, "Specific alerts length should be 2", specificAlerts);
|
||||
}
|
||||
@@ -89,7 +89,7 @@ namespace UptimeSharp.Tests
|
||||
|
||||
private Alert GetOriginAlert(string value)
|
||||
{
|
||||
List<Alert> alerts = client.RetrieveAlerts();
|
||||
List<Alert> alerts = client.GetAlerts();
|
||||
Alert origin = null;
|
||||
|
||||
alerts.ForEach(alert =>
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace UptimeSharp
|
||||
/// </summary>
|
||||
/// <param name="alertIDs">Retrieve specified alert contacts by supplying IDs for them.</param>
|
||||
/// <returns></returns>
|
||||
public List<Alert> RetrieveAlerts(int[] alertIDs = null)
|
||||
public List<Alert> GetAlerts(int[] alertIDs = null)
|
||||
{
|
||||
Parameter alerts = Parameter("alertcontacts", alertIDs != null ? string.Join("-", alertIDs) : null);
|
||||
|
||||
@@ -23,6 +23,19 @@ namespace UptimeSharp
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves an alert from UptimeRobot
|
||||
/// </summary>
|
||||
/// <param name="alertID">The alertID.</param>
|
||||
/// <returns></returns>
|
||||
public Alert GetAlert(int alertID)
|
||||
{
|
||||
List<Alert> alerts = GetAlerts(new int[] { alertID });
|
||||
|
||||
return alerts.ToArray().Length > 0 ? alerts[0] : null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Adds an alert.
|
||||
/// mobile/SMS alert contacts are not supported yet, see: http://www.uptimerobot.com/api.asp#methods
|
||||
|
||||
@@ -17,8 +17,10 @@ namespace UptimeSharp
|
||||
/// <param name="customUptimeRatio">The custom uptime ratio.</param>
|
||||
/// <param name="showLog">if set to <c>true</c> [show log].</param>
|
||||
/// <param name="showAlerts">if set to <c>true</c> [show alerts].</param>
|
||||
/// <returns></returns>
|
||||
public List<Monitor> Retrieve(int[] monitors = null, float[] customUptimeRatio = null, bool showLog = false, bool showAlerts = true)
|
||||
/// <returns>
|
||||
/// Monitor List
|
||||
/// </returns>
|
||||
public List<Monitor> GetMonitors(int[] monitors = null, float[] customUptimeRatio = null, bool showLog = false, bool showAlerts = true)
|
||||
{
|
||||
RetrieveParameters parameters = new RetrieveParameters()
|
||||
{
|
||||
@@ -36,10 +38,17 @@ namespace UptimeSharp
|
||||
/// Retrieves a monitor from UptimeRobot
|
||||
/// </summary>
|
||||
/// <param name="monitorId">a specific monitor ID</param>
|
||||
/// <returns></returns>
|
||||
public Monitor Retrieve(int monitorId)
|
||||
/// <param name="customUptimeRatio">The custom uptime ratio.</param>
|
||||
/// <param name="showLog">if set to <c>true</c> [show log].</param>
|
||||
/// <param name="showAlerts">if set to <c>true</c> [show alerts].</param>
|
||||
/// <returns>
|
||||
/// The Monitor
|
||||
/// </returns>
|
||||
public Monitor GetMonitor(int monitorId, float[] customUptimeRatio = null, bool showLog = false, bool showAlerts = true)
|
||||
{
|
||||
return Retrieve(new int[] { monitorId })[0];
|
||||
List<Monitor> monitors = GetMonitors(new int[] { monitorId }, customUptimeRatio, showLog, showAlerts);
|
||||
|
||||
return monitors.ToArray().Length > 0 ? monitors[0] : null;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,8 +56,10 @@ namespace UptimeSharp
|
||||
/// Deletes a monitor
|
||||
/// </summary>
|
||||
/// <param name="monitorId">a specific monitor ID</param>
|
||||
/// <returns>success state</returns>
|
||||
public bool Delete(int monitorId)
|
||||
/// <returns>
|
||||
/// Success state
|
||||
/// </returns>
|
||||
public bool DeleteMonitor(int monitorId)
|
||||
{
|
||||
return Get<DefaultResponse>("deleteMonitor", Parameter("monitorID", monitorId)).Status;
|
||||
}
|
||||
@@ -58,10 +69,12 @@ namespace UptimeSharp
|
||||
/// Deletes a monitor
|
||||
/// </summary>
|
||||
/// <param name="monitor">The monitor.</param>
|
||||
/// <returns>success state</returns>
|
||||
public bool Delete(Monitor monitor)
|
||||
/// <returns>
|
||||
/// Success state
|
||||
/// </returns>
|
||||
public bool DeleteMonitor(Monitor monitor)
|
||||
{
|
||||
return Delete(monitor.ID);
|
||||
return DeleteMonitor(monitor.ID);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,11 +92,11 @@ namespace UptimeSharp
|
||||
/// <param name="HTTPPassword">The HTTP password.</param>
|
||||
/// <param name="HTTPUsername">The HTTP username.</param>
|
||||
/// <returns>
|
||||
/// success state
|
||||
/// Success state
|
||||
/// </returns>
|
||||
public bool Add(string name, string uri, Type type = Type.HTTP, Subtype subtype = Subtype.Unknown,
|
||||
int? port = null, string keywordValue = null, KeywordType keywordType = KeywordType.Unknown,
|
||||
int[] alerts = null, string HTTPPassword = null, string HTTPUsername = null)
|
||||
public bool AddMonitor(string name, string uri, Type type = Type.HTTP, Subtype subtype = Subtype.Unknown,
|
||||
int? port = null, string keywordValue = null, KeywordType keywordType = KeywordType.Unknown,
|
||||
int[] alerts = null, string HTTPPassword = null, string HTTPUsername = null)
|
||||
{
|
||||
|
||||
MonitorParameters parameters = new MonitorParameters()
|
||||
@@ -109,9 +122,9 @@ namespace UptimeSharp
|
||||
/// </summary>
|
||||
/// <param name="monitor">The monitor.</param>
|
||||
/// <returns>
|
||||
/// success state
|
||||
/// Success state
|
||||
/// </returns>
|
||||
public bool Modify(Monitor monitor)
|
||||
public bool ModifyMonitor(Monitor monitor)
|
||||
{
|
||||
List<int> alerts = null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user