Class: TripletexApi::InvoiceApi

Inherits:
Object
  • Object
show all
Defined in:
lib/tripletex_api/api/invoice_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ InvoiceApi

Returns a new instance of InvoiceApi.



19
20
21
# File 'lib/tripletex_api/api/invoice_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_api/api/invoice_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_credit_note(id, date, opts = {}) ⇒ ResponseWrapperInvoice

BETA

Creates a new Invoice representing a credit memo that nullifies the given invoice. Updates this invoice and any pre-existing inverse invoice.

Parameters:

  • id

    Invoice id

  • date

    Credit note date

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

    the optional parameters

Options Hash (opts):

  • :comment (String)

    Comment

  • :credit_note_email (String)

    The credit note will be sent electronically if this field is filled out

Returns:



31
32
33
34
# File 'lib/tripletex_api/api/invoice_api.rb', line 31

def create_credit_note(id, date, opts = {})
  data, _status_code, _headers = create_credit_note_with_http_info(id, date, opts)
  return data
end

#create_credit_note_with_http_info(id, date, opts = {}) ⇒ Array<(ResponseWrapperInvoice, Fixnum, Hash)>

BETA

Creates a new Invoice representing a credit memo that nullifies the given invoice. Updates this invoice and any pre-existing inverse invoice.

Parameters:

  • id

    Invoice id

  • date

    Credit note date

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

    the optional parameters

Options Hash (opts):

  • :comment (String)

    Comment

  • :credit_note_email (String)

    The credit note will be sent electronically if this field is filled out

Returns:

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

    ResponseWrapperInvoice data, response status code and response headers



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
# File 'lib/tripletex_api/api/invoice_api.rb', line 44

def create_credit_note_with_http_info(id, date, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: InvoiceApi.create_credit_note ..."
  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 InvoiceApi.create_credit_note"
  end
  # verify the required parameter 'date' is set
  if @api_client.config.client_side_validation && date.nil?
    fail ArgumentError, "Missing the required parameter 'date' when calling InvoiceApi.create_credit_note"
  end
  # resource path
  local_var_path = "/invoice/{id}/:createCreditNote".sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}
  query_params[:'date'] = date
  query_params[:'comment'] = opts[:'comment'] if !opts[:'comment'].nil?
  query_params[:'creditNoteEmail'] = opts[:'credit_note_email'] if !opts[:'credit_note_email'].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 => 'ResponseWrapperInvoice')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: InvoiceApi#create_credit_note\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_reminder(id, type, date, dispatch_type, opts = {}) ⇒ nil

BETA

Create invoice reminder and sends it by the given dispatch type. Supports the reminder types SOFT_REMINDER, REMINDER and NOTICE_OF_DEBT_COLLECTION. DispatchType NETS_PRINT must have type NOTICE_OF_DEBT_COLLECTION. SMS and NETS_PRINT must be activated prior to usage in the API.

Parameters:

  • id

    Element ID

  • type

    type

  • date

    yyyy-MM-dd. Defaults to today.

  • dispatch_type

    dispatchType

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

    the optional parameters

Options Hash (opts):

  • :include_charge (BOOLEAN)

    Equals (default to false)

  • :include_interest (BOOLEAN)

    Equals (default to false)

  • :sms_number (String)

    SMS number (must be a valid Norwegian telephone number)

Returns:

  • (nil)


98
99
100
101
# File 'lib/tripletex_api/api/invoice_api.rb', line 98

def create_reminder(id, type, date, dispatch_type, opts = {})
  create_reminder_with_http_info(id, type, date, dispatch_type, opts)
  return nil
end

#create_reminder_with_http_info(id, type, date, dispatch_type, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

BETA

Create invoice reminder and sends it by the given dispatch type. Supports the reminder types SOFT_REMINDER, REMINDER and NOTICE_OF_DEBT_COLLECTION. DispatchType NETS_PRINT must have type NOTICE_OF_DEBT_COLLECTION. SMS and NETS_PRINT must be activated prior to usage in the API.

Parameters:

  • id

    Element ID

  • type

    type

  • date

    yyyy-MM-dd. Defaults to today.

  • dispatch_type

    dispatchType

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

    the optional parameters

Options Hash (opts):

  • :include_charge (BOOLEAN)

    Equals

  • :include_interest (BOOLEAN)

    Equals

  • :sms_number (String)

    SMS number (must be a valid Norwegian telephone number)

