Class: TripletexRubyClient::PurchaseOrderApi

Inherits:
Object
  • Object
show all
Defined in:
lib/tripletex_ruby_client/api/purchase_order_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ PurchaseOrderApi

Returns a new instance of PurchaseOrderApi.



19
20
21
# File 'lib/tripletex_ruby_client/api/purchase_order_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/tripletex_ruby_client/api/purchase_order_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#delete(id, opts = {}) ⇒ nil

BETA

Delete purchase order.

Parameters:

  • id

    Element ID

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

    the optional parameters

Returns:

  • (nil)


27
28
29
30
# File 'lib/tripletex_ruby_client/api/purchase_order_api.rb', line 27

def delete(id, opts = {})
  delete_with_http_info(id, opts)
  nil
end

#delete_attachment(id, opts = {}) ⇒ nil

BETA

Delete attachment.

Parameters:

  • id

    ID of purchase order containing the attachment to delete.

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

    the optional parameters

Returns:

  • (nil)


76
77
78
79
# File 'lib/tripletex_ruby_client/api/purchase_order_api.rb', line 76

def delete_attachment(id, opts = {})
  delete_attachment_with_http_info(id, opts)
  nil
end

#delete_attachment_with_http_info(id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

BETA

Delete attachment.

Parameters:

  • id

    ID of purchase order containing the attachment to delete.

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

    the optional parameters

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/tripletex_ruby_client/api/purchase_order_api.rb', line 86

def delete_attachment_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PurchaseOrderApi.delete_attachment ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling PurchaseOrderApi.delete_attachment"
  end
  # resource path
  local_var_path = '/purchaseOrder/{id}/attachment'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['tokenAuthScheme']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PurchaseOrderApi#delete_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_with_http_info(id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

BETA

Delete purchase order.

Parameters:

  • id

    Element ID

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

    the optional parameters

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, 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
# File 'lib/tripletex_ruby_client/api/purchase_order_api.rb', line 37

def delete_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PurchaseOrderApi.delete ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling PurchaseOrderApi.delete"
  end
  # resource path
  local_var_path = '/purchaseOrder/{id}'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['tokenAuthScheme']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PurchaseOrderApi#delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get(id, opts = {}) ⇒ ResponseWrapperPurchaseOrder

BETA

Find purchase order by ID.

Parameters:

  • id

    Element ID

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

    the optional parameters

Options Hash (opts):

  • :fields (String)

    Fields filter pattern

Returns:



126
127
128
129
# File 'lib/tripletex_ruby_client/api/purchase_order_api.rb', line 126

def get(id, opts = {})
  data, _status_code, _headers = get_with_http_info(id, opts)
  data
end

#get_with_http_info(id, opts = {}) ⇒ Array<(ResponseWrapperPurchaseOrder, Fixnum, Hash)>

BETA

Find purchase order by ID.

Parameters:

  • id

    Element ID

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

    the optional parameters

Options Hash (opts):

  • :fields (String)

    Fields filter pattern

Returns:



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
# File 'lib/tripletex_ruby_client/api/purchase_order_api.rb', line 137

def get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PurchaseOrderApi.get ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling PurchaseOrderApi.get"
  end
  # resource path
  local_var_path = '/purchaseOrder/{id}'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}
  query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?

  # header parameters
  header_params = {}

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['tokenAuthScheme']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ResponseWrapperPurchaseOrder')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PurchaseOrderApi#get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#post(opts = {}) ⇒ ResponseWrapperPurchaseOrder

BETA

Creates a new purchase order

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :body (PurchaseOrder)

    JSON representing the new object to be created. Should not have ID and version set.

Returns:



178
179
180
181
# File 'lib/tripletex_ruby_client/api/purchase_order_api.rb', line 178

def post(opts = {})
  data, _status_code, _headers = post_with_http_info(opts)
  data
end

#post_with_http_info(opts = {}) ⇒ Array<(ResponseWrapperPurchaseOrder, Fixnum, Hash)>

BETA

Creates a new purchase order

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :body (PurchaseOrder)

    JSON representing the new object to be created. Should not have ID and version set.

Returns:



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
# File 'lib/tripletex_ruby_client/api/purchase_order_api.rb', line 188

