Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Make Id property of all EasyPostObject publicly settable #502

Merged
merged 3 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions EasyPost.Integration/Basics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/// If this test can be compiled, then the response objects have public constructors.
/// </summary>
[Fact, Testing.Access, Testing.Compile]
public void TestUserCanLocallyConstructResponseObject()
public void UserCanLocallyConstructResponseObject()
nwithan8 marked this conversation as resolved.
Show resolved Hide resolved
{
var address = new Address();
var addressCollection = new AddressCollection();
Expand All @@ -23,13 +23,13 @@
var brand = new Brand();
var carbonOffset = new CarbonOffset();
var carrier = new EasyPost.Models.API.Carrier();
var carrierBeta = new EasyPost.Models.API.Beta.Carrier();

Check warning on line 26 in EasyPost.Integration/Basics.cs

View workflow job for this annotation

GitHub Actions / Integration_Tests

'Carrier' is obsolete: 'This class is deprecated. Please use EasyPost.Models.API.Carrier instead. This class will be removed in a future version.'
var carrierAccount = new CarrierAccount();
var carrierDetail = new CarrierDetail();
var carrierField = new CarrierField();
var carrierFields = new CarrierFields();
var carrierMetadata = new EasyPost.Models.API.CarrierMetadata();
var carrierMetadataBeta = new EasyPost.Models.API.Beta.CarrierMetadata();

Check warning on line 32 in EasyPost.Integration/Basics.cs

View workflow job for this annotation

GitHub Actions / Integration_Tests

'CarrierMetadata' is obsolete: 'This class is deprecated. Please use EasyPost.Models.API.CarrierMetadata instead. This class will be removed in a future version.'
var carrierType = new CarrierType();
var customsInfo = new CustomsInfo();
var customsItem = new CustomsItem();
Expand All @@ -55,7 +55,7 @@
var pickupRate = new PickupRate();
var postageLabel = new PostageLabel();
var predefinedPackage = new EasyPost.Models.API.PredefinedPackage();
var predefinedPackageBeta = new EasyPost.Models.API.Beta.PredefinedPackage();

Check warning on line 58 in EasyPost.Integration/Basics.cs

View workflow job for this annotation

GitHub Actions / Integration_Tests

'PredefinedPackage' is obsolete: 'This class is deprecated. Please use EasyPost.Models.API.PredefinedPackage instead. This class will be removed in a future version.'
var rate = new Rate();
var rateWithEstimatedDeliveryDate = new RateWithEstimatedDeliveryDate();
var referralCustomer = new ReferralCustomer();
Expand All @@ -65,15 +65,15 @@
var scanForm = new ScanForm();
var scanFormCollection = new ScanFormCollection();
var serviceLevel = new EasyPost.Models.API.ServiceLevel();
var serviceLevelBeta = new EasyPost.Models.API.Beta.ServiceLevel();

Check warning on line 68 in EasyPost.Integration/Basics.cs

View workflow job for this annotation

GitHub Actions / Integration_Tests

'ServiceLevel' is obsolete: 'This class is deprecated. Please use EasyPost.Models.API.ServiceLevel instead. This class will be removed in a future version.'
var shipment = new Shipment();
var shipmentCollection = new ShipmentCollection();
var shipmentOption = new EasyPost.Models.API.ShipmentOption();
var shipmentOptionBeta = new EasyPost.Models.API.Beta.ShipmentOption();

Check warning on line 72 in EasyPost.Integration/Basics.cs

View workflow job for this annotation

GitHub Actions / Integration_Tests

'ShipmentOption' is obsolete: 'This class is deprecated. Please use EasyPost.Models.API.ShipmentOption instead. This class will be removed in a future version.'
var smartRate = new SmartRate();
var statelessRateBeta = new EasyPost.Models.API.Beta.StatelessRate();
var supportedFeature = new EasyPost.Models.API.SupportedFeature();
var supportedFeatureBeta = new EasyPost.Models.API.Beta.SupportedFeature();

Check warning on line 76 in EasyPost.Integration/Basics.cs

View workflow job for this annotation

GitHub Actions / Integration_Tests

'SupportedFeature' is obsolete: 'This class is deprecated. Please use EasyPost.Models.API.SupportedFeature instead. This class will be removed in a future version.'
var taxIdentifier = new TaxIdentifier();
var timeInTransit = new TimeInTransit();
var tracker = new Tracker();
Expand All @@ -87,12 +87,25 @@
var webhook = new Webhook();
}

