Class: OpenapiClient::ManifestsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ManifestsApi

Returns a new instance of ManifestsApi.



19
20
21
# File 'lib/openapi_client/api/manifests_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/manifests_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_manifest(create_manifest_request_body, opts = {}) ⇒ CreateManifestResponseBody

Create Manifest Each ShipEngine manifest is created for a specific warehouse, so you’ll need to provide the warehouse_id rather than the ship_from address. You can create a warehouse for each location that you want to create manifests for.

Parameters:

Returns:



27
28
29
30
# File 'lib/openapi_client/api/manifests_api.rb', line 27

def create_manifest(create_manifest_request_body, opts = {})
  data, _status_code, _headers = create_manifest_with_http_info(create_manifest_request_body, opts)
  data
end

#create_manifest_with_http_info(create_manifest_request_body, opts = {}) ⇒ Array<(CreateManifestResponseBody, Integer, Hash)>

Create Manifest Each ShipEngine manifest is created for a specific warehouse, so you&#39;ll need to provide the warehouse_id rather than the ship_from address. You can create a warehouse for each location that you want to create manifests for.

Parameters:

Returns:

  • (Array<(CreateManifestResponseBody, Integer, Hash)>)

    CreateManifestResponseBody data, response status code and response headers



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/manifests_api.rb', line 37

def create_manifest_with_http_info(create_manifest_request_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ManifestsApi.create_manifest ...'
  end
  # verify the required parameter 'create_manifest_request_body' is set
  if @api_client.config.client_side_validation && create_manifest_request_body.nil?
    fail ArgumentError, "Missing the required parameter 'create_manifest_request_body' when calling ManifestsApi.create_manifest"
  end
  # resource path
  local_var_path = '/v1/manifests'

  # 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_manifest_request_body) 

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

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

#get_manifest_by_id(manifest_id, opts = {}) ⇒ GetManifestByIdResponseBody

Get Manifest By Id Get Manifest By Id

Parameters:

  • manifest_id (String)

    The Manifest Id

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



91
92
93
94
# File 'lib/openapi_client/api/manifests_api.rb', line 91

def get_manifest_by_id(manifest_id, opts = {})
  data, _status_code, _headers = get_manifest_by_id_with_http_info(manifest_id, opts)
  data
end

#get_manifest_by_id_with_http_info(manifest_id, opts = {}) ⇒ Array<(GetManifestByIdResponseBody, Integer, Hash)>

Get Manifest By Id Get Manifest By Id

Parameters:

  • manifest_id (String)

    The Manifest Id

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(GetManifestByIdResponseBody, Integer, Hash)>)

    GetManifestByIdResponseBody data, response status code and response headers



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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/openapi_client/api/manifests_api.rb', line 101

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

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

  # resource path
  local_var_path = '/v1/manifests/{manifest_id}'.sub('{' + 'manifest_id' + '}', CGI.escape(manifest_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] || 'GetManifestByIdResponseBody' 

  # 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: ManifestsApi#get_manifest_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_manifests(opts = {}) ⇒ ListManifestsResponseBody

List Manifests Similar to querying shipments, we allow you to query manifests since there will likely be a large number over a long period of time.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :warehouse_id (String)

    Warehouse ID

  • :ship_date_start (DateTime)

    ship date start range

  • :ship_date_end (DateTime)

    ship date end range

  • :created_at_start (DateTime)

    Used to create a filter for when a resource was created (ex. A shipment that was created after a certain time)

  • :created_at_end (DateTime)

    Used to create a filter for when a resource was created, (ex. A shipment that was created before a certain time)

  • :carrier_id (String)

    Carrier ID

  • :page (Integer)

    Return a specific page of results. Defaults to the first page. If set to a number that&#39;s greater than the number of pages of results, an empty page is returned. (default to 1)

  • :page_size (Integer)

    The number of results to return per response. (default to 25)

  • :label_ids (Array<String>)

Returns:



174
175
176
177
# File 'lib/openapi_client/api/manifests_api.rb', line 174

def list_manifests(opts = {})
  data, _status_code, _headers = list_manifests_with_http_info(opts)
  data
end

#list_manifests_with_http_info(opts = {}) ⇒ Array<(ListManifestsResponseBody, Integer, Hash)>

List Manifests Similar to querying shipments, we allow you to query manifests since there will likely be a large number over a long period of time.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :warehouse_id (String)

    Warehouse ID

  • :ship_date_start (DateTime)

    ship date start range

  • :ship_date_end (DateTime)

    ship date end range

  • :created_at_start (DateTime)

    Used to create a filter for when a resource was created (ex. A shipment that was created after a certain time)

  • :created_at_end (DateTime)

    Used to create a filter for when a resource was created, (ex. A shipment that was created before a certain time)

  • :carrier_id (String)

    Carrier ID

  • :page (Integer)

    Return a specific page of results. Defaults to the first page. If set to a number that&#39;s greater than the number of pages of results, an empty page is returned.

  • :page_size (Integer)

    The number of results to return per response.

  • :label_ids (Array<String>)

Returns:

  • (Array<(ListManifestsResponseBody, Integer, Hash)>)

    ListManifestsResponseBody data, response status code and response headers



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

def list_manifests_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ManifestsApi.list_manifests ...'
  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 ManifestsApi.list_manifests, 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 ManifestsApi.list_manifests, 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 ManifestsApi.list_manifests, 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 ManifestsApi.list_manifests, 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 ManifestsApi.list_manifests, 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 ManifestsApi.list_manifests, 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 ManifestsApi.list_manifests, 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 ManifestsApi.list_manifests, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/manifests'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'warehouse_id'] = opts[:'warehouse_id'] if !opts[:'warehouse_id'].nil?
  query_params[:'ship_date_start'] = opts[:'ship_date_start'] if !opts[:'ship_date_start'].nil?
  query_params[:'ship_date_end'] = opts[:'ship_date_end'] if !opts[:'ship_date_end'].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[:'carrier_id'] = opts[:'carrier_id'] if !opts[:'carrier_id'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'label_ids'] = @api_client.build_collection_param(opts[:'label_ids'], :multi) if !opts[:'label_ids'].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] || 'ListManifestsResponseBody' 

  # 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: ManifestsApi#list_manifests\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end