Breaking Changes - AfterShip Tracking Ruby SDK New Version
1. Complete Response Structure Refactor
Old Version - Direct Property Access
# Old version - Direct property access
response = api.create_tracking(body: request)
id = response.id
tracking_number = response.tracking_number
slug = response.slugNew Version - Must Access Through data
# New version - Access through data
response = api.create_tracking(body: request)
data = response.data
id = data.id
tracking_number = data.tracking_number
slug = data.slug
# Can also access response headers
response_header = response.response_headerImpact: All API response handling code needs to be rewritten to access actual data through the data method
2. Model Name Changes - Prefix Naming Convention
Model classes changed from suffix naming to prefix naming
# Old version - Suffix naming
require 'aftership-tracking-sdk'
# Using old models
courier_edd = AftershipAPI::Model::CourierEstimatedDeliveryDateTracking
shipment_weight = AftershipAPI::Model::ShipmentWeightTracking
aftership_edd = AftershipAPI::Model::AftershipEstimatedDeliveryDateTracking
carbon_emissions = AftershipAPI::Model::CarbonEmissionsTracking
custom_edd = AftershipAPI::Model::CustomEstimatedDeliveryDateTracking
first_estimated = AftershipAPI::Model::FirstEstimatedDeliveryTracking
first_mile = AftershipAPI::Model::FirstMileTracking
last_mile = AftershipAPI::Model::LastMileTracking
customers = AftershipAPI::Model::CustomersTracking
# New version - Prefix naming
require 'aftership-tracking-sdk'
# Using new models
courier_edd = AftershipAPI::Model::TrackingCourierEstimatedDeliveryDate
shipment_weight = AftershipAPI::Model::TrackingShipmentWeight
aftership_edd = AftershipAPI::Model::TrackingAftershipEstimatedDeliveryDate
carbon_emissions = AftershipAPI::Model::TrackingCarbonEmissions
custom_edd = AftershipAPI::Model::TrackingCustomEstimatedDeliveryDate
first_estimated = AftershipAPI::Model::TrackingFirstEstimatedDelivery
first_mile = AftershipAPI::Model::TrackingFirstMile
last_mile = AftershipAPI::Model::TrackingLastMile
customers = AftershipAPI::Model::TrackingCustomersImpact: All nested Tracking model class names need to be updated from XxxTracking to TrackingXxx
3. Enum Member Name Changes
Tag enum member names changed to underscore-separated
| Old Version | New Version |
|---|---|
Tag::INFORECEIVED |
Tag::INFO_RECEIVED |
Tag::INTRANSIT |
Tag::IN_TRANSIT |
Tag::OUTFORDELIVERY |
Tag::OUT_FOR_DELIVERY |
Tag::ATTEMPTFAIL |
Tag::ATTEMPT_FAIL |
Tag::AVAILABLEFORPICKUP |
Tag::AVAILABLE_FOR_PICKUP |
Impact: Code using these enum members needs name updates
4. String to Enum Changes
Several string fields changed to enum types (following API documentation)
# 1. CreateTrackingRequest.delivery_type
# Old version
request = AftershipAPI::Model::CreateTrackingRequest.new
request.delivery_type = "pickup_at_store"
# New version
request = AftershipAPI::Model::CreateTrackingRequest.new
request.delivery_type = AftershipAPI::Model::CreateTrackingRequestDeliveryType::PICKUP_AT_STORE
# 2. UpdateTrackingByIdRequest.delivery_type
# Old version
update_request.delivery_type = "door_to_door"
# New version
update_request.delivery_type = AftershipAPI::Model::UpdateTrackingByIdRequestDeliveryType::DOOR_TO_DOOR
# 3. MarkTrackingCompletedByIdRequest.reason
# Old version
mark_request.reason = "DELIVERED"
# New version
mark_request.reason = AftershipAPI::Model::MarkTrackingCompletedByIdRequestReason::DELIVEREDImpact: Code using string values needs to be changed to use corresponding enum types