Class: OpenapiClient::CarriersApi

Inherits:
Object
  • Object
show all
Defined in:
lib/openapi_client/api/carriers_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ CarriersApi

Returns a new instance of CarriersApi.



19
20
21
# File 'lib/openapi_client/api/carriers_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/openapi_client/api/carriers_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#add_funds_to_carrier(carrier_id, add_funds_to_carrier_request_body, opts = {}) ⇒ AddFundsToCarrierResponseBody

Add Funds To Carrier Add Funds To A Carrier

Parameters:

  • Carrier ID

  • (defaults to: {})

    the optional parameters

Returns:



28
29
30
31
# File 'lib/openapi_client/api/carriers_api.rb', line 28

def add_funds_to_carrier(carrier_id, add_funds_to_carrier_request_body, opts = {})
  data, _status_code, _headers = add_funds_to_carrier_with_http_info(carrier_id, add_funds_to_carrier_request_body, opts)
  data
end

#add_funds_to_carrier_with_http_info(carrier_id, add_funds_to_carrier_request_body, opts = {}) ⇒ Array<(AddFundsToCarrierResponseBody, Integer, Hash)>

Add Funds To Carrier Add Funds To A Carrier

Parameters:

  • Carrier ID

  • (defaults to: {})

    the optional parameters

Returns:

  • AddFundsToCarrierResponseBody data, response status code and response headers



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
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/openapi_client/api/carriers_api.rb', line 39