Returns:

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

    nil, response status code and response headers



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
168
169
170
171
172
173
# File 'lib/tripletex_api/api/invoice_api.rb', line 114

def create_reminder_with_http_info(id, type, date, dispatch_type, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: InvoiceApi.create_reminder ..."
  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 InvoiceApi.create_reminder"
  end
  # verify the required parameter 'type' is set
  if @api_client.config.client_side_validation && type.nil?
    fail ArgumentError, "Missing the required parameter 'type' when calling InvoiceApi.create_reminder"
  end
  # verify enum value
  if @api_client.config.client_side_validation && !['SOFT_REMINDER', 'REMINDER', 'NOTICE_OF_DEBT_COLLECTION', 'DEBT_COLLECTION'].include?(type)
    fail ArgumentError, "invalid value for 'type', must be one of SOFT_REMINDER, REMINDER, NOTICE_OF_DEBT_COLLECTION, DEBT_COLLECTION"
  end
  # verify the required parameter 'date' is set
  if @api_client.config.client_side_validation && date.nil?
    fail ArgumentError, "Missing the required parameter 'date' when calling InvoiceApi.create_reminder"
  end
  # verify the required parameter 'dispatch_type' is set
  if @api_client.config.client_side_validation && dispatch_type.nil?
    fail ArgumentError, "Missing the required parameter 'dispatch_type' when calling InvoiceApi.create_reminder"
  end
  # verify enum value
  if @api_client.config.client_side_validation && !['NETS_PRINT', 'EMAIL', 'SMS'].include?(dispatch_type)
    fail ArgumentError, "invalid value for 'dispatch_type', must be one of NETS_PRINT, EMAIL, SMS"
  end
  # resource path
  local_var_path = "/invoice/{id}/:createReminder".sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}
  query_params[:'type'] = type
  query_params[:'date'] = date
  query_params[:'dispatchType'] = dispatch_type
  query_params[:'includeCharge'] = opts[:'include_charge'] if !opts[:'include_charge'].nil?
  query_params[:'includeInterest'] = opts[:'include_interest'] if !opts[:'include_interest'].nil?
  query_params[:'smsNumber'] = opts[:'sms_number'] if !opts[:'sms_number'].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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: InvoiceApi#create_reminder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#download_pdf(invoice_id, opts = {}) ⇒ String

Get invoice document by invoice ID.

Parameters:

  • invoice_id

    Invoice ID from which PDF is downloaded.

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

    the optional parameters

Returns:

  • (String)


180
181
182
183
# File 'lib/tripletex_api/api/invoice_api.rb', line 180

def download_pdf(invoice_id, opts = {})
  data, _status_code, _headers = download_pdf_with_http_info(invoice_id, opts)
  return data
end

#download_pdf_with_http_info(invoice_id, opts = {}) ⇒ Array<(String, Fixnum, Hash)>

Get invoice document by invoice ID.

Parameters:

  • invoice_id

    Invoice ID from which PDF is downloaded.

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

    the optional parameters

Returns:

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

    String data, response status code and response headers



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
# File 'lib/tripletex_api/api/invoice_api.rb', line 190

def download_pdf_with_http_info(invoice_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: InvoiceApi.download_pdf ..."
  end
  # verify the required parameter 'invoice_id' is set
  if @api_client.config.client_side_validation && invoice_id.nil?
    fail ArgumentError, "Missing the required parameter 'invoice_id' when calling InvoiceApi.download_pdf"
  end
  # resource path
  local_var_path = "/invoice/{invoiceId}/pdf".sub('{' + 'invoiceId' + '}', invoice_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])

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

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

Get invoice by ID.

Parameters:

  • id

    Element ID

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

    the optional parameters

Options Hash (opts):

  • :fields (String)

    Fields filter pattern

Returns:



234
235
236
237
# File 'lib/tripletex_api/api/invoice_api.rb', line 234

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

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

Get invoice by ID.

Parameters:

  • id

    Element ID

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

    the optional parameters

Options Hash (opts):

  • :fields (String)

    Fields filter pattern

Returns:

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

    ResponseWrapperInvoice data, response status code and response headers



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
277
278
279
280
# File 'lib/tripletex_api/api/invoice_api.rb', line 245

def get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: InvoiceApi.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 InvoiceApi.get"
  end
  # resource path
  local_var_path = "/invoice/{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 => 'ResponseWrapperInvoice')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: InvoiceApi#get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#payment(id, payment_date, payment_type_id, paid_amount, opts = {}) ⇒ ResponseWrapperInvoice

