Skip to content

Commit

Permalink
Refactor after review
Browse files Browse the repository at this point in the history
Move new enums to same nesting level as classes
  • Loading branch information
mwwoda committed Nov 2, 2021
1 parent 508abca commit eb7231b
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 69 deletions.
2 changes: 1 addition & 1 deletion Box.V2.Test/BoxSignRequestsManagerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public async Task CancelSignRequest_Success()

// Response check
Assert.AreEqual("12345", response.Id);
Assert.AreEqual(BoxSignRequest.BoxSignRequestStatus.cancelled, response.Status);
Assert.AreEqual(BoxSignRequestStatus.cancelled, response.Status);
}

[TestMethod]
Expand Down
2 changes: 2 additions & 0 deletions Box.V2/Box.V2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
<Reference Include="System.IdentityModel.Tokens.Jwt, Version=6.12.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\System.IdentityModel.Tokens.Jwt.6.12.2\lib\net45\System.IdentityModel.Tokens.Jwt.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
Expand Down Expand Up @@ -162,6 +163,7 @@
<Compile Include="Models\BoxSignRequest.cs" />
<Compile Include="Models\BoxSignRequestPrefillTag.cs" />
<Compile Include="Models\BoxSignRequestSigner.cs" />
<Compile Include="Models\BoxSignRequestSignFiles.cs" />
<Compile Include="Models\BoxStoragePolicy.cs" />
<Compile Include="Models\BoxStoragePolicyAssignment.cs" />
<Compile Include="Models\BoxTask.cs" />
Expand Down
59 changes: 20 additions & 39 deletions Box.V2/Models/BoxSignRequest.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;

namespace Box.V2.Models
Expand Down Expand Up @@ -125,45 +126,25 @@ public class BoxSignRequest : BoxEntity
/// </summary>
[JsonProperty(PropertyName = FieldStatus)]
public virtual BoxSignRequestStatus Status { get; private set; }
}

/// <summary>
/// Files that will be signed, which are copies of the original source files.
/// A new version of these files are created as signers sign and can be downloaded at any point in the signing process.
/// </summary>
public class BoxSignRequestSignFiles
{
public const string FieldFiles = "files";
public const string FieldIsReadyForDownload = "is_ready_for_download";

/// <summary>
/// Files that will be signed, which are copies of the original source files.
/// </summary>
[JsonProperty(PropertyName = FieldFiles)]
public virtual List<BoxFile> Files { get; private set; }

/// <summary>
/// Indicates whether the sign_files documents are processing and the PDFs may be out of date. A change to any document requires processing on all sign_files.
/// We recommended waiting until processing is finished (and this value is true) before downloading the PDFs.
/// </summary>
[JsonProperty(PropertyName = FieldIsReadyForDownload)]
public virtual bool IsReadyForDownload { get; private set; }
}

/// <summary>
/// Describes the status of the sign request.
/// </summary>
public enum BoxSignRequestStatus
{
converting,
created,
sent,
viewed,
signed,
cancelled,
declined,
error_converting,
error_sending,
expired
}
/// <summary>
/// Describes the status of the sign request.
/// </summary>
public enum BoxSignRequestStatus
{
converting,
created,
sent,
viewed,
signed,
cancelled,
declined,
error_converting,
error_sending,
expired,
downloaded,
[EnumMember(Value = "signed and downloaded")]
signed_and_downloaded
}
}
28 changes: 28 additions & 0 deletions Box.V2/Models/BoxSignRequestSignFiles.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System.Collections.Generic;
using Newtonsoft.Json;

namespace Box.V2.Models
{
/// <summary>
/// Files that will be signed, which are copies of the original source files.
/// A new version of these files are created as signers sign and can be downloaded at any point in the signing process.
/// </summary>
public class BoxSignRequestSignFiles
{
public const string FieldFiles = "files";
public const string FieldIsReadyForDownload = "is_ready_for_download";

/// <summary>
/// Files that will be signed, which are copies of the original source files.
/// </summary>
[JsonProperty(PropertyName = FieldFiles)]
public virtual List<BoxFile> Files { get; private set; }

/// <summary>
/// Indicates whether the sign_files documents are processing and the PDFs may be out of date. A change to any document requires processing on all sign_files.
/// We recommended waiting until processing is finished (and this value is true) before downloading the PDFs.
/// </summary>
[JsonProperty(PropertyName = FieldIsReadyForDownload)]
public virtual bool IsReadyForDownload { get; private set; }
}
}
56 changes: 28 additions & 28 deletions Box.V2/Models/BoxSignRequestSigner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,17 @@ public class BoxSignRequestSigner
/// </summary>
[JsonProperty(PropertyName = FieldSignerDecision)]
public virtual BoxSignRequestSignerDecision SignerDecision { get; private set; }
}

/// <summary>
/// Defines the role of the signer in the sign request. A signer must sign the document and an approver must approve the document.
/// A final_copy_reader only receives the final signed document and signing log.
/// </summary>
public enum BoxSignRequestSignerRole
{
signer,
approver,
final_copy_reader
}
/// <summary>
/// Defines the role of the signer in the sign request. A signer must sign the document and an approver must approve the document.
/// A final_copy_reader only receives the final signed document and signing log.
/// </summary>
public enum BoxSignRequestSignerRole
{
signer,
approver,
final_copy_reader
}

/// <summary>
Expand Down Expand Up @@ -134,17 +134,17 @@ public class BoxSignRequestSignerInput
/// </summary>
[JsonProperty(PropertyName = FieldTextValue)]
public virtual string TextValue { get; private set; }
}

/// <summary>
/// Type of input.
/// </summary>
public enum BoxSignRequestSingerInputType
{
signature,
date,
text,
checkbox
}
/// <summary>
/// Type of input.
/// </summary>
public enum BoxSignRequestSingerInputType
{
signature,
date,
text,
checkbox
}

/// <summary>
Expand All @@ -166,14 +166,14 @@ public class BoxSignRequestSignerDecision
/// </summary>
[JsonProperty(PropertyName = FieldFinalizedAt)]
public virtual DateTimeOffset? FinalizedAt { get; private set; }
}

/// <summary>
/// Type of decision made by the signer.
/// </summary>
public enum BoxSignRequestSingerDecisionType
{
signed,
declined,
}
/// <summary>
/// Type of decision made by the signer.
/// </summary>
public enum BoxSignRequestSingerDecisionType
{
signed,
declined,
}
}
2 changes: 1 addition & 1 deletion Box.V2/Models/Request/BoxSignRequestCreateRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,6 @@ public class BoxSignRequestSignerCreate
/// Value is one of signer,approver,final_copy_reader
/// </summary>
[JsonProperty(PropertyName = "role")]
public BoxSignRequestSigner.BoxSignRequestSignerRole? Role { get; set; }
public BoxSignRequestSignerRole? Role { get; set; }
}
}

0 comments on commit eb7231b

Please sign in to comment.