/Ring

An unofficial Ring library for .NET. This library is in no way endorsed by Ring.

Primary LanguageC#MIT LicenseMIT

Ring

NOTE: This library is no longer maintained.

An unofficial Ring library for .NET. This library is in no way endorsed by Ring nor do I represent Ring.

Uses .NET Standard and Newtonsoft.Json.

This library should work on all .NET platforms that support .NET Standard 1.4 including:

Example Implementation

An example implementation can be found in the RingExample directory.

Example Usage

try
{
  // Connect to the Ring API using a Ring account username and password.
  var ring = await RingClient.CreateAsync("username@example.com", "password");
  
  // Save the AuthToken for future connections instead of the Ring account username and password.
  // You can create a new connection using an auth token by calling: RingClient.CreateAsync(authToken)
  // The auth token may expire, but you can ask the user for their username and password at that point.
  var authToken = ring.AuthToken;
  
  // Get the list of the user's devices.
  var devices = await ring.GetDevicesAsync();
  
  // Check if any devices were returned.
  if (devices.Count > 0)
  {
    // Get the battery life of the first device.
    var batteryLife = devices[0].BatteryLife;
  }
  
  // Get the list of the user's active dings.
  var activeDings = await ring.GetActiveDingsAsync();
  
  // Check if there are any active dings.
  if (activeDings.Count > 0)
  {
    // Get the type of the first active ding.
    var activeDingType = activeDings[0].Type;
  }
  
  // Get the list of the user's last 15 dings.
  var dings = await ring.GetDingsAsync(15);
  
  // Check if any dings were returned.
  if (dings.Count > 0)
  {
    // Get the URI of the recording of the most recent ding.
    var recordingUri = await ring.GetRecordingUriAsync(dings[0]);
    
    // Get the description of the Ring device that the most recent ding occurred from.
    var dingDeviceDescription = dings[0].Device.Description;
  }
}
catch (Exception ex)
{
  Console.WriteLine(ex.Message);
}

Credits

This library was based off of php-ring-api by Jeroen Moors.