Class: TripletexRubyClient::SaftApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ SaftApi



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

def api_client
  @api_client
end

Instance Method Details

#export_saft(year, opts = {}) ⇒ String

BETA

Create SAF-T export for the Tripletex account.



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

def export_saft(year, opts = {})
  data, _status_code, _headers = export_saft_with_http_info(year, opts)
  data
end

#export_saft_with_http_info(year, opts = {}) ⇒ Array<(String, Fixnum, Hash)>

BETA

Create SAF-T export for the Tripletex account.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/tripletex_ruby_client/api/saft_api.rb', line 37

def export_saft_with_http_info(year, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SaftApi.export_saft ...'
  end
  # verify the required parameter 'year' is set
  if @api_client.config.client_side_validation && year.nil?
    fail ArgumentError, "Missing the required parameter 'year' when calling SaftApi.export_saft"
  end
  # resource path
  local_var_path = '/saft/exportSAFT'

  # query parameters
  query_params = {}
  query_params[:'year'] = year

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

#import_saft(saft_file, mapping_file, import_customer_vendors, create_missing_accounts, import_start_balance_from_opening, import_start_balance_from_closing, import_vouchers, import_departments, import_projects, tripletex_generates_customer_numbers, create_customer_ib, update_account_names, create_vendor_ib, override_voucher_date_on_discrepancy, overwrite_customers_contacts, only_active_customers, only_active_accounts, update_start_balance, opts = {}) ⇒ nil

BETA

Import SAF-T. Send XML file as multipart form.



97
98
99
100
# File 'lib/tripletex_ruby_client/api/saft_api.rb', line 97

def import_saft(saft_file, mapping_file, import_customer_vendors, create_missing_accounts, import_start_balance_from_opening, import_start_balance_from_closing, import_vouchers, import_departments, import_projects, tripletex_generates_customer_numbers, create_customer_ib, , create_vendor_ib, override_voucher_date_on_discrepancy, overwrite_customers_contacts, only_active_customers, only_active_accounts, update_start_balance, opts = {})
  import_saft_with_http_info(saft_file, mapping_file, import_customer_vendors, create_missing_accounts, import_start_balance_from_opening, import_start_balance_from_closing, import_vouchers, import_departments, import_projects, tripletex_generates_customer_numbers, create_customer_ib, , create_vendor_ib, override_voucher_date_on_discrepancy, overwrite_customers_contacts, only_active_customers, only_active_accounts, update_start_balance, opts)
  nil
end

#import_saft_with_http_info(saft_file, mapping_file, import_customer_vendors, create_missing_accounts, import_start_balance_from_opening, import_start_balance_from_closing, import_vouchers, import_departments, import_projects, tripletex_generates_customer_numbers, create_customer_ib, update_account_names, create_vendor_ib, override_voucher_date_on_discrepancy, overwrite_customers_contacts, only_active_customers, only_active_accounts, update_start_balance, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

BETA

Import SAF-T. Send XML file as multipart form.



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
174
175
176
177
178
179
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/tripletex_ruby_client/api/saft_api.rb', line 124

def import_saft_with_http_info(saft_file, mapping_file, import_customer_vendors, create_missing_accounts, import_start_balance_from_opening, import_start_balance_from_closing, import_vouchers, import_departments, import_projects, tripletex_generates_customer_numbers, create_customer_ib, , create_vendor_ib, override_voucher_date_on_discrepancy, overwrite_customers_contacts, only_active_customers, only_active_accounts, update_start_balance, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SaftApi.import_saft ...'
  end
  # verify the required parameter 'saft_file' is set
  if @api_client.config.client_side_validation && saft_file.nil?
    fail ArgumentError, "Missing the required parameter 'saft_file' when calling SaftApi.import_saft"
  end
  # verify the required parameter 'mapping_file' is set
  if @api_client.config.client_side_validation && mapping_file.nil?
    fail ArgumentError, "Missing the required parameter 'mapping_file' when calling SaftApi.import_saft"
  end
  # verify the required parameter 'import_customer_vendors' is set
  if @api_client.config.client_side_validation && import_customer_vendors.nil?
    fail ArgumentError, "Missing the required parameter 'import_customer_vendors' when calling SaftApi.import_saft"
  end
  # verify the required parameter 'create_missing_accounts' is set
  if @api_client.config.client_side_validation && create_missing_accounts.nil?
    fail ArgumentError, "Missing the required parameter 'create_missing_accounts' when calling SaftApi.import_saft"
  end
  # verify the required parameter 'import_start_balance_from_opening' is set
  if @api_client.config.client_side_validation && import_start_balance_from_opening.nil?
    fail ArgumentError, "Missing the required parameter 'import_start_balance_from_opening' when calling SaftApi.import_saft"
  end
  # verify the required parameter 'import_start_balance_from_closing' is set
  if @api_client.config.client_side_validation && import_start_balance_from_closing.nil?
    fail ArgumentError, "Missing the required parameter 'import_start_balance_from_closing' when calling SaftApi.import_saft"
  end
  # verify the required parameter 'import_vouchers' is set
  if @api_client.config.client_side_validation && import_vouchers.nil?
    fail ArgumentError, "Missing the required parameter 'import_vouchers' when calling SaftApi.import_saft"
  end
  # verify the required parameter 'import_departments' is set
  if @api_client.config.client_side_validation && import_departments.nil?
    fail ArgumentError, "Missing the required parameter 'import_departments' when calling SaftApi.import_saft"
  end
  # verify the required parameter 'import_projects' is set
  if @api_client.config.client_side_validation && import_projects.nil?
    fail ArgumentError, "Missing the required parameter 'import_projects' when calling SaftApi.import_saft"
  end
  # verify the required parameter 'tripletex_generates_customer_numbers' is set
  if @api_client.config.client_side_validation && tripletex_generates_customer_numbers.nil?
    fail ArgumentError, "Missing the required parameter 'tripletex_generates_customer_numbers' when calling SaftApi.import_saft"
  end
  # verify the required parameter 'create_customer_ib' is set
  if @api_client.config.client_side_validation && create_customer_ib.nil?
    fail ArgumentError, "Missing the required parameter 'create_customer_ib' when calling SaftApi.import_saft"
  end
  # verify the required parameter 'update_account_names' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'update_account_names' when calling SaftApi.import_saft"
  end
  # verify the required parameter 'create_vendor_ib' is set
  if @api_client.config.client_side_validation && create_vendor_ib.nil?
    fail ArgumentError, "Missing the required parameter 'create_vendor_ib' when calling SaftApi.import_saft"
  end
  # verify the required parameter 'override_voucher_date_on_discrepancy' is set
  if @api_client.config.client_side_validation && override_voucher_date_on_discrepancy.nil?
    fail ArgumentError, "Missing the required parameter 'override_voucher_date_on_discrepancy' when calling SaftApi.import_saft"
  end
  # verify the required parameter 'overwrite_customers_contacts' is set
  if @api_client.config.client_side_validation && overwrite_customers_contacts.nil?
    fail ArgumentError, "Missing the required parameter 'overwrite_customers_contacts' when calling SaftApi.import_saft"
  end
  # verify the required parameter 'only_active_customers' is set
  if @api_client.config.client_side_validation && only_active_customers.nil?
    fail ArgumentError, "Missing the required parameter 'only_active_customers' when calling SaftApi.import_saft"
  end
  # verify the required parameter 'only_active_accounts' is set
  if @api_client.config.client_side_validation && only_active_accounts.nil?
    fail ArgumentError, "Missing the required parameter 'only_active_accounts' when calling SaftApi.import_saft"
  end
  # verify the required parameter 'update_start_balance' is set
  if @api_client.config.client_side_validation && update_start_balance.nil?
    fail ArgumentError, "Missing the required parameter 'update_start_balance' when calling SaftApi.import_saft"
  end
  # resource path
  local_var_path = '/saft/importSAFT'

  # 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['saftFile'] = saft_file
  form_params['mappingFile'] = mapping_file
  form_params['importCustomerVendors'] = import_customer_vendors
  form_params['createMissingAccounts'] = create_missing_accounts
  form_params['importStartBalanceFromOpening'] = import_start_balance_from_opening
  form_params['importStartBalanceFromClosing'] = import_start_balance_from_closing
  form_params['importVouchers'] = import_vouchers
  form_params['importDepartments'] = import_departments
  form_params['importProjects'] = import_projects
  form_params['tripletexGeneratesCustomerNumbers'] = tripletex_generates_customer_numbers
  form_params['createCustomerIB'] = create_customer_ib
  form_params['updateAccountNames'] = 
  form_params['createVendorIB'] = create_vendor_ib
  form_params['overrideVoucherDateOnDiscrepancy'] = override_voucher_date_on_discrepancy
  form_params['overwriteCustomersContacts'] = overwrite_customers_contacts
  form_params['onlyActiveCustomers'] = only_active_customers
  form_params['onlyActiveAccounts'] = only_active_accounts
  form_params['updateStartBalance'] = update_start_balance

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