def add_funds_to_carrier_with_http_info(carrier_id, add_funds_to_carrier_request_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CarriersApi.add_funds_to_carrier ...'
  end
  # verify the required parameter 'carrier_id' is set
  if @api_client.config.client_side_validation && carrier_id.nil?
    fail ArgumentError, "Missing the required parameter 'carrier_id' when calling CarriersApi.add_funds_to_carrier"
  end
  if @api_client.config.client_side_validation && carrier_id.to_s.length > 25
    fail ArgumentError, 'invalid value for "carrier_id" when calling CarriersApi.add_funds_to_carrier, the character length must be smaller than or equal to 25.'
  end

  if @api_client.config.client_side_validation && carrier_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "carrier_id" when calling CarriersApi.add_funds_to_carrier, 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 && carrier_id !~ pattern
    fail ArgumentError, "invalid value for 'carrier_id' when calling CarriersApi.add_funds_to_carrier, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'add_funds_to_carrier_request_body' is set
  if @api_client.config.client_side_validation && add_funds_to_carrier_request_body.nil?
    fail ArgumentError, "Missing the required parameter 'add_funds_to_carrier_request_body' when calling CarriersApi.add_funds_to_carrier"
  end
  # resource path
  local_var_path = '/v1/carriers/{carrier_id}/add_funds'.sub('{' + 'carrier_id' + '}', CGI.escape(carrier_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(add_funds_to_carrier_request_body) 

  # return_type
  return_type = opts[:return_type] || 'AddFundsToCarrierResponseBody' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key']

  new_options = 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, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CarriersApi#add_funds_to_carrier\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_carrier_by_id(carrier_id, opts = {}) ⇒ GetCarrierByIdResponseBody

Get Carrier By ID Retrive carrier info by ID

Parameters:

  • Carrier ID

  • (defaults to: {})

    the optional parameters

Returns:



110
111
112
113
# File 'lib/openapi_client/api/carriers_api.rb', line 110

def get_carrier_by_id(carrier_id, opts = {})
  data, _status_code, _headers = get_carrier_by_id_with_http_info(carrier_id, opts)
  data
end

#get_carrier_by_id_with_http_info(carrier_id, opts = {}) ⇒ Array<(GetCarrierByIdResponseBody, Integer, Hash)>

Get Carrier By ID Retrive carrier info by ID

Parameters:

  • Carrier ID

  • (defaults to: {})

    the optional parameters

Returns:

  • GetCarrierByIdResponseBody data, response status code and response headers



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
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/openapi_client/api/carriers_api.rb', line 120

def get_carrier_by_id_with_http_info(carrier_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CarriersApi.get_carrier_by_id ...'
  end
  # verify the required parameter 'carrier_id' is set
  if @api_client.config.client_side_validation && carrier_id.nil?
    fail ArgumentError, "Missing the required parameter 'carrier_id' when calling CarriersApi.get_carrier_by_id"
  end
  if @api_client.config.client_side_validation && carrier_id.to_s.length > 25
    fail ArgumentError, 'invalid value for "carrier_id" when calling CarriersApi.get_carrier_by_id, the character length must be smaller than or equal to 25.'
  end

  if @api_client.config.client_side_validation && carrier_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "carrier_id" when calling CarriersApi.get_carrier_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 && carrier_id !~ pattern
    fail ArgumentError, "invalid value for 'carrier_id' when calling CarriersApi.get_carrier_by_id, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v1/carriers/{carrier_id}'.sub('{' + 'carrier_id' + '}', CGI.escape(carrier_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] || 'GetCarrierByIdResponseBody' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key']

  new_options = 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, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CarriersApi#get_carrier_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_carrier_options(carrier_id, opts = {}) ⇒ GetCarrierOptionsResponseBody

Get Carrier Options Get a list of the options available for the carrier

Parameters:

  • Carrier ID

  • (defaults to: {})

    the optional parameters

Returns:



185
186
187
188
# File 'lib/openapi_client/api/carriers_api.rb', line 185

def get_carrier_options(carrier_id, opts = {})
  data, _status_code, _headers = get_carrier_options_with_http_info(carrier_id, opts)
  data
end

#get_carrier_options_with_http_info(carrier_id, opts = {}) ⇒ Array<(GetCarrierOptionsResponseBody, Integer, Hash)>

Get Carrier Options Get a list of the options available for the carrier

Parameters:

  • Carrier ID

  • (defaults to: {})

    the optional parameters

Returns:

  • GetCarrierOptionsResponseBody data, response status code and response headers



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
251
252
253
# File 'lib/openapi_client/api/carriers_api.rb', line 195

def get_carrier_options_with_http_info(carrier_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CarriersApi.get_carrier_options ...'
  end
  # verify the required parameter 'carrier_id' is set
  if @api_client.config.client_side_validation && carrier_id.nil?
    fail ArgumentError, "Missing the required parameter 'carrier_id' when calling CarriersApi.get_carrier_options"
  end
  if @api_client.config.client_side_validation && carrier_id.to_s.length > 25
    fail ArgumentError, 'invalid value for "carrier_id" when calling CarriersApi.get_carrier_options, the character length must be smaller than or equal to 25.'
  end

  if @api_client.config.client_side_validation && carrier_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "carrier_id" when calling CarriersApi.get_carrier_options, 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 && carrier_id !~ pattern
    fail ArgumentError, "invalid value for 'carrier_id' when calling CarriersApi.get_carrier_options, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v1/carriers/{carrier_id}/options'.sub('{' + 'carrier_id' + '}', CGI.escape(carrier_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] || 'GetCarrierOptionsResponseBody' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key']

  new_options = 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, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CarriersApi#get_carrier_options\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_carrier_package_types(carrier_id, opts = {}) ⇒ ListCarrierPackageTypesResponseBody

List Carrier Package Types List the package types associated with the carrier

Parameters:

  • Carrier ID

  • (defaults to: {})

    the optional parameters

Returns:



260
261
262
263
# File 'lib/openapi_client/api/carriers_api.rb', line 260

def list_carrier_package_types(carrier_id, opts = {})
  data, _status_code, _headers = list_carrier_package_types_with_http_info(carrier_id, opts)
  data
end

#list_carrier_package_types_with_http_info(carrier_id, opts = {}) ⇒ Array<(ListCarrierPackageTypesResponseBody, Integer, Hash)>

List Carrier Package Types List the package types associated with the carrier

Parameters:

  • Carrier ID

  • (defaults to: {})

    the optional parameters

Returns:

  • ListCarrierPackageTypesResponseBody data, response status code and response headers



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
# File 'lib/openapi_client/api/carriers_api.rb', line 270

def list_carrier_package_types_with_http_info(carrier_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CarriersApi.list_carrier_package_types ...'
  end
  # verify the required parameter 'carrier_id' is set
  if @api_client.config.client_side_validation && carrier_id.nil?
    fail ArgumentError, "Missing the required parameter 'carrier_id' when calling CarriersApi.list_carrier_package_types"
  end
  if @api_client.config.client_side_validation && carrier_id.to_s.length > 25
    fail ArgumentError, 'invalid value for "carrier_id" when calling CarriersApi.list_carrier_package_types, the character length must be smaller than or equal to 25.'
  end

  if @api_client.config.client_side_validation && carrier_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "carrier_id" when calling CarriersApi.list_carrier_package_types, 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 && carrier_id !~ pattern
    fail ArgumentError, "invalid value for 'carrier_id' when calling CarriersApi.list_carrier_package_types, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v1/carriers/{carrier_id}/packages'.sub('{' + 'carrier_id' + '}', CGI.escape(carrier_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] || 'ListCarrierPackageTypesResponseBody' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key']

  new_options = 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, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CarriersApi#list_carrier_package_types\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_carrier_services(carrier_id, opts = {}) ⇒ ListCarrierServicesResponseBody

List Carrier Services List the services associated with the carrier ID

Parameters:

  • Carrier ID

  • (defaults to: {})

    the optional parameters

Returns:



335
336
337
338
# File 'lib/openapi_client/api/carriers_api.rb', line 335

def list_carrier_services(carrier_id, opts = {})
  data, _status_code, _headers = list_carrier_services_with_http_info(carrier_id, opts)
  data
end

#list_carrier_services_with_http_info(carrier_id, opts = {}) ⇒ Array<(ListCarrierServicesResponseBody, Integer, Hash)>

List Carrier Services List the services associated with the carrier ID

Parameters:

  • Carrier ID

  • (defaults to: {})

    the optional parameters

Returns:

  • ListCarrierServicesResponseBody data, response status code and response headers



345
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
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
# File 'lib/openapi_client/api/carriers_api.rb', line 345

def list_carrier_services_with_http_info(carrier_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CarriersApi.list_carrier_services ...'
  end
  # verify the required parameter 'carrier_id' is set
  if @api_client.config.client_side_validation && carrier_id.nil?
    fail ArgumentError, "Missing the required parameter 'carrier_id' when calling CarriersApi.list_carrier_services"
  end
  if @api_client.config.client_side_validation && carrier_id.to_s.length > 25
    fail ArgumentError, 'invalid value for "carrier_id" when calling CarriersApi.list_carrier_services, the character length must be smaller than or equal to 25.'
  end

  if @api_client.config.client_side_validation && carrier_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "carrier_id" when calling CarriersApi.list_carrier_services, 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 && carrier_id !~ pattern
    fail ArgumentError, "invalid value for 'carrier_id' when calling CarriersApi.list_carrier_services, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v1/carriers/{carrier_id}/services'.sub('{' + 'carrier_id' + '}', CGI.escape(carrier_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] || 'ListCarrierServicesResponseBody' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key']

  new_options = 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, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CarriersApi#list_carrier_services\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_carriers(opts = {}) ⇒ GetCarriersResponseBody

List Carriers List all carriers that have been added to this account

Parameters:

  • (defaults to: {})

    the optional parameters

Returns:



409
410
411
412
# File 'lib/openapi_client/api/carriers_api.rb', line 409

def list_carriers(opts = {})
  data, _status_code, _headers = list_carriers_with_http_info(opts)
  data
end

#list_carriers_with_http_info(opts = {}) ⇒ Array<(GetCarriersResponseBody, Integer, Hash)>

List Carriers List all carriers that have been added to this account

Parameters:

  • (defaults to: {})

    the optional parameters

Returns:

  • GetCarriersResponseBody data, response status code and response headers



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
# File 'lib/openapi_client/api/carriers_api.rb', line 418

def list_carriers_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CarriersApi.list_carriers ...'
  end
  # resource path
  local_var_path = '/v1/carriers'

  # 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] || 'GetCarriersResponseBody' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key']

  new_options = 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, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CarriersApi#list_carriers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end