Class: TripletexRubyClient::InvoiceApi

Inherits:
Object
  • Object
show all
Defined in:
lib/tripletex_ruby_client/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_ruby_client/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_ruby_client/api/invoice_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

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

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:



30
31
32
33
# File 'lib/tripletex_ruby_client/api/invoice_api.rb', line 30

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

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

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



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/tripletex_ruby_client/api/invoice_api.rb', line 43

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

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)


96
97
98
99
# File 'lib/tripletex_ruby_client/api/invoice_api.rb', line 96

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

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

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



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
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/tripletex_ruby_client/api/invoice_api.rb', line 112

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)


177
178
179
180
# File 'lib/tripletex_ruby_client/api/invoice_api.rb', line 177

def download_pdf(invoice_id, opts = {})
  data, _status_code, _headers = download_pdf_with_http_info(invoice_id, opts)
  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



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

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:



230
231
232
233
# File 'lib/tripletex_ruby_client/api/invoice_api.rb', line 230

def get(id, opts = {})
  data, _status_code, _headers = get_with_http_info(id, opts)
  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



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/tripletex_ruby_client/api/invoice_api.rb', line 241

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 in the company currency, typically NOK.

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

    the optional parameters

Options Hash (opts):

  • :paid_amount_currency (Float)

    Amount paid by customer in the invoice currency. Optional, but required for invoices in alternate currencies.

Returns:



286
287
288
289
# File 'lib/tripletex_ruby_client/api/invoice_api.rb', line 286

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)
  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 in the company currency, typically NOK.

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

    the optional parameters

Options Hash (opts):

  • :paid_amount_currency (Float)

    Amount paid by customer in the invoice currency. Optional, but required for invoices in alternate currencies.

Returns:

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

    ResponseWrapperInvoice data, response status code and response headers



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
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
# File 'lib/tripletex_ruby_client/api/invoice_api.rb', line 300

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
  query_params[:'paidAmountCurrency'] = opts[:'paid_amount_currency'] if !opts[:'paid_amount_currency'].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#payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#post(opts = {}) ⇒ ResponseWrapperInvoice

Create invoice. Related Order and OrderLines can be created first, or included as new objects inside the 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:



359
360
361
362
# File 'lib/tripletex_ruby_client/api/invoice_api.rb', line 359

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

#post_list(opts = {}) ⇒ ListResponseInvoice

BETA

Create multiple invoices. Max 100 at a time.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :body (Array<Invoice>)

    JSON representing a list of new object to be created. Should not have ID and version set.

  • :send_to_customer (BOOLEAN)

    Equals (default to true)

  • :fields (String)

    Fields filter pattern (default to *)

Returns:



415
416
417
418
# File 'lib/tripletex_ruby_client/api/invoice_api.rb', line 415

def post_list(opts = {})
  data, _status_code, _headers = post_list_with_http_info(opts)
  data
end

#post_list_with_http_info(opts = {}) ⇒ Array<(ListResponseInvoice, Fixnum, Hash)>

BETA

Create multiple invoices. Max 100 at a time.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :body (Array<Invoice>)

    JSON representing a list of new object to be created. Should not have ID and version set.

  • :send_to_customer (BOOLEAN)

    Equals

  • :fields (String)

    Fields filter pattern

Returns:

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

    ListResponseInvoice data, response status code and response headers



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
460
461
# File 'lib/tripletex_ruby_client/api/invoice_api.rb', line 427

def post_list_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: InvoiceApi.post_list ...'
  end
  # resource path
  local_var_path = '/invoice/list'

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

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

Create invoice. Related Order and OrderLines can be created first, or included as new objects inside the 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



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
404
405
406
407
# File 'lib/tripletex_ruby_client/api/invoice_api.rb', line 372

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)

    List of IDs

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



477
478
479
480
# File 'lib/tripletex_ruby_client/api/invoice_api.rb', line 477

def search(invoice_date_from, invoice_date_to, opts = {})
  data, _status_code, _headers = search_with_http_info(invoice_date_from, invoice_date_to, opts)
  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)

    List of IDs

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



497
498
499
500
501
502
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
546
# File 'lib/tripletex_ruby_client/api/invoice_api.rb', line 497

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

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)


554
555
556
557
# File 'lib/tripletex_ruby_client/api/invoice_api.rb', line 554

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

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

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



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
604
605
606
607
608
609
# File 'lib/tripletex_ruby_client/api/invoice_api.rb', line 566

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', 'AVTALEGIRO', 'EFAKTURA', 'VIPPS', 'PAPER'].include?(send_type)
    fail ArgumentError, "invalid value for 'send_type', must be one of EMAIL, EHF, AVTALEGIRO, EFAKTURA, VIPPS, PAPER"
  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