/// <summary>
/// Test that an end-user can locally construct an object and set its ID.
/// </summary>
[Fact, Testing.Access, Testing.Compile]
public void UserCanSetObjectId()
{
// Construct a local object, setting its ID
var address = new Address { Id = "some_id" };

// Assert that the ID was set
Assert.Equal("some_id", address.Id);
}

/// <summary>
/// Test that an end-user can locally construct all available hooks.
/// If this test can be compiled, then the hooks are publicly accessible.
/// </summary>
[Fact, Testing.Access, Testing.Compile]
public void TestUserCanCreateHooks()
public void UserCanCreateHooks()
{
// Can set up each hook event handler during construction
var hooks = new Hooks()
Expand Down
10 changes: 5 additions & 5 deletions EasyPost.Integration/Synchronous.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class Synchronous
/// Test that an end-user can run asynchronous code asynchronously
/// </summary>
[Fact, Testing.Run]
public async void TestUserCanRunAsyncCodeAsynchronously()
public async void UserCanRunAsyncCodeAsynchronously()
{
var client = Vcr.SetUpTest("async");

Expand All @@ -42,7 +42,7 @@ public async void TestUserCanRunAsyncCodeAsynchronously()
/// Test that an end-user can run asynchronous code synchronously via .Result
/// </summary>
[Fact, Testing.Run]
public void TestUserCanRunAsyncCodeSynchronouslyViaResult()
public void UserCanRunAsyncCodeSynchronouslyViaResult()
{
var client = Vcr.SetUpTest("via_result");

Expand All @@ -69,7 +69,7 @@ public void TestUserCanRunAsyncCodeSynchronouslyViaResult()
/// Test that an end-user can run asynchronous code synchronously via .GetAwaiter().GetResult()
/// </summary>
[Fact, Testing.Run]
public void TestUserCanRunAsyncCodeSynchronouslyViaGetAwaiter()
public void UserCanRunAsyncCodeSynchronouslyViaGetAwaiter()
{
var client = Vcr.SetUpTest("via_get_awaiter");

Expand Down Expand Up @@ -105,7 +105,7 @@ public class SynchronousMvcController : System.Web.Mvc.Controller
/// Test that an end-user can run asynchronous code asynchronously
/// </summary>
[Fact, Testing.Run]
public async Task<ActionResult> TestUserCanRunAsyncCodeAsynchronously()
public async Task<ActionResult> UserCanRunAsyncCodeAsynchronously()
{
var client = Vcr.SetUpTest("async");

Expand Down Expand Up @@ -135,7 +135,7 @@ public async Task<ActionResult> TestUserCanRunAsyncCodeAsynchronously()
/// Ref: https://gist.github.com/leonardochaia/98ce57bcee39c18d88682424a6ffe305
/// </summary>
[Fact, Testing.Run]
public ActionResult TestUserCanRunAsyncCodeSynchronouslyViaTaskFactory()
public ActionResult UserCanRunAsyncCodeSynchronouslyViaTaskFactory()
{
var client = Vcr.SetUpTest("via_task_factory");

Expand Down
2 changes: 1 addition & 1 deletion EasyPost/_base/EasyPostObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public abstract class EasyPostObject : EphemeralEasyPostObject
/// The EasyPost ID for this object.
/// </summary>
[JsonProperty("id")]
public string? Id { get; internal set; }
public string? Id { get; set; }

/// <summary>
/// The date and time this object was last updated.
Expand Down
Loading