Update invoice. The invoice is updated with payment information. The amount is in the invoice’s currency.

Parameters:

  • id

    Invoice id

  • payment_date

    Payment date

  • payment_type_id

    PaymentType id

  • paid_amount

    Amount paid by customer

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

    the optional parameters

Returns:



290
291
292
293
# File 'lib/tripletex_api/api/invoice_api.rb', line 290

def payment(id, payment_date, payment_type_id, paid_amount, opts = {})
  data, _status_code, _headers = payment_with_http_info(id, payment_date, payment_type_id, paid_amount, opts)
  return data
end

#payment_with_http_info(id, payment_date, payment_type_id, paid_amount, opts = {}) ⇒ Array<(ResponseWrapperInvoice, Fixnum, Hash)>

Update invoice. The invoice is updated with payment information. The amount is in the invoice’s currency.

Parameters:

  • id

    Invoice id

  • payment_date

    Payment date

  • payment_type_id

    PaymentType id

  • paid_amount

    Amount paid by customer

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

    the optional parameters

Returns:

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

    ResponseWrapperInvoice data, response status code and response headers



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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
# File 'lib/tripletex_api/api/invoice_api.rb', line 303

def payment_with_http_info(id, payment_date, payment_type_id, paid_amount, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: InvoiceApi.payment ..."
  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 InvoiceApi.payment"
  end
  # verify the required parameter 'payment_date' is set
  if @api_client.config.client_side_validation && payment_date.nil?
    fail ArgumentError, "Missing the required parameter 'payment_date' when calling InvoiceApi.payment"
  end
  # verify the required parameter 'payment_type_id' is set
  if @api_client.config.client_side_validation && payment_type_id.nil?
    fail ArgumentError, "Missing the required parameter 'payment_type_id' when calling InvoiceApi.payment"
  end
  # verify the required parameter 'paid_amount' is set
  if @api_client.config.client_side_validation && paid_amount.nil?
    fail ArgumentError, "Missing the required parameter 'paid_amount' when calling InvoiceApi.payment"
  end
  # resource path
  local_var_path = "/invoice/{id}/:payment".sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}
  query_params[:'paymentDate'] = payment_date
  query_params[:'paymentTypeId'] = payment_type_id
  query_params[:'paidAmount'] = paid_amount

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

#post(opts = {}) ⇒ ResponseWrapperInvoice

Create invoice.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :body (Invoice)

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

  • :send_to_customer (BOOLEAN)

    Equals (default to true)

  • :payment_type_id (Integer)

    Payment type to register prepayment of the invoice. paymentTypeId and paidAmount are optional, but both must be provided if the invoice has already been paid.

  • :paid_amount (Float)

    Paid amount to register prepayment of the invoice, in invoice currency. paymentTypeId and paidAmount are optional, but both must be provided if the invoice has already been paid.

Returns:



362
363
364
365
# File 'lib/tripletex_api/api/invoice_api.rb', line 362

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

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

Create invoice.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :body (Invoice)

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

  • :send_to_customer (BOOLEAN)

    Equals

  • :payment_type_id (Integer)

    Payment type to register prepayment of the invoice. paymentTypeId and paidAmount are optional, but both must be provided if the invoice has already been paid.

  • :paid_amount (Float)

    Paid amount to register prepayment of the invoice, in invoice currency. paymentTypeId and paidAmount are optional, but both must be provided if the invoice has already been paid.

Returns:

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

    ResponseWrapperInvoice data, response status code and response headers



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
404
405
406
407
408
409
410
# File 'lib/tripletex_api/api/invoice_api.rb', line 375

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

  # query parameters
  query_params = {}
  query_params[:'sendToCustomer'] = opts[:'send_to_customer'] if !opts[:'send_to_customer'].nil?
  query_params[:'paymentTypeId'] = opts[:'payment_type_id'] if !opts[:'payment_type_id'].nil?
  query_params[:'paidAmount'] = opts[:'paid_amount'] if !opts[:'paid_amount'].nil?

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

#search(invoice_date_from, invoice_date_to, opts = {}) ⇒ ListResponseInvoice

Find invoices corresponding with sent data. Includes charged outgoing invoices only.

Parameters:

  • invoice_date_from

    From and including

  • invoice_date_to

    To and excluding

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

    the optional parameters

