Class: AftershipAPI::TrackingApi
- Inherits:
-
Object
- Object
- AftershipAPI::TrackingApi
- Defined in:
- lib/aftership-tracking-sdk/api/tracking.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
- #create_tracking(body:, opts: {}) ⇒ Model::CreateTrackingResponse
-
#delete_tracking_by_id(id:, opts: {}) ⇒ Model::DeleteTrackingByIdResponse
delete_tracking_by_id Delete a tracking.
-
#get_tracking_by_id(id:, opts: {}) ⇒ Model::GetTrackingByIdResponse
get_tracking_by_id Get tracking results of a single tracking.
-
#get_trackings(opts: {}) ⇒ Model::GetTrackingsResponse
get_trackings Get tracking results of multiple trackings.<div style=“visibility:hidden; height: 0”></div>.
-
#initialize(api_client = ApiClient.default) ⇒ TrackingApi
constructor
A new instance of TrackingApi.
- #mark_tracking_completed_by_id(id:, body:, opts: {}) ⇒ Model::MarkTrackingCompletedByIdResponse
-
#retrack_tracking_by_id(id:, opts: {}) ⇒ Model::RetrackTrackingByIdResponse
retrack_tracking_by_id Retrack an expired tracking.
- #update_tracking_by_id(id:, body:, opts: {}) ⇒ Model::UpdateTrackingByIdResponse
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ TrackingApi
Returns a new instance of TrackingApi.
9 10 11 |
# File 'lib/aftership-tracking-sdk/api/tracking.rb', line 9 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
7 8 9 |
# File 'lib/aftership-tracking-sdk/api/tracking.rb', line 7 def api_client @api_client end |
Instance Method Details
#create_tracking(body:, opts: {}) ⇒ Model::CreateTrackingResponse
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/aftership-tracking-sdk/api/tracking.rb', line 99 def create_tracking(body:, opts: {}) opts[:body] = body if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TrackingApi.create_tracking ...' end # resource path local_var_path = "/tracking/2025-07/trackings" method = :'POST' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = 'Tracking' = opts.merge( :operation => :"TrackingApi.create_tracking", :header_params => header_params, :query_params => query_params, :body => post_body, :return_type => return_type ) data, _status_code, headers = @api_client.call_api(method, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: TrackingApi#create_tracking\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end resp = Model::CreateTrackingResponse.new resp.data = data resp.response_header = headers resp end |
#delete_tracking_by_id(id:, opts: {}) ⇒ Model::DeleteTrackingByIdResponse
delete_tracking_by_id Delete a tracking.
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
# File 'lib/aftership-tracking-sdk/api/tracking.rb', line 248 def delete_tracking_by_id(id:, opts: {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TrackingApi.delete_tracking_by_id ...' end if id.nil? or id.to_s == '' raise ApiError.new(:error_code => BAD_REQUEST, :message => "id cannot be nil or empty") end # resource path local_var_path = "/tracking/2025-07/trackings/#{id}" method = :'DELETE' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = 'Tracking' = opts.merge( :operation => :"TrackingApi.delete_tracking_by_id", :header_params => header_params, :query_params => query_params, :body => post_body, :return_type => return_type ) data, _status_code, headers = @api_client.call_api(method, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: TrackingApi#delete_tracking_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end resp = Model::DeleteTrackingByIdResponse.new resp.data = data resp.response_header = headers resp end |
#get_tracking_by_id(id:, opts: {}) ⇒ Model::GetTrackingByIdResponse
get_tracking_by_id Get tracking results of a single tracking.
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/aftership-tracking-sdk/api/tracking.rb', line 147 def get_tracking_by_id(id:, opts: {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TrackingApi.get_tracking_by_id ...' end if id.nil? or id.to_s == '' raise ApiError.new(:error_code => BAD_REQUEST, :message => "id cannot be nil or empty") end # resource path local_var_path = "/tracking/2025-07/trackings/#{id}" method = :'GET' # query parameters query_params = opts[:query_params] || {} query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil? query_params[:'lang'] = opts[:'lang'] if !opts[:'lang'].nil? # header parameters header_params = opts[:header_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = 'Tracking' = opts.merge( :operation => :"TrackingApi.get_tracking_by_id", :header_params => header_params, :query_params => query_params, :body => post_body, :return_type => return_type ) data, _status_code, headers = @api_client.call_api(method, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: TrackingApi#get_tracking_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end resp = Model::GetTrackingByIdResponse.new resp.data = data resp.response_header = headers resp end |
#get_trackings(opts: {}) ⇒ Model::GetTrackingsResponse
get_trackings Get tracking results of multiple trackings.<div style=“visibility:hidden; height: 0”></div>
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/aftership-tracking-sdk/api/tracking.rb', line 35 def get_trackings(opts: {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TrackingApi.get_trackings ...' end # resource path local_var_path = "/tracking/2025-07/trackings" method = :'GET' # query parameters query_params = opts[:query_params] || {} query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'keyword'] = opts[:'keyword'] if !opts[:'keyword'].nil? query_params[:'tracking_numbers'] = opts[:'tracking_numbers'] if !opts[:'tracking_numbers'].nil? query_params[:'slug'] = opts[:'slug'] if !opts[:'slug'].nil? query_params[:'transit_time'] = opts[:'transit_time'] if !opts[:'transit_time'].nil? query_params[:'origin'] = opts[:'origin'] if !opts[:'origin'].nil? query_params[:'destination'] = opts[:'destination'] if !opts[:'destination'].nil? query_params[:'tag'] = opts[:'tag'] if !opts[:'tag'].nil? query_params[:'created_at_min'] = opts[:'created_at_min'] if !opts[:'created_at_min'].nil? query_params[:'created_at_max'] = opts[:'created_at_max'] if !opts[:'created_at_max'].nil? query_params[:'updated_at_min'] = opts[:'updated_at_min'] if !opts[:'updated_at_min'].nil? query_params[:'updated_at_max'] = opts[:'updated_at_max'] if !opts[:'updated_at_max'].nil? query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil? query_params[:'return_to_sender'] = opts[:'return_to_sender'] if !opts[:'return_to_sender'].nil? query_params[:'courier_destination_country_region'] = opts[:'courier_destination_country_region'] if !opts[:'courier_destination_country_region'].nil? query_params[:'shipment_tags'] = opts[:'shipment_tags'] if !opts[:'shipment_tags'].nil? query_params[:'order_id'] = opts[:'order_id'] if !opts[:'order_id'].nil? # header parameters header_params = opts[:header_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = 'GetTrackingsResponseData' = opts.merge( :operation => :"TrackingApi.get_trackings", :header_params => header_params, :query_params => query_params, :body => post_body, :return_type => return_type ) data, _status_code, headers = @api_client.call_api(method, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: TrackingApi#get_trackings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end resp = Model::GetTrackingsResponse.new resp.data = data resp.response_header = headers resp end |
#mark_tracking_completed_by_id(id:, body:, opts: {}) ⇒ Model::MarkTrackingCompletedByIdResponse
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 |
# File 'lib/aftership-tracking-sdk/api/tracking.rb', line 346 def mark_tracking_completed_by_id(id:, body:, opts: {}) opts[:body] = body if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TrackingApi.mark_tracking_completed_by_id ...' end if id.nil? or id.to_s == '' raise ApiError.new(:error_code => BAD_REQUEST, :message => "id cannot be nil or empty") end # resource path local_var_path = "/tracking/2025-07/trackings/#{id}/mark-as-completed" method = :'POST' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = 'Tracking' = opts.merge( :operation => :"TrackingApi.mark_tracking_completed_by_id", :header_params => header_params, :query_params => query_params, :body => post_body, :return_type => return_type ) data, _status_code, headers = @api_client.call_api(method, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: TrackingApi#mark_tracking_completed_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end resp = Model::MarkTrackingCompletedByIdResponse.new resp.data = data resp.response_header = headers resp end |
#retrack_tracking_by_id(id:, opts: {}) ⇒ Model::RetrackTrackingByIdResponse
retrack_tracking_by_id Retrack an expired tracking. Max 3 times per tracking.
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 |
# File 'lib/aftership-tracking-sdk/api/tracking.rb', line 296 def retrack_tracking_by_id(id:, opts: {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TrackingApi.retrack_tracking_by_id ...' end if id.nil? or id.to_s == '' raise ApiError.new(:error_code => BAD_REQUEST, :message => "id cannot be nil or empty") end # resource path local_var_path = "/tracking/2025-07/trackings/#{id}/retrack" method = :'POST' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = 'Tracking' = opts.merge( :operation => :"TrackingApi.retrack_tracking_by_id", :header_params => header_params, :query_params => query_params, :body => post_body, :return_type => return_type ) data, _status_code, headers = @api_client.call_api(method, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: TrackingApi#retrack_tracking_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end resp = Model::RetrackTrackingByIdResponse.new resp.data = data resp.response_header = headers resp end |
#update_tracking_by_id(id:, body:, opts: {}) ⇒ Model::UpdateTrackingByIdResponse
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
# File 'lib/aftership-tracking-sdk/api/tracking.rb', line 199 def update_tracking_by_id(id:, body:, opts: {}) opts[:body] = body if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TrackingApi.update_tracking_by_id ...' end if id.nil? or id.to_s == '' raise ApiError.new(:error_code => BAD_REQUEST, :message => "id cannot be nil or empty") end # resource path local_var_path = "/tracking/2025-07/trackings/#{id}" method = :'PUT' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = 'Tracking' = opts.merge( :operation => :"TrackingApi.update_tracking_by_id", :header_params => header_params, :query_params => query_params, :body => post_body, :return_type => return_type ) data, _status_code, headers = @api_client.call_api(method, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: TrackingApi#update_tracking_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end resp = Model::UpdateTrackingByIdResponse.new resp.data = data resp.response_header = headers resp end |