def post_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PurchaseOrderApi.post ...'
  end
  # resource path
  local_var_path = '/purchaseOrder'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=utf-8'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(opts[:'body'])
  auth_names = ['tokenAuthScheme']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ResponseWrapperPurchaseOrder')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PurchaseOrderApi#post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#put(id, opts = {}) ⇒ ResponseWrapperPurchaseOrder

BETA

Update purchase order.

Parameters:

  • id

    Element ID

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

    the optional parameters

Options Hash (opts):

  • :body (PurchaseOrder)

    Partial object describing what should be updated

Returns:



227
228
229
230
# File 'lib/tripletex_ruby_client/api/purchase_order_api.rb', line 227

def put(id, opts = {})
  data, _status_code, _headers = put_with_http_info(id, opts)
  data
end

#put_with_http_info(id, opts = {}) ⇒ Array<(ResponseWrapperPurchaseOrder, Fixnum, Hash)>

BETA

Update purchase order.

Parameters:

  • id

    Element ID

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

    the optional parameters

Options Hash (opts):

  • :body (PurchaseOrder)

    Partial object describing what should be updated

Returns:



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
# File 'lib/tripletex_ruby_client/api/purchase_order_api.rb', line 238

def put_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PurchaseOrderApi.put ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling PurchaseOrderApi.put"
  end
  # resource path
  local_var_path = '/purchaseOrder/{id}'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=utf-8'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(opts[:'body'])
  auth_names = ['tokenAuthScheme']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ResponseWrapperPurchaseOrder')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PurchaseOrderApi#put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#search(opts = {}) ⇒ ListResponsePurchaseOrder

BETA

Find purchase orders with send data

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :number (String)

    Equals

  • :delivery_date_from (String)

    Format is yyyy-MM-dd (from and incl.).

  • :delivery_date_to (String)

    Format is yyyy-MM-dd (to and incl.).

  • :creation_date_from (String)

    Format is yyyy-MM-dd (from and incl.).

  • :creation_date_to (String)

    Format is yyyy-MM-dd (to and incl.).

  • :id (String)

    List of IDs

  • :supplier_id (String)

    List of IDs

  • :project_id (String)

    List of IDs

  • :is_closed (BOOLEAN)

    Equals

  • :with_deviation_only (BOOLEAN)

    Equals (default to false)

  • :from (Integer)

    From index (default to 0)

  • :count (Integer)

    Number of elements to return (default to 1000)

  • :sorting (String)

    Sorting pattern

  • :fields (String)

    Fields filter pattern

Returns:



293
294
295
296
# File 'lib/tripletex_ruby_client/api/purchase_order_api.rb', line 293

def search(opts = {})
  data, _status_code, _headers = search_with_http_info(opts)
  data
end

#search_with_http_info(opts = {}) ⇒ Array<(ListResponsePurchaseOrder, Fixnum, Hash)>

BETA

Find purchase orders with send data

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :number (String)

    Equals

  • :delivery_date_from (String)

    Format is yyyy-MM-dd (from and incl.).

  • :delivery_date_to (String)

    Format is yyyy-MM-dd (to and incl.).

  • :creation_date_from (String)

    Format is yyyy-MM-dd (from and incl.).

  • :creation_date_to (String)

    Format is yyyy-MM-dd (to and incl.).

  • :id (String)

    List of IDs

  • :supplier_id (String)

    List of IDs

  • :project_id (String)

    List of IDs

  • :is_closed (BOOLEAN)

    Equals

  • :with_deviation_only (BOOLEAN)

    Equals

  • :from (Integer)

    From index

  • :count (Integer)

    Number of elements to return

  • :sorting (String)

    Sorting pattern

  • :fields (String)

    Fields filter pattern

Returns:

  • (Array<(ListResponsePurchaseOrder, Fixnum, Hash)>)

    ListResponsePurchaseOrder data, response status code and response headers



316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
# File 'lib/tripletex_ruby_client/api/purchase_order_api.rb', line 316

