Class: OpenapiClient::TrackingApi
- Inherits:
-
Object
- Object
- OpenapiClient::TrackingApi
- Defined in:
- lib/openapi_client/api/tracking_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#get_tracking_log(opts = {}) ⇒ GetTrackingLogResponseBody
Get Tracking Information Retrieve package tracking information.
-
#get_tracking_log_with_http_info(opts = {}) ⇒ Array<(GetTrackingLogResponseBody, Integer, Hash)>
Get Tracking Information Retrieve package tracking information.
-
#initialize(api_client = ApiClient.default) ⇒ TrackingApi
constructor
A new instance of TrackingApi.
-
#start_tracking(opts = {}) ⇒ String
Start Tracking a Package Allows you to subscribe to tracking updates for a package.
-
#start_tracking_with_http_info(opts = {}) ⇒ Array<(String, Integer, Hash)>
Start Tracking a Package Allows you to subscribe to tracking updates for a package.
-
#stop_tracking(opts = {}) ⇒ String
Stop Tracking a Package Unsubscribe from tracking updates for a package.
-
#stop_tracking_with_http_info(opts = {}) ⇒ Array<(String, Integer, Hash)>
Stop Tracking a Package Unsubscribe from tracking updates for a package.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ TrackingApi
Returns a new instance of TrackingApi.
19 20 21 |
# File 'lib/openapi_client/api/tracking_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/tracking_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#get_tracking_log(opts = {}) ⇒ GetTrackingLogResponseBody
Get Tracking Information Retrieve package tracking information
28 29 30 31 |
# File 'lib/openapi_client/api/tracking_api.rb', line 28 def get_tracking_log(opts = {}) data, _status_code, _headers = get_tracking_log_with_http_info(opts) data end |
#get_tracking_log_with_http_info(opts = {}) ⇒ Array<(GetTrackingLogResponseBody, Integer, Hash)>
Get Tracking Information Retrieve package tracking information
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 |
# File 'lib/openapi_client/api/tracking_api.rb', line 39 def get_tracking_log_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TrackingApi.get_tracking_log ...' end if @api_client.config.client_side_validation && !opts[:'carrier_code'].nil? && opts[:'carrier_code'].to_s.length < 1 fail ArgumentError, 'invalid value for "opts[:"carrier_code"]" when calling TrackingApi.get_tracking_log, the character length must be great than or equal to 1.' 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 TrackingApi.get_tracking_log, the character length must be great than or equal to 1.' end # resource path local_var_path = '/v1/tracking' # query parameters query_params = opts[:query_params] || {} query_params[:'carrier_code'] = opts[:'carrier_code'] if !opts[:'carrier_code'].nil? query_params[:'tracking_number'] = opts[:'tracking_number'] if !opts[:'tracking_number'].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] || 'GetTrackingLogResponseBody' # 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: TrackingApi#get_tracking_log\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#start_tracking(opts = {}) ⇒ String
Start Tracking a Package Allows you to subscribe to tracking updates for a package. You specify the carrier_code and tracking_number of the package, and receive notifications via webhooks whenever the shipping status changes.
98 99 100 101 |
# File 'lib/openapi_client/api/tracking_api.rb', line 98 def start_tracking(opts = {}) data, _status_code, _headers = start_tracking_with_http_info(opts) data end |
#start_tracking_with_http_info(opts = {}) ⇒ Array<(String, Integer, Hash)>
Start Tracking a Package Allows you to subscribe to tracking updates for a package. You specify the carrier_code and tracking_number of the package, and receive notifications via webhooks whenever the shipping status changes.
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 |
# File 'lib/openapi_client/api/tracking_api.rb', line 109 def start_tracking_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TrackingApi.start_tracking ...' end if @api_client.config.client_side_validation && !opts[:'carrier_code'].nil? && opts[:'carrier_code'].to_s.length < 1 fail ArgumentError, 'invalid value for "opts[:"carrier_code"]" when calling TrackingApi.start_tracking, the character length must be great than or equal to 1.' 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 TrackingApi.start_tracking, the character length must be great than or equal to 1.' end # resource path local_var_path = '/v1/tracking/start' # query parameters query_params = opts[:query_params] || {} query_params[:'carrier_code'] = opts[:'carrier_code'] if !opts[:'carrier_code'].nil? query_params[:'tracking_number'] = opts[:'tracking_number'] if !opts[:'tracking_number'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'String' # 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: TrackingApi#start_tracking\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#stop_tracking(opts = {}) ⇒ String
Stop Tracking a Package Unsubscribe from tracking updates for a package.
168 169 170 171 |
# File 'lib/openapi_client/api/tracking_api.rb', line 168 def stop_tracking(opts = {}) data, _status_code, _headers = stop_tracking_with_http_info(opts) data end |
#stop_tracking_with_http_info(opts = {}) ⇒ Array<(String, Integer, Hash)>
Stop Tracking a Package Unsubscribe from tracking updates for a package.
179 180 181 182 183 184 185 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 |
# File 'lib/openapi_client/api/tracking_api.rb', line 179 def stop_tracking_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TrackingApi.stop_tracking ...' end if @api_client.config.client_side_validation && !opts[:'carrier_code'].nil? && opts[:'carrier_code'].to_s.length < 1 fail ArgumentError, 'invalid value for "opts[:"carrier_code"]" when calling TrackingApi.stop_tracking, the character length must be great than or equal to 1.' 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 TrackingApi.stop_tracking, the character length must be great than or equal to 1.' end # resource path local_var_path = '/v1/tracking/stop' # query parameters query_params = opts[:query_params] || {} query_params[:'carrier_code'] = opts[:'carrier_code'] if !opts[:'carrier_code'].nil? query_params[:'tracking_number'] = opts[:'tracking_number'] if !opts[:'tracking_number'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'String' # 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: TrackingApi#stop_tracking\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |