Class: TripletexRubyClient::LedgervoucherhistoricalApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ LedgervoucherhistoricalApi

Returns a new instance of LedgervoucherhistoricalApi.



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

def api_client
  @api_client
end

Instance Method Details

#close_postings(opts = {}) ⇒ nil

BETA

Close postings.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :posting_ids (String)

    List of Posting IDs to close separated by comma. The postings should have the same customer, supplier or employee. The sum of amount for all postings MUST be 0.0, otherwise an exception will be thrown.

Returns:

  • (nil)


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

def close_postings(opts = {})
  close_postings_with_http_info(opts)
  nil
end

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

BETA

Close postings.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :posting_ids (String)

    List of Posting IDs to close separated by comma. The postings should have the same customer, supplier or employee. The sum of amount for all postings MUST be 0.0, otherwise an exception will be thrown.

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

def close_postings_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LedgervoucherhistoricalApi.close_postings ...'
  end
  # resource path
  local_var_path = '/ledger/voucher/historical/:closePostings'

  # query parameters
  query_params = {}
  query_params[:'postingIds'] = opts[:'posting_ids'] if !opts[:'posting_ids'].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: LedgervoucherhistoricalApi#close_postings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#post_employee(opts = {}) ⇒ ResponseWrapperEmployee

BETA

Create one employee, based on import from external system. Validation is less strict, ie. employee department isn’t required.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :body (Employee)

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

Returns:



73
74
75
76
# File 'lib/tripletex_ruby_client/api/ledgervoucherhistorical_api.rb', line 73

def post_employee(opts = {})
  data, _status_code, _headers = post_employee_with_http_info(opts)
  data
end

#post_employee_with_http_info(opts = {}) ⇒ Array<(ResponseWrapperEmployee, Fixnum, Hash)>

BETA

Create one employee, based on import from external system. Validation is less strict, ie. employee department isn&#39;t required.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :body (Employee)

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

Returns:

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

    ResponseWrapperEmployee data, response status code and response headers



83
84
85
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
# File 'lib/tripletex_ruby_client/api/ledgervoucherhistorical_api.rb', line 83

def post_employee_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LedgervoucherhistoricalApi.post_employee ...'
  end
  # resource path
  local_var_path = '/ledger/voucher/historical/employee'

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

#post_historical(opts = {}) ⇒ ListResponseHistoricalVoucher

BETA

API endpoint for creating historical vouchers. These are vouchers created outside Tripletex, and should be from closed accounting years. The intended usage is to get access to historical transcations in Tripletex. Also creates postings. All amount fields in postings will be used. VAT postings must be included, these are not generated automatically like they are for normal vouchers in Tripletex. Requires the \"All vouchers\" and \"Advanced Voucher\" permissions.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :body (Array<HistoricalVoucher>)

    List of vouchers and related postings to import. Max 500.

  • :comment (String)

    Import comment, include the name and version of the source system.

Returns:



122
123
124
125
# File 'lib/tripletex_ruby_client/api/ledgervoucherhistorical_api.rb', line 122

def post_historical(opts = {})
  data, _status_code, _headers = post_historical_with_http_info(opts)
  data
end

#post_historical_with_http_info(opts = {}) ⇒ Array<(ListResponseHistoricalVoucher, Fixnum, Hash)>

BETA

API endpoint for creating historical vouchers. These are vouchers created outside Tripletex, and should be from closed accounting years. The intended usage is to get access to historical transcations in Tripletex. Also creates postings. All amount fields in postings will be used. VAT postings must be included, these are not generated automatically like they are for normal vouchers in Tripletex. Requires the \&quot;All vouchers\&quot; and \&quot;Advanced Voucher\&quot; permissions.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :body (Array<HistoricalVoucher>)

    List of vouchers and related postings to import. Max 500.

  • :comment (String)

    Import comment, include the name and version of the source system.

Returns:



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

def post_historical_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LedgervoucherhistoricalApi.post_historical ...'
  end
  # resource path
  local_var_path = '/ledger/voucher/historical/historical'

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

#reverse_historical_vouchers(opts = {}) ⇒ nil

BETA

Deletes all historical vouchers. Requires the "All vouchers" and "Advanced Voucher" permissions.

Parameters:

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

    the optional parameters

Returns:

  • (nil)


171
172
173
174
# File 'lib/tripletex_ruby_client/api/ledgervoucherhistorical_api.rb', line 171

def reverse_historical_vouchers(opts = {})
  reverse_historical_vouchers_with_http_info(opts)
  nil
end

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

BETA

Deletes all historical vouchers. Requires the &quot;All vouchers&quot; and &quot;Advanced Voucher&quot; permissions.

Parameters:

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/tripletex_ruby_client/api/ledgervoucherhistorical_api.rb', line 180

def reverse_historical_vouchers_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LedgervoucherhistoricalApi.reverse_historical_vouchers ...'
  end
  # resource path
  local_var_path = '/ledger/voucher/historical/:reverseHistoricalVouchers'

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

#upload_attachment(voucher_id, file, opts = {}) ⇒ nil

Upload attachment to voucher. If the voucher already has an attachment the content will be appended to the existing attachment as new PDF page(s). Valid document formats are PDF, PNG, JPEG and TIFF. Non PDF formats will be converted to PDF. Send as multipart form.

Parameters:

  • voucher_id

    Voucher ID to upload attachment to.

  • file

    The file

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

    the optional parameters

Returns:

  • (nil)


216
217
218
219
# File 'lib/tripletex_ruby_client/api/ledgervoucherhistorical_api.rb', line 216

def upload_attachment(voucher_id, file, opts = {})
  upload_attachment_with_http_info(voucher_id, file, opts)
  nil
end

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

Upload attachment to voucher. If the voucher already has an attachment the content will be appended to the existing attachment as new PDF page(s). Valid document formats are PDF, PNG, JPEG and TIFF. Non PDF formats will be converted to PDF. Send as multipart form.

Parameters:

  • voucher_id

    Voucher ID to upload attachment to.

  • file

    The file

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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

def upload_attachment_with_http_info(voucher_id, file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LedgervoucherhistoricalApi.upload_attachment ...'
  end
  # verify the required parameter 'voucher_id' is set
  if @api_client.config.client_side_validation && voucher_id.nil?
    fail ArgumentError, "Missing the required parameter 'voucher_id' when calling LedgervoucherhistoricalApi.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 LedgervoucherhistoricalApi.upload_attachment"
  end
  # resource path
  local_var_path = '/ledger/voucher/historical/{voucherId}/attachment'.sub('{' + 'voucherId' + '}', voucher_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 = {}
  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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LedgervoucherhistoricalApi#upload_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end