def search_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PurchaseOrderApi.search ...'
  end
  # resource path
  local_var_path = '/purchaseOrder'

  # query parameters
  query_params = {}
  query_params[:'number'] = opts[:'number'] if !opts[:'number'].nil?
  query_params[:'deliveryDateFrom'] = opts[:'delivery_date_from'] if !opts[:'delivery_date_from'].nil?
  query_params[:'deliveryDateTo'] = opts[:'delivery_date_to'] if !opts[:'delivery_date_to'].nil?
  query_params[:'creationDateFrom'] = opts[:'creation_date_from'] if !opts[:'creation_date_from'].nil?
  query_params[:'creationDateTo'] = opts[:'creation_date_to'] if !opts[:'creation_date_to'].nil?
  query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?
  query_params[:'supplierId'] = opts[:'supplier_id'] if !opts[:'supplier_id'].nil?
  query_params[:'projectId'] = opts[:'project_id'] if !opts[:'project_id'].nil?
  query_params[:'isClosed'] = opts[:'is_closed'] if !opts[:'is_closed'].nil?
  query_params[:'withDeviationOnly'] = opts[:'with_deviation_only'] if !opts[:'with_deviation_only'].nil?
  query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
  query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?
  query_params[:'sorting'] = opts[:'sorting'] if !opts[:'sorting'].nil?
  query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?

  # header parameters
  header_params = {}

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['tokenAuthScheme']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ListResponsePurchaseOrder')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PurchaseOrderApi#search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send(id, opts = {}) ⇒ ResponseWrapperPurchaseOrder

BETA

Send purchase order by id and sendType.

Parameters:

  • id

    Element ID

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

    the optional parameters

Options Hash (opts):

  • :send_type (String)

    Send type.DEFAULT will determine the send parameter based on the supplier type.If supplier is not wholesaler, receiverEmail from the PO will be used if it&#39;s specified.If receiverEmail empty it will take the vendor email. (default to DEFAULT)

Returns:



367
368
369
370
# File 'lib/tripletex_ruby_client/api/purchase_order_api.rb', line 367

def send(id, opts = {})
  data, _status_code, _headers = send_with_http_info(id, opts)
  data
end

#send_by_email(id, email_address, subject, opts = {}) ⇒ ResponseWrapperPurchaseOrder

BETA

Send purchase order by customisable email.

Parameters:

  • id

    Element ID

  • email_address

    Email address

  • subject

    Subject

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

    the optional parameters

Options Hash (opts):

  • :message (String)

    Message

Returns:



425
426
427
428
# File 'lib/tripletex_ruby_client/api/purchase_order_api.rb', line 425

def send_by_email(id, email_address, subject, opts = {})
  data, _status_code, _headers = send_by_email_with_http_info(id, email_address, subject, opts)
  data
end

#send_by_email_with_http_info(id, email_address, subject, opts = {}) ⇒ Array<(ResponseWrapperPurchaseOrder, Fixnum, Hash)>

BETA

Send purchase order by customisable email.

Parameters:

  • id

    Element ID

  • email_address

    Email address

  • subject

    Subject

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

    the optional parameters

Options Hash (opts):

  • :message (String)

    Message

Returns:



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
477
478
479
480
481
482
483
# File 'lib/tripletex_ruby_client/api/purchase_order_api.rb', line 438

def send_by_email_with_http_info(id, email_address, subject, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PurchaseOrderApi.send_by_email ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling PurchaseOrderApi.send_by_email"
  end
  # verify the required parameter 'email_address' is set
  if @api_client.config.client_side_validation && email_address.nil?
    fail ArgumentError, "Missing the required parameter 'email_address' when calling PurchaseOrderApi.send_by_email"
  end
  # verify the required parameter 'subject' is set
  if @api_client.config.client_side_validation && subject.nil?
    fail ArgumentError, "Missing the required parameter 'subject' when calling PurchaseOrderApi.send_by_email"
  end
  # resource path
  local_var_path = '/purchaseOrder/{id}/:sendByEmail'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}
  query_params[:'emailAddress'] = email_address
  query_params[:'subject'] = subject
  query_params[:'message'] = opts[:'message'] if !opts[:'message'].nil?

  # header parameters
  header_params = {}

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['tokenAuthScheme']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ResponseWrapperPurchaseOrder')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PurchaseOrderApi#send_by_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_with_http_info(id, opts = {}) ⇒ Array<(ResponseWrapperPurchaseOrder, Fixnum, Hash)>

BETA

Send purchase order by id and sendType.

Parameters:

  • id

    Element ID

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

    the optional parameters

