Skip to content

Commit

Permalink
Merge pull request #137 from plivo/list_all_rented_numbers_api_fix
Browse files Browse the repository at this point in the history
updated tostring method
  • Loading branch information
nixonsam authored May 25, 2020
2 parents 9cdd5f9 + 8f88f54 commit b10b425
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 38 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@ Thumbs.db
*.dotCover
/.vs
/TestProject

# rider
.idea
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

# Change Log

## [v4.8.2](https://github.com/plivo/plivo-dotnet/tree/v4.8.1) (2020-05-19)
- Fix List All Rented Numbers API response.

## [v4.8.1](https://github.com/plivo/plivo-dotnet/tree/v4.8.1) (2020-05-19)
- Add Send MMS using Media_ID support.

Expand Down
2 changes: 1 addition & 1 deletion src/Plivo/Plivo.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard1.3</TargetFrameworks>
<ReleaseVersion>4.8.1</ReleaseVersion>
<ReleaseVersion>4.8.2</ReleaseVersion>
<Version />
<Authors>Plivo SDKs Team</Authors>
<Owners>Plivo Inc.</Owners>
Expand Down
1 change: 1 addition & 0 deletions src/Plivo/Plivo.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<projectUrl>http://github.com/plivo/plivo-dotnet</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<releaseNotes>
* 4.8.2 Fix List All Rented Numbers API response.
* 4.8.1 Add Send MMS using Media_ID support.
* 4.8.0 Add V3 signature helper functions.
* 4.7.1 Fix Bulk call API response.
Expand Down
120 changes: 84 additions & 36 deletions src/Plivo/Resource/RentedNumber/RentedNumber.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Plivo.Resource.RentedNumber {
public class RentedNumber : Resource {

namespace Plivo.Resource.RentedNumber
{
public class RentedNumber : Resource
{
public new string Id => Number;
public bool Active { get; set; }
public string AddedOn { get; set; }
public object Alias { get; set; }
public string Application { get; set; }
public string Carrier { get; set; }
public string City { get; set; }
public string Country { get; set; }
public bool MmsEnabled { get; set; }
public string MmsRate { get; set; }
public string MonthlyRentalRate { get; set; }
public string Number { get; set; }
public string NumberType { get; set; }
Expand All @@ -17,97 +24,138 @@ public class RentedNumber : Resource {
public bool SmsEnabled { get; set; }
public string SmsRate { get; set; }
public object SubAccount { get; set; }
public string Type { get; set; }
public List<VerificationInfo> VerificationInfo { get; set; }
public bool VoiceEnabled { get; set; }
public string VoiceRate { get; set; }
public List<Prerequisite> Prerequisites { get; set; }
public List<VerificationInfo> VerificationInfo { get; set; }
public string City { get; set; }
public string Country { get; set; }

public override string ToString () {

public override string ToString()
{
if (string.Compare(Carrier, "Plivo", StringComparison.Ordinal) == 0)
{
return
"Active: " + Active + "\n" +
"AddedOn: " + AddedOn + "\n" +
"Alias: " + Alias + "\n" +
"Application: " + Application + "\n" +
"Carrier: " + Carrier + "\n" +
"City: " + City + "\n" +
"Country: " + Country + "\n" +
"MmsEnabled: " + MmsEnabled + "\n" +
"MmsRate: " + MmsRate + "\n" +
"MonthlyRentalRate: " + MonthlyRentalRate + "\n" +
"Number: " + Number + "\n" +
"NumberType: " + NumberType + "\n" +
"Region: " + Region + "\n" +
"ResourceUri: " + ResourceUri + "\n" +
"SmsEnabled: " + SmsEnabled + "\n" +
"SmsRate: " + SmsRate + "\n" +
"SubAccount: " + SubAccount + "\n" +
"Type: " + Type + "\n" +
"VerificationInfo: " + VerificationInfo.ToString() + "\n" +
"VoiceEnabled: " + VoiceEnabled + "\n" +
"VoiceRate: " + VoiceRate + "\n";
}
return
"Addedon: " + AddedOn + "\n" +
"Alias " + Alias + "\n" +
"Active: " + Active + "\n" +
"AddedOn: " + AddedOn + "\n" +
"Alias: " + Alias + "\n" +
"Application: " + Application + "\n" +
"SMSEnabled: " + SmsEnabled + "\n" +
"SMSrate " + SmsRate + "\n" +
"VoiceEnabled: " + VoiceEnabled + "\n" +
"VoiceRate: " + VoiceRate + "\n" +
"Carrier: " + Carrier + "\n" +
"MonthlyRentalRate: " + MonthlyRentalRate + "\n" +
"Number: " + Number + "\n" +
"NumberType: " + NumberType + "\n" +
"Region: " + Region + "\n" +
"MonthlyRentalRate " + MonthlyRentalRate + "\n";
"ResourceUri: " + ResourceUri + "\n" +
"SmsEnabled: " + SmsEnabled + "\n" +
"SmsRate: " + SmsRate + "\n" +
"SubAccount: " + SubAccount + "\n" +
"Type: " + Type + "\n" +
"VoiceEnabled: " + VoiceEnabled + "\n" +
"VoiceRate: " + VoiceRate + "\n";
}

#region Update

/// <summary>
/// Update RentedNumber with the specified appId, subAccount and alias.
/// </summary>
/// <returns>The update.</returns>
/// <param name="appId">App identifier.</param>
/// <param name="subAccount">SubAccount.</param>
/// <param name="alias">Alias.</param>
public UpdateResponse<RentedNumber> Update (
string appId = null, string subAccount = null, string alias = null) {
public UpdateResponse<RentedNumber> Update(
string appId = null, string subAccount = null, string alias = null)
{
var updateResponse =
((RentedNumberInterface) Interface)
.Update (Id, appId, subAccount, alias);
.Update(Id, appId, subAccount, alias);

if (appId != null)
Application =
"/v1/Account/" +
((RentedNumberInterface) Interface).Client.GetAuthId () +
"/Application/" +
appId +
"/";
"/v1/Account/" +
((RentedNumberInterface) Interface).Client.GetAuthId() +
"/Application/" +
appId +
"/";
if (appId == "null") Application = null;
if (subAccount != null) SubAccount = subAccount;
if (alias != null) Alias = alias;

return updateResponse;
}

/// <summary>
/// Update RentedNumber with the specified appId, subAccount and alias.
/// </summary>
/// <returns>The update.</returns>
/// <param name="appId">App identifier.</param>
/// <param name="subAccount">SubAccount.</param>
/// <param name="alias">Alias.</param>
public async Task<UpdateResponse<RentedNumber>> UpdateAsync (
string appId = null, string subAccount = null, string alias = null) {
public async Task<UpdateResponse<RentedNumber>> UpdateAsync(
string appId = null, string subAccount = null, string alias = null)
{
var updateResponse = await ((RentedNumberInterface) Interface)
.UpdateAsync (Id, appId, subAccount, alias);
.UpdateAsync(Id, appId, subAccount, alias);

if (appId != null)
Application =
"/v1/Account/" +
((RentedNumberInterface) Interface).Client.GetAuthId () +
"/Application/" +
appId +
"/";
"/v1/Account/" +
((RentedNumberInterface) Interface).Client.GetAuthId() +
"/Application/" +
appId +
"/";
if (appId == "null") Application = null;
if (subAccount != null) SubAccount = subAccount;
if (alias != null) Alias = alias;

return updateResponse;
}

#endregion

#region Delete

/// <summary>
/// Unrent RentedNumber.
/// </summary>
/// <returns>The delete.</returns>
public void Delete () {
public void Delete()
{
((RentedNumberInterface) Interface)
.Delete (Id);
.Delete(Id);
}

/// <summary>
/// Asynchronously unrent RentedNumber.
/// </summary>
/// <returns>The delete.</returns>
public async void DeleteAsync () {
public async void DeleteAsync()
{
await ((RentedNumberInterface) Interface)
.DeleteAsync (Id);
.DeleteAsync(Id);
}

#endregion
}
}
2 changes: 1 addition & 1 deletion src/Plivo/Version.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class Version
/// <summary>
/// DotNet SDK version
/// </summary>
public const string SdkVersion = "4.8.1";
public const string SdkVersion = "4.8.2";
/// <summary>
/// Plivo API version
/// </summary>
Expand Down

0 comments on commit b10b425

Please sign in to comment.