Options Hash (opts):

  • :id (String)

    List of IDs

  • :invoice_number (String)

    Equals

  • :kid (String)

    Equals

  • :voucher_id (String)

    Equals

  • :customer_id (String)

    Equals

  • :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:



427
428
429
430
# File 'lib/tripletex_api/api/invoice_api.rb', line 427

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

#search_with_http_info(invoice_date_from, invoice_date_to, opts = {}) ⇒ Array<(ListResponseInvoice, Fixnum, Hash)>

Find invoices corresponding with sent data. Includes charged outgoing invoices only.

Parameters:

  • invoice_date_from

    From and including

  • invoice_date_to

    To and excluding

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

    the optional parameters

Options Hash (opts):

  • :id (String)

    List of IDs

  • :invoice_number (String)

    Equals

  • :kid (String)

    Equals

  • :voucher_id (String)

    Equals

  • :customer_id (String)

    Equals

  • :from (Integer)

    From index

  • :count (Integer)

    Number of elements to return

  • :sorting (String)

    Sorting pattern

  • :fields (String)

    Fields filter pattern

Returns:

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

    ListResponseInvoice data, response status code and response headers



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
484
485
486
487
488
489
490
491
492
493
494
495
496
# File 'lib/tripletex_api/api/invoice_api.rb', line 447

def search_with_http_info(invoice_date_from, invoice_date_to, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: InvoiceApi.search ..."
  end
  # verify the required parameter 'invoice_date_from' is set
  if @api_client.config.client_side_validation && invoice_date_from.nil?
    fail ArgumentError, "Missing the required parameter 'invoice_date_from' when calling InvoiceApi.search"
  end
  # verify the required parameter 'invoice_date_to' is set
  if @api_client.config.client_side_validation && invoice_date_to.nil?
    fail ArgumentError, "Missing the required parameter 'invoice_date_to' when calling InvoiceApi.search"
  end
  # resource path
  local_var_path = "/invoice"

  # query parameters
  query_params = {}
  query_params[:'invoiceDateFrom'] = invoice_date_from
  query_params[:'invoiceDateTo'] = invoice_date_to
  query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?
  query_params[:'invoiceNumber'] = opts[:'invoice_number'] if !opts[:'invoice_number'].nil?
  query_params[:'kid'] = opts[:'kid'] if !opts[:'kid'].nil?
  query_params[:'voucherId'] = opts[:'voucher_id'] if !opts[:'voucher_id'].nil?
  query_params[:'customerId'] = opts[:'customer_id'] if !opts[:'customer_id'].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 => 'ListResponseInvoice')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: InvoiceApi#search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send(id, send_type, opts = {}) ⇒ nil

BETA

Send invoice by ID and sendType. Optionally override email recipient.

Parameters:

  • id

    Element ID

  • send_type

    SendType

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

    the optional parameters

Options Hash (opts):

  • :override_email_address (String)

    Will override email address if sendType &#x3D; EMAIL

Returns:

  • (nil)


505
506
507
508
# File 'lib/tripletex_api/api/invoice_api.rb', line 505

def send(id, send_type, opts = {})
  send_with_http_info(id, send_type, opts)
  return nil
end

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

BETA

Send invoice by ID and sendType. Optionally override email recipient.

Parameters:

  • id

    Element ID

  • send_type

    SendType

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

    the optional parameters

Options Hash (opts):

  • :override_email_address (String)

    Will override email address if sendType &#x3D; EMAIL

Returns:

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

    nil, response status code and response headers



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
552
553
554
555
556
557
558
559
560
# File 'lib/tripletex_api/api/invoice_api.rb', line 517

def send_with_http_info(id, send_type, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: InvoiceApi.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 InvoiceApi.send"
  end
  # verify the required parameter 'send_type' is set
  if @api_client.config.client_side_validation && send_type.nil?
    fail ArgumentError, "Missing the required parameter 'send_type' when calling InvoiceApi.send"
  end
  # verify enum value
  if @api_client.config.client_side_validation && !['EMAIL', 'EHF'].include?(send_type)
    fail ArgumentError, "invalid value for 'send_type', must be one of EMAIL, EHF"
  end
  # resource path
  local_var_path = "/invoice/{id}/:send".sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}
  query_params[:'sendType'] = send_type
  query_params[:'overrideEmailAddress'] = opts[:'override_email_address'] if !opts[:'override_email_address'].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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: InvoiceApi#send\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end