Options Hash (opts):

  • :send_type (String)

    Send type.DEFAULT will determine the send parameter based on the supplier type.If supplier is not wholesaler, receiverEmail from the PO will be used if it&#39;s specified.If receiverEmail empty it will take the vendor email.

Returns:



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
404
405
406
407
408
409
410
411
412
413
414
415
416
# File 'lib/tripletex_ruby_client/api/purchase_order_api.rb', line 378

def send_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PurchaseOrderApi.send ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling PurchaseOrderApi.send"
  end
  if @api_client.config.client_side_validation && opts[:'send_type'] && !['DEFAULT', 'EMAIL', 'FTP'].include?(opts[:'send_type'])
    fail ArgumentError, 'invalid value for "send_type", must be one of DEFAULT, EMAIL, FTP'
  end
  # resource path
  local_var_path = '/purchaseOrder/{id}/:send'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}
  query_params[:'sendType'] = opts[:'send_type'] if !opts[:'send_type'].nil?

  # header parameters
  header_params = {}

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['tokenAuthScheme']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ResponseWrapperPurchaseOrder')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PurchaseOrderApi#send\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#upload_attachment(id, file, opts = {}) ⇒ ResponseWrapperPurchaseOrder

BETA

Upload attachment to Purchase Order.

Parameters:

  • id

    Purchase Order ID to upload attachment to.

  • file

    The file

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

    the optional parameters

Options Hash (opts):

  • :fields (String)

    Fields filter pattern (default to *)

Returns:



491
492
493
494
# File 'lib/tripletex_ruby_client/api/purchase_order_api.rb', line 491

def upload_attachment(id, file, opts = {})
  data, _status_code, _headers = upload_attachment_with_http_info(id, file, opts)
  data
end

#upload_attachment_with_http_info(id, file, opts = {}) ⇒ Array<(ResponseWrapperPurchaseOrder, Fixnum, Hash)>

BETA

Upload attachment to Purchase Order.

Parameters:

  • id

    Purchase Order ID to upload attachment to.

  • file

    The file

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

    the optional parameters

Options Hash (opts):

  • :fields (String)

    Fields filter pattern

Returns:



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
# File 'lib/tripletex_ruby_client/api/purchase_order_api.rb', line 503

def upload_attachment_with_http_info(id, file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PurchaseOrderApi.upload_attachment ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling PurchaseOrderApi.upload_attachment"
  end
  # verify the required parameter 'file' is set
  if @api_client.config.client_side_validation && file.nil?
    fail ArgumentError, "Missing the required parameter 'file' when calling PurchaseOrderApi.upload_attachment"
  end
  # resource path
  local_var_path = '/purchaseOrder/{id}/attachment'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}
  query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])

  # form parameters
  form_params = {}
  form_params['file'] = file

  # http body (model)
  post_body = nil
  auth_names = ['tokenAuthScheme']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ResponseWrapperPurchaseOrder')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PurchaseOrderApi#upload_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#upload_attachments(id, body, opts = {}) ⇒ ResponseWrapperPurchaseOrder

Upload multiple attachments to Purchase Order.

Parameters:

  • id

    Purchase Order ID to upload attachment to.

  • body

    Multipart files

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

    the optional parameters

Returns:



552
553
554
555
# File 'lib/tripletex_ruby_client/api/purchase_order_api.rb', line 552

def upload_attachments(id, body, opts = {})
  data, _status_code, _headers = upload_attachments_with_http_info(id, body, opts)
  data
end

#upload_attachments_with_http_info(id, body, opts = {}) ⇒ Array<(ResponseWrapperPurchaseOrder, Fixnum, Hash)>

Upload multiple attachments to Purchase Order.

Parameters:

  • id

    Purchase Order ID to upload attachment to.

  • body

    Multipart files

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

    the optional parameters

Returns:



563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
# File 'lib/tripletex_ruby_client/api/purchase_order_api.rb', line 563

def upload_attachments_with_http_info(id, body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PurchaseOrderApi.upload_attachments ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling PurchaseOrderApi.upload_attachments"
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling PurchaseOrderApi.upload_attachments"
  end
  # resource path
  local_var_path = '/purchaseOrder/{id}/attachment/list'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(body)
  auth_names = ['tokenAuthScheme']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ResponseWrapperPurchaseOrder')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PurchaseOrderApi#upload_attachments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end