Class: OpenapiClient::LabelsApi
- Inherits:
-
Object
- Object
- OpenapiClient::LabelsApi
- Defined in:
- lib/openapi_client/api/labels_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#create_label(create_label_request_body, opts = {}) ⇒ CreateLabelResponseBody
Purchase Label Purchase and print a label for shipment.
-
#create_label_from_rate(rate_id, create_label_from_rate_request_body, opts = {}) ⇒ CreateLabelFromRateResponseBody
Purchase Label with Rate ID When retrieving rates for shipments using the ‘/rates` endpoint, the returned information contains a `rate_id` property that can be used to generate a label without having to refill in the shipment information repeatedly.
-
#create_label_from_rate_with_http_info(rate_id, create_label_from_rate_request_body, opts = {}) ⇒ Array<(CreateLabelFromRateResponseBody, Integer, Hash)>
Purchase Label with Rate ID When retrieving rates for shipments using the `/rates` endpoint, the returned information contains a `rate_id` property that can be used to generate a label without having to refill in the shipment information repeatedly.
-
#create_label_from_shipment(shipment_id, create_label_from_shipment_request_body, opts = {}) ⇒ CreateLabelFromShipmentResponseBody
Purchase Label with Shipment ID Purchase a label using a shipment ID that has already been created with the desired address and package info.
-
#create_label_from_shipment_with_http_info(shipment_id, create_label_from_shipment_request_body, opts = {}) ⇒ Array<(CreateLabelFromShipmentResponseBody, Integer, Hash)>
Purchase Label with Shipment ID Purchase a label using a shipment ID that has already been created with the desired address and package info.
-
#create_label_with_http_info(create_label_request_body, opts = {}) ⇒ Array<(CreateLabelResponseBody, Integer, Hash)>
Purchase Label Purchase and print a label for shipment.
-
#create_return_label(label_id, create_return_label_request_body, opts = {}) ⇒ CreateReturnLabelResponseBody
Create a return label Create a return label.
-
#create_return_label_with_http_info(label_id, create_return_label_request_body, opts = {}) ⇒ Array<(CreateReturnLabelResponseBody, Integer, Hash)>
Create a return label Create a return label.
-
#get_label_by_external_shipment_id(external_shipment_id, opts = {}) ⇒ GetLabelByExternalShipmentIdResponseBody
Get Label By External Shipment ID Find a label by using the external shipment id that was used during label creation.
-
#get_label_by_external_shipment_id_with_http_info(external_shipment_id, opts = {}) ⇒ Array<(GetLabelByExternalShipmentIdResponseBody, Integer, Hash)>
Get Label By External Shipment ID Find a label by using the external shipment id that was used during label creation.
-
#get_label_by_id(label_id, opts = {}) ⇒ GetLabelByIdResponseBody
Get Label By ID Retrieve information for individual labels.
-
#get_label_by_id_with_http_info(label_id, opts = {}) ⇒ Array<(GetLabelByIdResponseBody, Integer, Hash)>
Get Label By ID Retrieve information for individual labels.
-
#get_tracking_log_from_label(label_id, opts = {}) ⇒ GetTrackingLogFromLabelResponseBody
Get Label Tracking Information Retrieve the label’s tracking information.
-
#get_tracking_log_from_label_with_http_info(label_id, opts = {}) ⇒ Array<(GetTrackingLogFromLabelResponseBody, Integer, Hash)>
Get Label Tracking Information Retrieve the label's tracking information.
-
#initialize(api_client = ApiClient.default) ⇒ LabelsApi
constructor
A new instance of LabelsApi.
-
#list_labels(opts = {}) ⇒ ListLabelsResponseBody
List labels This endpoint returns a list of labels that you’ve [created](www.shipengine.com/docs/labels/create-a-label/).
-
#list_labels_with_http_info(opts = {}) ⇒ Array<(ListLabelsResponseBody, Integer, Hash)>
List labels This endpoint returns a list of labels that you've [created](www.shipengine.com/docs/labels/create-a-label/).
-
#void_label(label_id, opts = {}) ⇒ VoidLabelResponseBody
Void a Label By ID Void a label by ID to get a refund.
-
#void_label_with_http_info(label_id, opts = {}) ⇒ Array<(VoidLabelResponseBody, Integer, Hash)>
Void a Label By ID Void a label by ID to get a refund.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ LabelsApi
Returns a new instance of LabelsApi.
19 20 21 |
# File 'lib/openapi_client/api/labels_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/openapi_client/api/labels_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#create_label(create_label_request_body, opts = {}) ⇒ CreateLabelResponseBody
Purchase Label Purchase and print a label for shipment
27 28 29 30 |
# File 'lib/openapi_client/api/labels_api.rb', line 27 def create_label(create_label_request_body, opts = {}) data, _status_code, _headers = create_label_with_http_info(create_label_request_body, opts) data end |
#create_label_from_rate(rate_id, create_label_from_rate_request_body, opts = {}) ⇒ CreateLabelFromRateResponseBody
Purchase Label with Rate ID When retrieving rates for shipments using the ‘/rates` endpoint, the returned information contains a `rate_id` property that can be used to generate a label without having to refill in the shipment information repeatedly.
92 93 94 95 |
# File 'lib/openapi_client/api/labels_api.rb', line 92 def create_label_from_rate(rate_id, create_label_from_rate_request_body, opts = {}) data, _status_code, _headers = create_label_from_rate_with_http_info(rate_id, create_label_from_rate_request_body, opts) data end |
#create_label_from_rate_with_http_info(rate_id, create_label_from_rate_request_body, opts = {}) ⇒ Array<(CreateLabelFromRateResponseBody, Integer, Hash)>
Purchase Label with Rate ID When retrieving rates for shipments using the `/rates` endpoint, the returned information contains a `rate_id` property that can be used to generate a label without having to refill in the shipment information repeatedly.
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 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/openapi_client/api/labels_api.rb', line 103 def create_label_from_rate_with_http_info(rate_id, create_label_from_rate_request_body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LabelsApi.create_label_from_rate ...' end # verify the required parameter 'rate_id' is set if @api_client.config.client_side_validation && rate_id.nil? fail ArgumentError, "Missing the required parameter 'rate_id' when calling LabelsApi.create_label_from_rate" end if @api_client.config.client_side_validation && rate_id.to_s.length > 25 fail ArgumentError, 'invalid value for "rate_id" when calling LabelsApi.create_label_from_rate, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && rate_id.to_s.length < 1 fail ArgumentError, 'invalid value for "rate_id" when calling LabelsApi.create_label_from_rate, the character length must be great than or equal to 1.' end pattern = Regexp.new(/^se(-[a-z0-9]+)+$/) if @api_client.config.client_side_validation && rate_id !~ pattern fail ArgumentError, "invalid value for 'rate_id' when calling LabelsApi.create_label_from_rate, must conform to the pattern #{pattern}." end # verify the required parameter 'create_label_from_rate_request_body' is set if @api_client.config.client_side_validation && create_label_from_rate_request_body.nil? fail ArgumentError, "Missing the required parameter 'create_label_from_rate_request_body' when calling LabelsApi.create_label_from_rate" end # resource path local_var_path = '/v1/labels/rates/{rate_id}'.sub('{' + 'rate_id' + '}', CGI.escape(rate_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(create_label_from_rate_request_body) # return_type return_type = opts[:return_type] || 'CreateLabelFromRateResponseBody' # auth_names auth_names = opts[:auth_names] || ['api_key'] = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: LabelsApi#create_label_from_rate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#create_label_from_shipment(shipment_id, create_label_from_shipment_request_body, opts = {}) ⇒ CreateLabelFromShipmentResponseBody
Purchase Label with Shipment ID Purchase a label using a shipment ID that has already been created with the desired address and package info.
175 176 177 178 |
# File 'lib/openapi_client/api/labels_api.rb', line 175 def create_label_from_shipment(shipment_id, create_label_from_shipment_request_body, opts = {}) data, _status_code, _headers = create_label_from_shipment_with_http_info(shipment_id, create_label_from_shipment_request_body, opts) data end |
#create_label_from_shipment_with_http_info(shipment_id, create_label_from_shipment_request_body, opts = {}) ⇒ Array<(CreateLabelFromShipmentResponseBody, Integer, Hash)>
Purchase Label with Shipment ID Purchase a label using a shipment ID that has already been created with the desired address and package info.
186 187 188 189 190 191 192 193 194 195 196 197 198 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 242 243 244 245 246 247 248 249 250 |
# File 'lib/openapi_client/api/labels_api.rb', line 186 def create_label_from_shipment_with_http_info(shipment_id, create_label_from_shipment_request_body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LabelsApi.create_label_from_shipment ...' end # verify the required parameter 'shipment_id' is set if @api_client.config.client_side_validation && shipment_id.nil? fail ArgumentError, "Missing the required parameter 'shipment_id' when calling LabelsApi.create_label_from_shipment" end if @api_client.config.client_side_validation && shipment_id.to_s.length > 25 fail ArgumentError, 'invalid value for "shipment_id" when calling LabelsApi.create_label_from_shipment, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && shipment_id.to_s.length < 1 fail ArgumentError, 'invalid value for "shipment_id" when calling LabelsApi.create_label_from_shipment, the character length must be great than or equal to 1.' end pattern = Regexp.new(/^se(-[a-z0-9]+)+$/) if @api_client.config.client_side_validation && shipment_id !~ pattern fail ArgumentError, "invalid value for 'shipment_id' when calling LabelsApi.create_label_from_shipment, must conform to the pattern #{pattern}." end # verify the required parameter 'create_label_from_shipment_request_body' is set if @api_client.config.client_side_validation && create_label_from_shipment_request_body.nil? fail ArgumentError, "Missing the required parameter 'create_label_from_shipment_request_body' when calling LabelsApi.create_label_from_shipment" end # resource path local_var_path = '/v1/labels/shipment/{shipment_id}'.sub('{' + 'shipment_id' + '}', CGI.escape(shipment_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(create_label_from_shipment_request_body) # return_type return_type = opts[:return_type] || 'CreateLabelFromShipmentResponseBody' # auth_names auth_names = opts[:auth_names] || ['api_key'] = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: LabelsApi#create_label_from_shipment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#create_label_with_http_info(create_label_request_body, opts = {}) ⇒ Array<(CreateLabelResponseBody, Integer, Hash)>
Purchase Label Purchase and print a label for shipment
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 |
# File 'lib/openapi_client/api/labels_api.rb', line 37 def create_label_with_http_info(create_label_request_body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LabelsApi.create_label ...' end # verify the required parameter 'create_label_request_body' is set if @api_client.config.client_side_validation && create_label_request_body.nil? fail ArgumentError, "Missing the required parameter 'create_label_request_body' when calling LabelsApi.create_label" end # resource path local_var_path = '/v1/labels' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(create_label_request_body) # return_type return_type = opts[:return_type] || 'CreateLabelResponseBody' # auth_names auth_names = opts[:auth_names] || ['api_key'] = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: LabelsApi#create_label\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#create_return_label(label_id, create_return_label_request_body, opts = {}) ⇒ CreateReturnLabelResponseBody
Create a return label Create a return label
258 259 260 261 |
# File 'lib/openapi_client/api/labels_api.rb', line 258 def create_return_label(label_id, create_return_label_request_body, opts = {}) data, _status_code, _headers = create_return_label_with_http_info(label_id, create_return_label_request_body, opts) data end |
#create_return_label_with_http_info(label_id, create_return_label_request_body, opts = {}) ⇒ Array<(CreateReturnLabelResponseBody, Integer, Hash)>
Create a return label Create a return label
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 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 |
# File 'lib/openapi_client/api/labels_api.rb', line 269 def create_return_label_with_http_info(label_id, create_return_label_request_body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LabelsApi.create_return_label ...' end # verify the required parameter 'label_id' is set if @api_client.config.client_side_validation && label_id.nil? fail ArgumentError, "Missing the required parameter 'label_id' when calling LabelsApi.create_return_label" end if @api_client.config.client_side_validation && label_id.to_s.length > 25 fail ArgumentError, 'invalid value for "label_id" when calling LabelsApi.create_return_label, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && label_id.to_s.length < 1 fail ArgumentError, 'invalid value for "label_id" when calling LabelsApi.create_return_label, the character length must be great than or equal to 1.' end pattern = Regexp.new(/^se(-[a-z0-9]+)+$/) if @api_client.config.client_side_validation && label_id !~ pattern fail ArgumentError, "invalid value for 'label_id' when calling LabelsApi.create_return_label, must conform to the pattern #{pattern}." end # verify the required parameter 'create_return_label_request_body' is set if @api_client.config.client_side_validation && create_return_label_request_body.nil? fail ArgumentError, "Missing the required parameter 'create_return_label_request_body' when calling LabelsApi.create_return_label" end # resource path local_var_path = '/v1/labels/{label_id}/return'.sub('{' + 'label_id' + '}', CGI.escape(label_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(create_return_label_request_body) # return_type return_type = opts[:return_type] || 'CreateReturnLabelResponseBody' # auth_names auth_names = opts[:auth_names] || ['api_key'] = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: LabelsApi#create_return_label\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_label_by_external_shipment_id(external_shipment_id, opts = {}) ⇒ GetLabelByExternalShipmentIdResponseBody
Get Label By External Shipment ID Find a label by using the external shipment id that was used during label creation
341 342 343 344 |
# File 'lib/openapi_client/api/labels_api.rb', line 341 def get_label_by_external_shipment_id(external_shipment_id, opts = {}) data, _status_code, _headers = get_label_by_external_shipment_id_with_http_info(external_shipment_id, opts) data end |
#get_label_by_external_shipment_id_with_http_info(external_shipment_id, opts = {}) ⇒ Array<(GetLabelByExternalShipmentIdResponseBody, Integer, Hash)>
Get Label By External Shipment ID Find a label by using the external shipment id that was used during label creation
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 389 390 391 392 393 394 395 396 397 398 |
# File 'lib/openapi_client/api/labels_api.rb', line 352 def get_label_by_external_shipment_id_with_http_info(external_shipment_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LabelsApi.get_label_by_external_shipment_id ...' end # verify the required parameter 'external_shipment_id' is set if @api_client.config.client_side_validation && external_shipment_id.nil? fail ArgumentError, "Missing the required parameter 'external_shipment_id' when calling LabelsApi.get_label_by_external_shipment_id" end # resource path local_var_path = '/v1/labels/external_shipment_id/{external_shipment_id}'.sub('{' + 'external_shipment_id' + '}', CGI.escape(external_shipment_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'label_download_type'] = opts[:'label_download_type'] if !opts[:'label_download_type'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'GetLabelByExternalShipmentIdResponseBody' # auth_names auth_names = opts[:auth_names] || ['api_key'] = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: LabelsApi#get_label_by_external_shipment_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_label_by_id(label_id, opts = {}) ⇒ GetLabelByIdResponseBody
Get Label By ID Retrieve information for individual labels.
406 407 408 409 |
# File 'lib/openapi_client/api/labels_api.rb', line 406 def get_label_by_id(label_id, opts = {}) data, _status_code, _headers = get_label_by_id_with_http_info(label_id, opts) data end |
#get_label_by_id_with_http_info(label_id, opts = {}) ⇒ Array<(GetLabelByIdResponseBody, Integer, Hash)>
Get Label By ID Retrieve information for individual labels.
417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 |
# File 'lib/openapi_client/api/labels_api.rb', line 417 def get_label_by_id_with_http_info(label_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LabelsApi.get_label_by_id ...' end # verify the required parameter 'label_id' is set if @api_client.config.client_side_validation && label_id.nil? fail ArgumentError, "Missing the required parameter 'label_id' when calling LabelsApi.get_label_by_id" end if @api_client.config.client_side_validation && label_id.to_s.length > 25 fail ArgumentError, 'invalid value for "label_id" when calling LabelsApi.get_label_by_id, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && label_id.to_s.length < 1 fail ArgumentError, 'invalid value for "label_id" when calling LabelsApi.get_label_by_id, the character length must be great than or equal to 1.' end pattern = Regexp.new(/^se(-[a-z0-9]+)+$/) if @api_client.config.client_side_validation && label_id !~ pattern fail ArgumentError, "invalid value for 'label_id' when calling LabelsApi.get_label_by_id, must conform to the pattern #{pattern}." end # resource path local_var_path = '/v1/labels/{label_id}'.sub('{' + 'label_id' + '}', CGI.escape(label_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'label_download_type'] = opts[:'label_download_type'] if !opts[:'label_download_type'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'GetLabelByIdResponseBody' # auth_names auth_names = opts[:auth_names] || ['api_key'] = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: LabelsApi#get_label_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_tracking_log_from_label(label_id, opts = {}) ⇒ GetTrackingLogFromLabelResponseBody
Get Label Tracking Information Retrieve the label’s tracking information
483 484 485 486 |
# File 'lib/openapi_client/api/labels_api.rb', line 483 def get_tracking_log_from_label(label_id, opts = {}) data, _status_code, _headers = get_tracking_log_from_label_with_http_info(label_id, opts) data end |
#get_tracking_log_from_label_with_http_info(label_id, opts = {}) ⇒ Array<(GetTrackingLogFromLabelResponseBody, Integer, Hash)>
Get Label Tracking Information Retrieve the label's tracking information
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 |
# File 'lib/openapi_client/api/labels_api.rb', line 493 def get_tracking_log_from_label_with_http_info(label_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LabelsApi.get_tracking_log_from_label ...' end # verify the required parameter 'label_id' is set if @api_client.config.client_side_validation && label_id.nil? fail ArgumentError, "Missing the required parameter 'label_id' when calling LabelsApi.get_tracking_log_from_label" end if @api_client.config.client_side_validation && label_id.to_s.length > 25 fail ArgumentError, 'invalid value for "label_id" when calling LabelsApi.get_tracking_log_from_label, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && label_id.to_s.length < 1 fail ArgumentError, 'invalid value for "label_id" when calling LabelsApi.get_tracking_log_from_label, the character length must be great than or equal to 1.' end pattern = Regexp.new(/^se(-[a-z0-9]+)+$/) if @api_client.config.client_side_validation && label_id !~ pattern fail ArgumentError, "invalid value for 'label_id' when calling LabelsApi.get_tracking_log_from_label, must conform to the pattern #{pattern}." end # resource path local_var_path = '/v1/labels/{label_id}/track'.sub('{' + 'label_id' + '}', CGI.escape(label_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'GetTrackingLogFromLabelResponseBody' # auth_names auth_names = opts[:auth_names] || ['api_key'] = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: LabelsApi#get_tracking_log_from_label\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_labels(opts = {}) ⇒ ListLabelsResponseBody
List labels This endpoint returns a list of labels that you’ve [created](www.shipengine.com/docs/labels/create-a-label/). You can optionally filter the results as well as control their sort order and the number of results returned at a time. By default, all labels are returned, 25 at a time, starting with the most recently created ones. You can combine multiple filter options to narrow-down the results. For example, if you only want to get your UPS labels for your east coast warehouse you could query by both ‘warehouse_id` and `carrier_id`
571 572 573 574 |
# File 'lib/openapi_client/api/labels_api.rb', line 571 def list_labels(opts = {}) data, _status_code, _headers = list_labels_with_http_info(opts) data end |
#list_labels_with_http_info(opts = {}) ⇒ Array<(ListLabelsResponseBody, Integer, Hash)>
List labels This endpoint returns a list of labels that you've [created](www.shipengine.com/docs/labels/create-a-label/). You can optionally filter the results as well as control their sort order and the number of results returned at a time. By default, all labels are returned, 25 at a time, starting with the most recently created ones. You can combine multiple filter options to narrow-down the results. For example, if you only want to get your UPS labels for your east coast warehouse you could query by both `warehouse_id` and `carrier_id`
594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 |
# File 'lib/openapi_client/api/labels_api.rb', line 594 def list_labels_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LabelsApi.list_labels ...' end pattern = Regexp.new(/^[a-z0-9]+(_[a-z0-9-]+)* ?$/) if @api_client.config.client_side_validation && !opts[:'service_code'].nil? && opts[:'service_code'] !~ pattern fail ArgumentError, "invalid value for 'opts[:\"service_code\"]' when calling LabelsApi.list_labels, must conform to the pattern #{pattern}." end if @api_client.config.client_side_validation && !opts[:'carrier_id'].nil? && opts[:'carrier_id'].to_s.length > 25 fail ArgumentError, 'invalid value for "opts[:"carrier_id"]" when calling LabelsApi.list_labels, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && !opts[:'carrier_id'].nil? && opts[:'carrier_id'].to_s.length < 1 fail ArgumentError, 'invalid value for "opts[:"carrier_id"]" when calling LabelsApi.list_labels, the character length must be great than or equal to 1.' end pattern = Regexp.new(/^se(-[a-z0-9]+)+$/) if @api_client.config.client_side_validation && !opts[:'carrier_id'].nil? && opts[:'carrier_id'] !~ pattern fail ArgumentError, "invalid value for 'opts[:\"carrier_id\"]' when calling LabelsApi.list_labels, must conform to the pattern #{pattern}." end if @api_client.config.client_side_validation && !opts[:'tracking_number'].nil? && opts[:'tracking_number'].to_s.length < 1 fail ArgumentError, 'invalid value for "opts[:"tracking_number"]" when calling LabelsApi.list_labels, the character length must be great than or equal to 1.' end if @api_client.config.client_side_validation && !opts[:'batch_id'].nil? && opts[:'batch_id'].to_s.length > 25 fail ArgumentError, 'invalid value for "opts[:"batch_id"]" when calling LabelsApi.list_labels, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && !opts[:'batch_id'].nil? && opts[:'batch_id'].to_s.length < 1 fail ArgumentError, 'invalid value for "opts[:"batch_id"]" when calling LabelsApi.list_labels, the character length must be great than or equal to 1.' end pattern = Regexp.new(/^se(-[a-z0-9]+)+$/) if @api_client.config.client_side_validation && !opts[:'batch_id'].nil? && opts[:'batch_id'] !~ pattern fail ArgumentError, "invalid value for 'opts[:\"batch_id\"]' when calling LabelsApi.list_labels, must conform to the pattern #{pattern}." end if @api_client.config.client_side_validation && !opts[:'rate_id'].nil? && opts[:'rate_id'].to_s.length > 25 fail ArgumentError, 'invalid value for "opts[:"rate_id"]" when calling LabelsApi.list_labels, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && !opts[:'rate_id'].nil? && opts[:'rate_id'].to_s.length < 1 fail ArgumentError, 'invalid value for "opts[:"rate_id"]" when calling LabelsApi.list_labels, the character length must be great than or equal to 1.' end pattern = Regexp.new(/^se(-[a-z0-9]+)+$/) if @api_client.config.client_side_validation && !opts[:'rate_id'].nil? && opts[:'rate_id'] !~ pattern fail ArgumentError, "invalid value for 'opts[:\"rate_id\"]' when calling LabelsApi.list_labels, must conform to the pattern #{pattern}." end if @api_client.config.client_side_validation && !opts[:'shipment_id'].nil? && opts[:'shipment_id'].to_s.length > 25 fail ArgumentError, 'invalid value for "opts[:"shipment_id"]" when calling LabelsApi.list_labels, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && !opts[:'shipment_id'].nil? && opts[:'shipment_id'].to_s.length < 1 fail ArgumentError, 'invalid value for "opts[:"shipment_id"]" when calling LabelsApi.list_labels, the character length must be great than or equal to 1.' end pattern = Regexp.new(/^se(-[a-z0-9]+)+$/) if @api_client.config.client_side_validation && !opts[:'shipment_id'].nil? && opts[:'shipment_id'] !~ pattern fail ArgumentError, "invalid value for 'opts[:\"shipment_id\"]' when calling LabelsApi.list_labels, must conform to the pattern #{pattern}." end if @api_client.config.client_side_validation && !opts[:'warehouse_id'].nil? && opts[:'warehouse_id'].to_s.length > 25 fail ArgumentError, 'invalid value for "opts[:"warehouse_id"]" when calling LabelsApi.list_labels, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && !opts[:'warehouse_id'].nil? && opts[:'warehouse_id'].to_s.length < 1 fail ArgumentError, 'invalid value for "opts[:"warehouse_id"]" when calling LabelsApi.list_labels, the character length must be great than or equal to 1.' end pattern = Regexp.new(/^se(-[a-z0-9]+)+$/) if @api_client.config.client_side_validation && !opts[:'warehouse_id'].nil? && opts[:'warehouse_id'] !~ pattern fail ArgumentError, "invalid value for 'opts[:\"warehouse_id\"]' when calling LabelsApi.list_labels, must conform to the pattern #{pattern}." end if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1 fail ArgumentError, 'invalid value for "opts[:"page"]" when calling LabelsApi.list_labels, must be greater than or equal to 1.' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling LabelsApi.list_labels, must be greater than or equal to 1.' end allowable_values = ["modified_at", "created_at"] if @api_client.config.client_side_validation && opts[:'sort_by'] && !allowable_values.include?(opts[:'sort_by']) fail ArgumentError, "invalid value for \"sort_by\", must be one of #{allowable_values}" end # resource path local_var_path = '/v1/labels' # query parameters query_params = opts[:query_params] || {} query_params[:'label_status'] = opts[:'label_status'] if !opts[:'label_status'].nil? query_params[:'service_code'] = opts[:'service_code'] if !opts[:'service_code'].nil? query_params[:'carrier_id'] = opts[:'carrier_id'] if !opts[:'carrier_id'].nil? query_params[:'tracking_number'] = opts[:'tracking_number'] if !opts[:'tracking_number'].nil? query_params[:'batch_id'] = opts[:'batch_id'] if !opts[:'batch_id'].nil? query_params[:'rate_id'] = opts[:'rate_id'] if !opts[:'rate_id'].nil? query_params[:'shipment_id'] = opts[:'shipment_id'] if !opts[:'shipment_id'].nil? query_params[:'warehouse_id'] = opts[:'warehouse_id'] if !opts[:'warehouse_id'].nil? query_params[:'created_at_start'] = opts[:'created_at_start'] if !opts[:'created_at_start'].nil? query_params[:'created_at_end'] = opts[:'created_at_end'] if !opts[:'created_at_end'].nil? query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'sort_dir'] = opts[:'sort_dir'] if !opts[:'sort_dir'].nil? query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'ListLabelsResponseBody' # auth_names auth_names = opts[:auth_names] || ['api_key'] = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: LabelsApi#list_labels\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#void_label(label_id, opts = {}) ⇒ VoidLabelResponseBody
Void a Label By ID Void a label by ID to get a refund.
742 743 744 745 |
# File 'lib/openapi_client/api/labels_api.rb', line 742 def void_label(label_id, opts = {}) data, _status_code, _headers = void_label_with_http_info(label_id, opts) data end |
#void_label_with_http_info(label_id, opts = {}) ⇒ Array<(VoidLabelResponseBody, Integer, Hash)>
Void a Label By ID Void a label by ID to get a refund.
752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 |
# File 'lib/openapi_client/api/labels_api.rb', line 752 def void_label_with_http_info(label_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LabelsApi.void_label ...' end # verify the required parameter 'label_id' is set if @api_client.config.client_side_validation && label_id.nil? fail ArgumentError, "Missing the required parameter 'label_id' when calling LabelsApi.void_label" end if @api_client.config.client_side_validation && label_id.to_s.length > 25 fail ArgumentError, 'invalid value for "label_id" when calling LabelsApi.void_label, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && label_id.to_s.length < 1 fail ArgumentError, 'invalid value for "label_id" when calling LabelsApi.void_label, the character length must be great than or equal to 1.' end pattern = Regexp.new(/^se(-[a-z0-9]+)+$/) if @api_client.config.client_side_validation && label_id !~ pattern fail ArgumentError, "invalid value for 'label_id' when calling LabelsApi.void_label, must conform to the pattern #{pattern}." end # resource path local_var_path = '/v1/labels/{label_id}/void'.sub('{' + 'label_id' + '}', CGI.escape(label_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'VoidLabelResponseBody' # auth_names auth_names = opts[:auth_names] || ['api_key'] = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PUT, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: LabelsApi#void_label\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |