aftership-tracking-sdk 7.0.0 → 9.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/README.md +68 -83
- data/lib/aftership-tracking-sdk/api/courier.rb +8 -8
- data/lib/aftership-tracking-sdk/api/estimated_delivery_date.rb +4 -4
- data/lib/aftership-tracking-sdk/api/tracking.rb +50 -416
- data/lib/aftership-tracking-sdk/api_client.rb +2 -2
- data/lib/aftership-tracking-sdk/configuration.rb +108 -108
- data/lib/aftership-tracking-sdk/models/additional_fields_v1.rb +1 -1
- data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_create_tracking_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_delete_tracking_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_get_tracking_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_mark_tracking_completed_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_retrack_tracking_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_tracking.rb +2 -0
- data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_update_tracking_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/carbon_emissions_create_tracking_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/carbon_emissions_delete_tracking_by_id_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/carbon_emissions_get_tracking_by_id_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/carbon_emissions_mark_tracking_completed_by_id_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/carbon_emissions_retrack_tracking_by_id_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/carbon_emissions_tracking.rb +2 -0
- data/lib/aftership-tracking-sdk/models/carbon_emissions_update_tracking_by_id_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/checkpoint.rb +2 -0
- data/lib/aftership-tracking-sdk/models/coordinate_checkpoint.rb +2 -0
- data/lib/aftership-tracking-sdk/models/courier.rb +2 -0
- data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_create_tracking_response.rb +173 -0
- data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_delete_tracking_by_id_response.rb +173 -0
- data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_get_tracking_by_id_response.rb +173 -0
- data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_mark_tracking_completed_by_id_response.rb +173 -0
- data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_retrack_tracking_by_id_response.rb +173 -0
- data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_tracking.rb +173 -0
- data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_update_tracking_by_id_response.rb +173 -0
- data/lib/aftership-tracking-sdk/models/courier_response_v1.rb +2 -0
- data/lib/aftership-tracking-sdk/models/{tracking_create_tracking_request.rb → create_tracking_request.rb} +9 -7
- data/lib/aftership-tracking-sdk/models/create_tracking_response.rb +953 -0
- data/lib/aftership-tracking-sdk/models/{mark_tracking_completed_by_slug_tracking_number_request.rb → custom_estimated_delivery_date_create_tracking_response.rb} +41 -9
- data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_delete_tracking_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_get_tracking_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_mark_tracking_completed_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_retrack_tracking_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_tracking.rb +2 -0
- data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_update_tracking_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/data_courier_response_v1.rb +2 -0
- data/lib/aftership-tracking-sdk/models/data_tracking_response_get_multiple_v1.rb +8 -126
- data/lib/aftership-tracking-sdk/models/delete_tracking_by_id_response.rb +953 -0
- data/lib/aftership-tracking-sdk/models/destination_address_estimated_delivery_date_request.rb +2 -0
- data/lib/aftership-tracking-sdk/models/destination_address_estimated_delivery_date_response.rb +2 -0
- data/lib/aftership-tracking-sdk/models/{tracking_detect_courier_request.rb → detect_courier_request.rb} +5 -3
- data/lib/aftership-tracking-sdk/models/detect_courier_response.rb +2 -0
- data/lib/aftership-tracking-sdk/models/estimated_delivery_date_request.rb +2 -0
- data/lib/aftership-tracking-sdk/models/estimated_delivery_date_response.rb +12 -0
- data/lib/aftership-tracking-sdk/models/estimated_pickup_estimated_delivery_date_request.rb +2 -0
- data/lib/aftership-tracking-sdk/models/estimated_pickup_estimated_delivery_date_response.rb +2 -0
- data/lib/aftership-tracking-sdk/models/events_checkpoint.rb +2 -0
- data/lib/aftership-tracking-sdk/models/first_estimated_delivery_create_tracking_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/first_estimated_delivery_delete_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/first_estimated_delivery_get_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/first_estimated_delivery_mark_tracking_completed_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/first_estimated_delivery_retrack_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/first_estimated_delivery_tracking.rb +2 -0
- data/lib/aftership-tracking-sdk/models/first_estimated_delivery_update_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/get_all_couriers_response.rb +2 -0
- data/lib/aftership-tracking-sdk/models/get_tracking_by_id_response.rb +953 -0
- data/lib/aftership-tracking-sdk/models/get_trackings_response.rb +5 -3
- data/lib/aftership-tracking-sdk/models/get_user_couriers_response.rb +2 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_create_tracking_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_delete_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_get_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_mark_tracking_completed_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_retrack_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_tracking.rb +2 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_update_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/mark_tracking_completed_by_id_request.rb +2 -0
- data/lib/aftership-tracking-sdk/models/mark_tracking_completed_by_id_response.rb +953 -0
- data/lib/aftership-tracking-sdk/models/meta_v1.rb +2 -0
- data/lib/aftership-tracking-sdk/models/{next_couriers_tracking_create_tracking_request.rb → next_couriers_create_tracking_request.rb} +4 -2
- data/lib/aftership-tracking-sdk/models/{get_checkpoint_by_tracking_id_response.rb → next_couriers_create_tracking_response.rb} +33 -51
- data/lib/aftership-tracking-sdk/models/next_couriers_delete_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/{get_checkpoint_by_slug_tracking_number_response.rb → next_couriers_get_tracking_by_id_response.rb} +33 -51
- data/lib/aftership-tracking-sdk/models/next_couriers_mark_tracking_completed_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/next_couriers_retrack_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/next_couriers_tracking.rb +22 -0
- data/lib/aftership-tracking-sdk/models/next_couriers_update_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/order_processing_time_estimated_pickup_estimated_delivery_date_request.rb +2 -0
- data/lib/aftership-tracking-sdk/models/order_processing_time_estimated_pickup_estimated_delivery_date_response.rb +2 -0
- data/lib/aftership-tracking-sdk/models/origin_address_estimated_delivery_date_request.rb +2 -0
- data/lib/aftership-tracking-sdk/models/origin_address_estimated_delivery_date_response.rb +2 -0
- data/lib/aftership-tracking-sdk/models/pagination.rb +14 -6
- data/lib/aftership-tracking-sdk/models/pagination_data_tracking_response_get_multiple_v1.rb +173 -0
- data/lib/aftership-tracking-sdk/models/{notification_request_v1.rb → pagination_get_trackings_response.rb} +28 -16
- data/lib/aftership-tracking-sdk/models/predict_batch_request.rb +2 -0
- data/lib/aftership-tracking-sdk/models/predict_batch_response.rb +2 -0
- data/lib/aftership-tracking-sdk/models/reason_events_checkpoint.rb +2 -0
- data/lib/aftership-tracking-sdk/models/retrack_tracking_by_id_response.rb +953 -0
- data/lib/aftership-tracking-sdk/models/{tracking_delete_response_v1.rb → shipment_weight_create_tracking_response.rb} +18 -16
- data/lib/aftership-tracking-sdk/models/{data_notification_response_v1.rb → shipment_weight_delete_tracking_by_id_response.rb} +21 -9
- data/lib/aftership-tracking-sdk/models/{notification.rb → shipment_weight_get_tracking_by_id_response.rb} +18 -16
- data/lib/aftership-tracking-sdk/models/shipment_weight_mark_tracking_completed_by_id_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/shipment_weight_retrack_tracking_by_id_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/{notification_response_v1.rb → shipment_weight_tracking.rb} +18 -16
- data/lib/aftership-tracking-sdk/models/shipment_weight_update_tracking_by_id_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/slug_group_v1.rb +1 -1
- data/lib/aftership-tracking-sdk/models/tag_v1.rb +1 -1
- data/lib/aftership-tracking-sdk/models/tracking.rb +56 -24
- data/lib/aftership-tracking-sdk/models/tracking_response_get_multiple_v1.rb +2 -0
- data/lib/aftership-tracking-sdk/models/tracking_response_v1.rb +5 -3
- data/lib/aftership-tracking-sdk/models/{tracking_update_tracking_by_id_request.rb → update_tracking_by_id_request.rb} +5 -3
- data/lib/aftership-tracking-sdk/models/update_tracking_by_id_response.rb +953 -0
- data/lib/aftership-tracking-sdk/models/weight_estimated_delivery_date_request.rb +2 -0
- data/lib/aftership-tracking-sdk/models/weight_estimated_delivery_date_response.rb +2 -0
- data/lib/aftership-tracking-sdk/version.rb +1 -1
- metadata +64 -22
- data/lib/aftership-tracking-sdk/api/last_checkpoint.rb +0 -143
- data/lib/aftership-tracking-sdk/api/notification.rb +0 -403
- data/lib/aftership-tracking-sdk/models/custom_fields_tracking_update_tracking_by_slug_tracking_number_request.rb +0 -139
- data/lib/aftership-tracking-sdk/models/data_tracking_delete_response_v1.rb +0 -151
- data/lib/aftership-tracking-sdk/models/data_tracking_response_v1.rb +0 -151
- data/lib/aftership-tracking-sdk/models/partial_delete_tracking.rb +0 -241
- data/lib/aftership-tracking-sdk/models/partial_update_tracking.rb +0 -251
- data/lib/aftership-tracking-sdk/models/tracking_update_tracking_by_slug_tracking_number_request.rb +0 -391
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d9d12ffc6b5d7c5d11af738b1f88ebd102376ebe94f368eb517f8cee2fe7a9a
|
4
|
+
data.tar.gz: 530e87b908b936d8f9279cdf39e4c56583b651afe0a05121297ed05a10d785e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d0feb6a923e8ce8a90c8f45e1ed8fb4b24fa36986f5cbebfb43b4dff2e0cb3c0f24ebde2503b31824ac1b0986f1d86b407c672eb2f8efbf1c2a9466d61256cc
|
7
|
+
data.tar.gz: 716dab6a4e838afc02c865b53c6bcc7d6306633166abf6788c5edaf21cb90ec38835e0ae67632bc193140b7d97c69d8769501757afb8f691c92bd36d82edfc90
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# AfterShip Tracking API library for Ruby
|
2
2
|
|
3
|
-
This library allows you to quickly and easily use the AfterShip Tracking API via
|
3
|
+
This library allows you to quickly and easily use the AfterShip Tracking API via Ruby.
|
4
4
|
|
5
5
|
For updates to this library, see our [GitHub release page](https://github.com/AfterShip/tracking-sdk-ruby/releases).
|
6
6
|
|
@@ -11,6 +11,7 @@ If you need support using AfterShip products, please contact support@aftership.c
|
|
11
11
|
- [AfterShip Tracking API library for Ruby](#aftership-tracking-api-library-for-ruby)
|
12
12
|
- [Table of Contents](#table-of-contents)
|
13
13
|
- [Before you begin](#before-you-begin)
|
14
|
+
- [API and SDK Version](#api-and-sdk-version)
|
14
15
|
- [Quick Start](#quick-start)
|
15
16
|
- [Installation](#installation)
|
16
17
|
- [Constructor](#constructor)
|
@@ -21,8 +22,6 @@ If you need support using AfterShip products, please contact support@aftership.c
|
|
21
22
|
- [Endpoints](#endpoints)
|
22
23
|
- [/trackings](#trackings)
|
23
24
|
- [/couriers](#couriers)
|
24
|
-
- [/last\_checkpoint](#last_checkpoint)
|
25
|
-
- [/notifications](#notifications)
|
26
25
|
- [/estimated-delivery-date](#estimated-delivery-date)
|
27
26
|
- [Help](#help)
|
28
27
|
- [License](#license)
|
@@ -36,6 +35,18 @@ Before you begin to integrate:
|
|
36
35
|
- [Create an API key](https://organization.automizely.com/api-keys).
|
37
36
|
- [Install Ruby](https://www.ruby-lang.org/en/) version Ruby 2.7 or later.
|
38
37
|
|
38
|
+
|
39
|
+
### API and SDK Version
|
40
|
+
|
41
|
+
Each SDK version is designed to work with a specific API version. Please refer to the table below to identify the supported API versions for each SDK version, ensuring you select the appropriate SDK version for the API version you intend to use.
|
42
|
+
|
43
|
+
| SDK Version | Supported API Version | Branch |
|
44
|
+
| ----------- | --------------------- | ----------------------------------------------------------- |
|
45
|
+
| 9.x.x | 2024-10 | https://github.com/AfterShip/tracking-sdk-ruby/tree/2024-10 |
|
46
|
+
| 8.x.x | 2024-07 | https://github.com/AfterShip/tracking-sdk-ruby/tree/2024-07 |
|
47
|
+
| 7.x.x | 2024-04 | https://github.com/AfterShip/tracking-sdk-ruby/tree/2024-04 |
|
48
|
+
| <=6.x.x | Legacy API | https://github.com/AfterShip/aftership-sdk-ruby |
|
49
|
+
|
39
50
|
## Quick Start
|
40
51
|
|
41
52
|
### Installation
|
@@ -46,7 +57,7 @@ gem install aftership-tracking-sdk
|
|
46
57
|
Or add a line to your Gemfile
|
47
58
|
|
48
59
|
```bash
|
49
|
-
gem 'aftership-tracking-sdk', '~>
|
60
|
+
gem 'aftership-tracking-sdk', '~> 9.0.0'
|
50
61
|
```
|
51
62
|
|
52
63
|
## Constructor
|
@@ -54,7 +65,7 @@ gem 'aftership-tracking-sdk', '~> 7.0.0'
|
|
54
65
|
Create AfterShip instance with options
|
55
66
|
|
56
67
|
| Name | Type | Required | Description |
|
57
|
-
|
68
|
+
| ---------- | ------ | -------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
58
69
|
| api_key | string | ✔ | Your AfterShip API key |
|
59
70
|
| auth_type | enum | | Default value: `AuthType.API_KEY` <br > AES authentication: `AuthType.AES` <br > RSA authentication: `AuthType.RSA` |
|
60
71
|
| api_secret | string | | Required if the authentication type is `AuthType.AES` or `AuthType.RSA` |
|
@@ -76,21 +87,21 @@ end
|
|
76
87
|
begin
|
77
88
|
resp = AftershipAPI::Tracking.get_trackings
|
78
89
|
p resp
|
79
|
-
rescue AftershipAPI::
|
90
|
+
rescue AftershipAPI::ApiError => e
|
80
91
|
p e.message
|
81
92
|
end
|
82
93
|
```
|
83
94
|
|
84
95
|
## Rate Limiter
|
85
96
|
|
86
|
-
See the [Rate Limit](https://www.aftership.com/docs/
|
97
|
+
See the [Rate Limit](https://www.aftership.com/docs/tracking/2024-10/quickstart/rate-limit) to understand the AfterShip rate limit policy.
|
87
98
|
|
88
99
|
## Error Handling
|
89
100
|
|
90
101
|
The SDK will return an error object when there is any error during the request, with the following specification:
|
91
102
|
|
92
103
|
| Name | Type | Description |
|
93
|
-
|
104
|
+
| ------------- | ------ | ------------------------------ |
|
94
105
|
| message | string | Detail message of the error |
|
95
106
|
| code | enum | Error code enum for API Error. |
|
96
107
|
| meta_code | number | API response meta code. |
|
@@ -100,30 +111,30 @@ The SDK will return an error object when there is any error during the request,
|
|
100
111
|
|
101
112
|
### Error List
|
102
113
|
|
103
|
-
| code | meta_code
|
104
|
-
|
105
|
-
| INVALID_REQUEST |
|
106
|
-
| INVALID_JSON |
|
107
|
-
| TRACKING_ALREADY_EXIST |
|
108
|
-
| TRACKING_DOES_NOT_EXIST |
|
109
|
-
| TRACKING_NUMBER_INVALID |
|
110
|
-
| TRACKING_REQUIRED |
|
111
|
-
| TRACKING_NUMBER_REQUIRED |
|
112
|
-
| VALUE_INVALID |
|
113
|
-
| VALUE_REQUIRED |
|
114
|
-
| SLUG_INVALID |
|
115
|
-
| MISSING_OR_INVALID_REQUIRED_FIELD |
|
116
|
-
| BAD_COURIER |
|
117
|
-
| INACTIVE_RETRACK_NOT_ALLOWED |
|
118
|
-
| NOTIFICATION_REUQIRED |
|
119
|
-
| ID_INVALID |
|
120
|
-
| RETRACK_ONCE_ALLOWED |
|
121
|
-
| TRACKING_NUMBER_FORMAT_INVALID |
|
122
|
-
| API_KEY_INVALID |
|
123
|
-
| REQUEST_NOT_ALLOWED |
|
124
|
-
| NOT_FOUND |
|
125
|
-
| TOO_MANY_REQUEST |
|
126
|
-
| INTERNAL_ERROR
|
114
|
+
| code | meta_code | status_code | message |
|
115
|
+
| --------------------------------- | --------------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
116
|
+
| INVALID_REQUEST | 400 | 400 | The request was invalid or cannot be otherwise served. |
|
117
|
+
| INVALID_JSON | 4001 | 400 | Invalid JSON data. |
|
118
|
+
| TRACKING_ALREADY_EXIST | 4003 | 400 | Tracking already exists. |
|
119
|
+
| TRACKING_DOES_NOT_EXIST | 4004 | 404 | Tracking does not exist. |
|
120
|
+
| TRACKING_NUMBER_INVALID | 4005 | 400 | The value of tracking_number is invalid. |
|
121
|
+
| TRACKING_REQUIRED | 4006 | 400 | tracking object is required. |
|
122
|
+
| TRACKING_NUMBER_REQUIRED | 4007 | 400 | tracking_number is required. |
|
123
|
+
| VALUE_INVALID | 4008 | 400 | The value of [field_name] is invalid. |
|
124
|
+
| VALUE_REQUIRED | 4009 | 400 | [field_name] is required. |
|
125
|
+
| SLUG_INVALID | 4010 | 400 | The value of slug is invalid. |
|
126
|
+
| MISSING_OR_INVALID_REQUIRED_FIELD | 4011 | 400 | Missing or invalid value of the required fields for this courier. Besides tracking_number, also required: [field_name] |
|
127
|
+
| BAD_COURIER | 4012 | 400 | The error message will be one of the following:<br/>1. Unable to import shipment as the carrier is not on your approved list for carrier auto-detection. Add the carrier here: https://admin.aftership.com/settings/couriers<br/>2. Unable to import shipment as we don’t recognize the carrier from this tracking number.<br/>3. Unable to import shipment as the tracking number has an invalid format.<br/>4. Unable to import shipment as this carrier is no longer supported.<br/>5. Unable to import shipment as the tracking number does not belong to a carrier in that group. |
|
128
|
+
| INACTIVE_RETRACK_NOT_ALLOWED | 4013 | 400 | Retrack is not allowed. You can only retrack an inactive tracking. |
|
129
|
+
| NOTIFICATION_REUQIRED | 4014 | 400 | notification object is required. |
|
130
|
+
| ID_INVALID | 4015 | 400 | The value of id is invalid. |
|
131
|
+
| RETRACK_ONCE_ALLOWED | 4016 | 400 | Retrack is not allowed. You can only retrack each shipment once. |
|
132
|
+
| TRACKING_NUMBER_FORMAT_INVALID | 4017 | 400 | The format of tracking_number is invalid. |
|
133
|
+
| API_KEY_INVALID | 401 | 401 | The API key is invalid. |
|
134
|
+
| REQUEST_NOT_ALLOWED | 403 | 403 | The request is understood, but it has been refused or access is not allowed. |
|
135
|
+
| NOT_FOUND | 404 | 404 | The URI requested is invalid or the resource requested does not exist. |
|
136
|
+
| TOO_MANY_REQUEST | 429 | 429 | You have exceeded the API call rate limit. The default limit is 10 requests per second. |
|
137
|
+
| INTERNAL_ERROR | 500 502 503 504 | 500 502 503 504 | Something went wrong on AfterShip's end. |
|
127
138
|
|
128
139
|
## Endpoints
|
129
140
|
|
@@ -131,8 +142,6 @@ The AfterShip instance has the following properties which are exactly the same a
|
|
131
142
|
|
132
143
|
- courier - Get a list of our supported couriers.
|
133
144
|
- tracking - Create trackings, update trackings, and get tracking results.
|
134
|
-
- last_checkpoint - Get tracking information of the last checkpoint of a tracking.
|
135
|
-
- notification - Get, add or remove contacts (sms or email) to be notified when the status of a tracking has changed.
|
136
145
|
- estimated-delivery-date - Get estimated delivery date for your order.
|
137
146
|
|
138
147
|
|
@@ -142,13 +151,13 @@ The AfterShip instance has the following properties which are exactly the same a
|
|
142
151
|
|
143
152
|
```ruby
|
144
153
|
begin
|
145
|
-
req = AftershipAPI::Model::
|
146
|
-
req.tracking_number = "
|
147
|
-
req.slug = "
|
154
|
+
req = AftershipAPI::Model::CreateTrackingRequest. new
|
155
|
+
req.tracking_number = "<tracking_number>"
|
156
|
+
req.slug = "<slug>"
|
148
157
|
|
149
158
|
resp = AftershipAPI::Tracking.create_tracking(body: req)
|
150
159
|
p resp
|
151
|
-
rescue AftershipAPI::
|
160
|
+
rescue AftershipAPI::ApiError => e
|
152
161
|
p e.message
|
153
162
|
end
|
154
163
|
```
|
@@ -156,7 +165,7 @@ end
|
|
156
165
|
**DELETE** /trackings/:id
|
157
166
|
|
158
167
|
```ruby
|
159
|
-
resp = AftershipAPI::Tracking.delete_tracking_by_id(id: "
|
168
|
+
resp = AftershipAPI::Tracking.delete_tracking_by_id(id: "<tracking_id>")
|
160
169
|
p resp.to_json
|
161
170
|
```
|
162
171
|
|
@@ -170,23 +179,23 @@ p resp.to_json
|
|
170
179
|
**GET** /trackings/:id
|
171
180
|
|
172
181
|
```ruby
|
173
|
-
resp = AftershipAPI::Tracking.get_tracking_by_id(id: "
|
182
|
+
resp = AftershipAPI::Tracking.get_tracking_by_id(id: "<tracking_id>")
|
174
183
|
p resp.to_json
|
175
184
|
```
|
176
185
|
|
177
186
|
**PUT** /trackings/:id
|
178
187
|
|
179
188
|
```ruby
|
180
|
-
req = AftershipAPI::Model::
|
189
|
+
req = AftershipAPI::Model::UpdateTrackingByIdRequest.new
|
181
190
|
req.note = "test update"
|
182
|
-
resp = AftershipAPI::Tracking.update_tracking_by_id(id: "
|
191
|
+
resp = AftershipAPI::Tracking.update_tracking_by_id(id: "<tracking_id>", body: req)
|
183
192
|
p resp.to_json
|
184
193
|
```
|
185
194
|
|
186
195
|
**POST** /trackings/:id/retrack
|
187
196
|
|
188
197
|
```ruby
|
189
|
-
resp = AftershipAPI::Tracking.retrack_tracking_by_id(id: "
|
198
|
+
resp = AftershipAPI::Tracking.retrack_tracking_by_id(id: "<tracking_id>")
|
190
199
|
p resp.to_json
|
191
200
|
```
|
192
201
|
|
@@ -195,7 +204,7 @@ p resp.to_json
|
|
195
204
|
```ruby
|
196
205
|
req = AftershipAPI::Model::MarkTrackingCompletedByIdRequest.new
|
197
206
|
req.reason = "DELIVERED"
|
198
|
-
resp = AftershipAPI::Tracking.mark_tracking_completed_by_id(id: "
|
207
|
+
resp = AftershipAPI::Tracking.mark_tracking_completed_by_id(id: "<tracking_id>", body: req)
|
199
208
|
p resp.to_json
|
200
209
|
```
|
201
210
|
|
@@ -217,55 +226,31 @@ p resp.to_json
|
|
217
226
|
**POST** /couriers/detect
|
218
227
|
|
219
228
|
```ruby
|
220
|
-
req = AftershipAPI::Model::
|
221
|
-
req.tracking_number = "
|
229
|
+
req = AftershipAPI::Model::DetectCourierRequest.new
|
230
|
+
req.tracking_number = "<tracking_number>"
|
222
231
|
resp = AftershipAPI::Courier.detect_courier(body: req)
|
223
232
|
p resp.to_json
|
224
233
|
```
|
225
234
|
|
226
|
-
### /last_checkpoint
|
227
|
-
|
228
|
-
**GET** /last_checkpoint/:id
|
229
|
-
|
230
|
-
```ruby
|
231
|
-
resp = AftershipAPI::LastCheckpoint.get_checkpoint_by_tracking_id(tracking_id: "hphtmivs7jq99lxo378h400e")
|
232
|
-
p resp.to_json
|
233
|
-
```
|
234
|
-
|
235
|
-
### /notifications
|
236
|
-
|
237
|
-
**GET** /notifications/:id
|
238
|
-
|
239
|
-
```ruby
|
240
|
-
resp = AftershipAPI::Notification.get_notification_by_tracking_id(tracking_id: "hphtmivs7jq99lxo378h400e")
|
241
|
-
p resp.to_json
|
242
|
-
```
|
243
|
-
|
244
|
-
**POST** /notifications/:id/add
|
245
|
-
|
246
|
-
```ruby
|
247
|
-
req = AftershipAPI::Model::NotificationRequestV1.new
|
248
|
-
req.emails = ["your_mail@gmail.com"]
|
249
|
-
resp = AftershipAPI::Notification.add_notification_by_tracking_id(tracking_id: "hphtmivs7jq99lxo378h400e",body: req)
|
250
|
-
p resp.to_json
|
251
|
-
```
|
252
|
-
|
253
|
-
**POST** /notifications/:id/remove
|
254
|
-
|
255
|
-
```ruby
|
256
|
-
req = AftershipAPI::Model::NotificationRequestV1.new
|
257
|
-
req.emails = ["your_mail@gmail.com"]
|
258
|
-
resp = AftershipAPI::Notification.delete_notification_by_tracking_id(tracking_id: "hphtmivs7jq99lxo378h400e",body: req)
|
259
|
-
p resp.to_json
|
260
|
-
```
|
261
|
-
|
262
235
|
### /estimated-delivery-date
|
263
236
|
|
264
237
|
**POST** /estimated-delivery-date/predict-batch
|
265
238
|
|
266
239
|
```ruby
|
267
240
|
edd = AftershipAPI::Model::EstimatedDeliveryDateRequest.new
|
268
|
-
edd.slug = "
|
241
|
+
edd.slug = "<slug>"
|
242
|
+
edd.pickup_time = "2024-08-01 06:42:30"
|
243
|
+
origin = AftershipAPI::Model::OriginAddressEstimatedDeliveryDateRequest.new
|
244
|
+
origin.country = "<ISO 3166-1 country/region code>"
|
245
|
+
origin.state = "<ISO 3166-1 country/region code>"
|
246
|
+
|
247
|
+
dest = AftershipAPI::Model::DestinationAddressEstimatedDeliveryDateRequest.new
|
248
|
+
dest.country = "<ISO 3166-1 country/region code>"
|
249
|
+
dest.state = "<ISO 3166-1 country/region code>"
|
250
|
+
|
251
|
+
edd.origin_address = origin
|
252
|
+
edd.destination_address = dest
|
253
|
+
|
269
254
|
req = AftershipAPI::Model::PredictBatchRequest.new
|
270
255
|
req.estimated_delivery_dates = [edd]
|
271
256
|
resp = AftershipAPI::EstimatedDeliveryDate.predict_batch(body: req)
|
@@ -13,12 +13,12 @@ module AftershipAPI
|
|
13
13
|
# detect_courier
|
14
14
|
# Return a list of matched couriers based on tracking number format and or a list of couriers.
|
15
15
|
|
16
|
-
# @param body [Model::
|
16
|
+
# @param body [Model::DetectCourierRequest]
|
17
17
|
# @param [Hash] opts the optional parameters
|
18
18
|
# @return [Model::DetectCourierResponse]
|
19
|
-
def detect_courier(body:,
|
20
|
-
if "
|
21
|
-
body = {
|
19
|
+
def detect_courier(body:,opts: {})
|
20
|
+
if "" != ""
|
21
|
+
body = {:'' => body}
|
22
22
|
end
|
23
23
|
opts[:body] = body
|
24
24
|
data, _status_code, _headers = detect_courier_with_http_info(opts: opts)
|
@@ -33,7 +33,7 @@ module AftershipAPI
|
|
33
33
|
|
34
34
|
|
35
35
|
# resource path
|
36
|
-
local_var_path = "/tracking/2024-
|
36
|
+
local_var_path = "/tracking/2024-10/couriers/detect"
|
37
37
|
method = :'POST'
|
38
38
|
|
39
39
|
# query parameters
|
@@ -81,7 +81,7 @@ module AftershipAPI
|
|
81
81
|
|
82
82
|
|
83
83
|
# resource path
|
84
|
-
local_var_path = "/tracking/2024-
|
84
|
+
local_var_path = "/tracking/2024-10/couriers/all"
|
85
85
|
method = :'GET'
|
86
86
|
|
87
87
|
# query parameters
|
@@ -129,7 +129,7 @@ module AftershipAPI
|
|
129
129
|
|
130
130
|
|
131
131
|
# resource path
|
132
|
-
local_var_path = "/tracking/2024-
|
132
|
+
local_var_path = "/tracking/2024-10/couriers"
|
133
133
|
method = :'GET'
|
134
134
|
|
135
135
|
# query parameters
|
@@ -160,4 +160,4 @@ module AftershipAPI
|
|
160
160
|
return data, status_code, headers
|
161
161
|
end
|
162
162
|
end
|
163
|
-
end
|
163
|
+
end
|
@@ -16,9 +16,9 @@ module AftershipAPI
|
|
16
16
|
# @param body [Model::PredictBatchRequest]
|
17
17
|
# @param [Hash] opts the optional parameters
|
18
18
|
# @return [Model::PredictBatchResponse]
|
19
|
-
def predict_batch(body:,
|
19
|
+
def predict_batch(body:,opts: {})
|
20
20
|
if "" != ""
|
21
|
-
body = {
|
21
|
+
body = {:'' => body}
|
22
22
|
end
|
23
23
|
opts[:body] = body
|
24
24
|
data, _status_code, _headers = predict_batch_with_http_info(opts: opts)
|
@@ -33,7 +33,7 @@ module AftershipAPI
|
|
33
33
|
|
34
34
|
|
35
35
|
# resource path
|
36
|
-
local_var_path = "/tracking/2024-
|
36
|
+
local_var_path = "/tracking/2024-10/estimated-delivery-date/predict-batch"
|
37
37
|
method = :'POST'
|
38
38
|
|
39
39
|
# query parameters
|
@@ -64,4 +64,4 @@ module AftershipAPI
|
|
64
64
|
return data, status_code, headers
|
65
65
|
end
|
66
66
|
end
|
67
|
-
end
|
67
|
+
end
|