nordlet 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nordlet/account/client.rb +260 -0
  3. data/lib/nordlet/account/types/post_v1account_consent_accept_request.rb +13 -0
  4. data/lib/nordlet/account/types/post_v1account_consent_accept_response.rb +23 -0
  5. data/lib/nordlet/account/types/post_v1account_delete_request.rb +11 -0
  6. data/lib/nordlet/account/types/post_v1account_delete_response.rb +11 -0
  7. data/lib/nordlet/account/types/post_v1account_email_change_request_request.rb +13 -0
  8. data/lib/nordlet/account/types/post_v1account_email_change_request_request_locale.rb +15 -0
  9. data/lib/nordlet/account/types/post_v1account_email_change_request_response.rb +11 -0
  10. data/lib/nordlet/account/types/post_v1account_export_request.rb +9 -0
  11. data/lib/nordlet/account/types/post_v1account_export_response.rb +25 -0
  12. data/lib/nordlet/account/types/post_v1account_export_response_audit_entries_item.rb +21 -0
  13. data/lib/nordlet/account/types/post_v1account_export_response_billing.rb +19 -0
  14. data/lib/nordlet/account/types/post_v1account_export_response_consent.rb +23 -0
  15. data/lib/nordlet/account/types/post_v1account_export_response_credit_transactions_item.rb +21 -0
  16. data/lib/nordlet/account/types/post_v1account_export_response_memberships_item.rb +17 -0
  17. data/lib/nordlet/account/types/post_v1account_export_response_sessions_item.rb +19 -0
  18. data/lib/nordlet/account/types/post_v1account_export_response_user.rb +21 -0
  19. data/lib/nordlet/account/types/post_v1account_invites_accept_request.rb +4 -0
  20. data/lib/nordlet/account/types/post_v1account_login_link_request_request.rb +4 -0
  21. data/lib/nordlet/account/types/post_v1account_me_response.rb +2 -0
  22. data/lib/nordlet/account/types/post_v1account_me_response_consent.rb +23 -0
  23. data/lib/nordlet/account/types/post_v1account_profile_update_request.rb +11 -0
  24. data/lib/nordlet/account/types/post_v1account_profile_update_response.rb +15 -0
  25. data/lib/nordlet/account/types/post_v1account_sessions_list_request.rb +9 -0
  26. data/lib/nordlet/account/types/post_v1account_sessions_list_response.rb +11 -0
  27. data/lib/nordlet/account/types/post_v1account_sessions_list_response_rows_item.rb +19 -0
  28. data/lib/nordlet/account/types/post_v1account_sessions_revoke_others_request.rb +9 -0
  29. data/lib/nordlet/account/types/post_v1account_sessions_revoke_others_response.rb +11 -0
  30. data/lib/nordlet/account/types/post_v1account_sessions_revoke_request.rb +11 -0
  31. data/lib/nordlet/account/types/post_v1account_sessions_revoke_response.rb +11 -0
  32. data/lib/nordlet/client.rb +5 -0
  33. data/lib/nordlet/hr/client.rb +68 -0
  34. data/lib/nordlet/hr/types/post_v1hr_employees_anonymize_request.rb +11 -0
  35. data/lib/nordlet/hr/types/post_v1hr_employees_anonymize_response.rb +49 -0
  36. data/lib/nordlet/hr/types/post_v1hr_employees_anonymize_response_address.rb +17 -0
  37. data/lib/nordlet/hr/types/post_v1hr_employees_anonymize_response_status.rb +14 -0
  38. data/lib/nordlet/hr/types/post_v1hr_employees_delete_request.rb +11 -0
  39. data/lib/nordlet/hr/types/post_v1hr_employees_delete_response.rb +11 -0
  40. data/lib/nordlet/migration/client.rb +86 -0
  41. data/lib/nordlet/migration/types/post_v1migration_books_import_request.rb +33 -0
  42. data/lib/nordlet/migration/types/post_v1migration_books_import_request_accounts_item.rb +19 -0
  43. data/lib/nordlet/migration/types/post_v1migration_books_import_request_accounts_item_type.rb +17 -0
  44. data/lib/nordlet/migration/types/post_v1migration_books_import_request_asset_groups_item.rb +21 -0
  45. data/lib/nordlet/migration/types/post_v1migration_books_import_request_fixed_assets_item.rb +31 -0
  46. data/lib/nordlet/migration/types/post_v1migration_books_import_request_items_item.rb +27 -0
  47. data/lib/nordlet/migration/types/post_v1migration_books_import_request_items_item_type.rb +14 -0
  48. data/lib/nordlet/migration/types/post_v1migration_books_import_request_journal_item.rb +17 -0
  49. data/lib/nordlet/migration/types/post_v1migration_books_import_request_journal_item_entries_item.rb +17 -0
  50. data/lib/nordlet/migration/types/post_v1migration_books_import_request_open_payables_item.rb +29 -0
  51. data/lib/nordlet/migration/types/post_v1migration_books_import_request_open_receivables_item.rb +29 -0
  52. data/lib/nordlet/migration/types/post_v1migration_books_import_request_opening_balances.rb +15 -0
  53. data/lib/nordlet/migration/types/post_v1migration_books_import_request_opening_balances_entries_item.rb +17 -0
  54. data/lib/nordlet/migration/types/post_v1migration_books_import_request_partners_item.rb +31 -0
  55. data/lib/nordlet/migration/types/post_v1migration_books_import_request_partners_item_address.rb +17 -0
  56. data/lib/nordlet/migration/types/post_v1migration_books_import_request_partners_item_type.rb +14 -0
  57. data/lib/nordlet/migration/types/post_v1migration_books_import_request_stock_item.rb +21 -0
  58. data/lib/nordlet/migration/types/post_v1migration_books_import_response.rb +37 -0
  59. data/lib/nordlet/migration/types/post_v1migration_books_import_response_accounts.rb +13 -0
  60. data/lib/nordlet/migration/types/post_v1migration_books_import_response_asset_groups.rb +13 -0
  61. data/lib/nordlet/migration/types/post_v1migration_books_import_response_fixed_assets.rb +15 -0
  62. data/lib/nordlet/migration/types/post_v1migration_books_import_response_items.rb +13 -0
  63. data/lib/nordlet/migration/types/post_v1migration_books_import_response_journal.rb +13 -0
  64. data/lib/nordlet/migration/types/post_v1migration_books_import_response_number_series_item.rb +15 -0
  65. data/lib/nordlet/migration/types/post_v1migration_books_import_response_open_payables.rb +13 -0
  66. data/lib/nordlet/migration/types/post_v1migration_books_import_response_open_receivables.rb +13 -0
  67. data/lib/nordlet/migration/types/post_v1migration_books_import_response_opening_balances.rb +21 -0
  68. data/lib/nordlet/migration/types/post_v1migration_books_import_response_partners.rb +13 -0
  69. data/lib/nordlet/migration/types/post_v1migration_books_import_response_stock.rb +13 -0
  70. data/lib/nordlet/migration/types/post_v1migration_books_validate_request.rb +33 -0
  71. data/lib/nordlet/migration/types/post_v1migration_books_validate_request_accounts_item.rb +19 -0
  72. data/lib/nordlet/migration/types/post_v1migration_books_validate_request_accounts_item_type.rb +17 -0
  73. data/lib/nordlet/migration/types/post_v1migration_books_validate_request_asset_groups_item.rb +21 -0
  74. data/lib/nordlet/migration/types/post_v1migration_books_validate_request_fixed_assets_item.rb +31 -0
  75. data/lib/nordlet/migration/types/post_v1migration_books_validate_request_items_item.rb +27 -0
  76. data/lib/nordlet/migration/types/post_v1migration_books_validate_request_items_item_type.rb +14 -0
  77. data/lib/nordlet/migration/types/post_v1migration_books_validate_request_journal_item.rb +17 -0
  78. data/lib/nordlet/migration/types/post_v1migration_books_validate_request_journal_item_entries_item.rb +17 -0
  79. data/lib/nordlet/migration/types/post_v1migration_books_validate_request_open_payables_item.rb +29 -0
  80. data/lib/nordlet/migration/types/post_v1migration_books_validate_request_open_receivables_item.rb +29 -0
  81. data/lib/nordlet/migration/types/post_v1migration_books_validate_request_opening_balances.rb +15 -0
  82. data/lib/nordlet/migration/types/post_v1migration_books_validate_request_opening_balances_entries_item.rb +17 -0
  83. data/lib/nordlet/migration/types/post_v1migration_books_validate_request_partners_item.rb +31 -0
  84. data/lib/nordlet/migration/types/post_v1migration_books_validate_request_partners_item_address.rb +17 -0
  85. data/lib/nordlet/migration/types/post_v1migration_books_validate_request_partners_item_type.rb +14 -0
  86. data/lib/nordlet/migration/types/post_v1migration_books_validate_request_stock_item.rb +21 -0
  87. data/lib/nordlet/migration/types/post_v1migration_books_validate_response.rb +37 -0
  88. data/lib/nordlet/migration/types/post_v1migration_books_validate_response_accounts.rb +13 -0
  89. data/lib/nordlet/migration/types/post_v1migration_books_validate_response_asset_groups.rb +13 -0
  90. data/lib/nordlet/migration/types/post_v1migration_books_validate_response_fixed_assets.rb +15 -0
  91. data/lib/nordlet/migration/types/post_v1migration_books_validate_response_items.rb +13 -0
  92. data/lib/nordlet/migration/types/post_v1migration_books_validate_response_journal.rb +13 -0
  93. data/lib/nordlet/migration/types/post_v1migration_books_validate_response_number_series_item.rb +15 -0
  94. data/lib/nordlet/migration/types/post_v1migration_books_validate_response_open_payables.rb +13 -0
  95. data/lib/nordlet/migration/types/post_v1migration_books_validate_response_open_receivables.rb +13 -0
  96. data/lib/nordlet/migration/types/post_v1migration_books_validate_response_opening_balances.rb +21 -0
  97. data/lib/nordlet/migration/types/post_v1migration_books_validate_response_partners.rb +13 -0
  98. data/lib/nordlet/migration/types/post_v1migration_books_validate_response_stock.rb +13 -0
  99. data/lib/nordlet/partners/client.rb +36 -0
  100. data/lib/nordlet/partners/types/post_v1partners_anonymize_request.rb +11 -0
  101. data/lib/nordlet/partners/types/post_v1partners_anonymize_response.rb +13 -0
  102. data/lib/nordlet/version.rb +1 -1
  103. data/lib/nordlet.rb +93 -0
  104. data/reference.md +1208 -310
  105. metadata +95 -2
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Account
5
+ module Types
6
+ class PostV1AccountSessionsListRequest < Internal::Types::Model; end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Account
5
+ module Types
6
+ class PostV1AccountSessionsListResponse < Internal::Types::Model
7
+ field :rows, -> { Internal::Types::Array[Nordlet::Account::Types::PostV1AccountSessionsListResponseRowsItem] }, optional: false, nullable: false
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Account
5
+ module Types
6
+ class PostV1AccountSessionsListResponseRowsItem < Internal::Types::Model
7
+ field :id, -> { String }, optional: false, nullable: false
8
+
9
+ field :company_id, -> { String }, optional: false, nullable: true, api_name: "companyId"
10
+
11
+ field :created_at, -> { String }, optional: false, nullable: false, api_name: "createdAt"
12
+
13
+ field :expires_at, -> { String }, optional: false, nullable: false, api_name: "expiresAt"
14
+
15
+ field :current, -> { Internal::Types::Boolean }, optional: false, nullable: false
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Account
5
+ module Types
6
+ class PostV1AccountSessionsRevokeOthersRequest < Internal::Types::Model; end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Account
5
+ module Types
6
+ class PostV1AccountSessionsRevokeOthersResponse < Internal::Types::Model
7
+ field :revoked, -> { Integer }, optional: false, nullable: false
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Account
5
+ module Types
6
+ class PostV1AccountSessionsRevokeRequest < Internal::Types::Model
7
+ field :id, -> { String }, optional: false, nullable: false
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Account
5
+ module Types
6
+ class PostV1AccountSessionsRevokeResponse < Internal::Types::Model
7
+ field :revoked, -> { Internal::Types::Boolean }, optional: false, nullable: false
8
+ end
9
+ end
10
+ end
11
+ end
@@ -58,6 +58,11 @@ module Nordlet
58
58
  @ledger ||= Nordlet::Ledger::Client.new(client: @raw_client)
59
59
  end
60
60
 
61
+ # @return [Nordlet::Migration::Client]
62
+ def migration
63
+ @migration ||= Nordlet::Migration::Client.new(client: @raw_client)
64
+ end
65
+
61
66
  # @return [Nordlet::Assets::Client]
62
67
  def assets
63
68
  @assets ||= Nordlet::Assets::Client.new(client: @raw_client)
@@ -234,6 +234,74 @@ module Nordlet
234
234
  end
235
235
  end
236
236
 
237
+ # @param request_options [Hash]
238
+ # @param params [Nordlet::Hr::Types::PostV1HrEmployeesDeleteRequest]
239
+ # @option request_options [String] :base_url
240
+ # @option request_options [Hash{String => Object}] :additional_headers
241
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
242
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
243
+ # @option request_options [Integer] :timeout_in_seconds
244
+ #
245
+ # @return [Nordlet::Hr::Types::PostV1HrEmployeesDeleteResponse]
246
+ def post_v1hr_employees_delete(request_options: {}, **params)
247
+ params = Nordlet::Internal::Types::Utils.normalize_keys(params)
248
+ request = Nordlet::Internal::JSON::Request.new(
249
+ base_url: request_options[:base_url],
250
+ method: "POST",
251
+ path: "v1/hr/employees/delete",
252
+ body: Nordlet::Hr::Types::PostV1HrEmployeesDeleteRequest.new(params).to_h,
253
+ request_options: request_options
254
+ )
255
+ begin
256
+ response = @client.send(request)
257
+ rescue Net::HTTPRequestTimeout
258
+ raise Nordlet::Errors::TimeoutError
259
+ end
260
+ code = response.code.to_i
261
+ if code.between?(200, 299)
262
+ Nordlet::Hr::Types::PostV1HrEmployeesDeleteResponse.load(response.body)
263
+ else
264
+ error_class = Nordlet::Errors::ResponseError.subclass_for_code(code)
265
+ raise error_class.new(response.body, code: code)
266
+ end
267
+ end
268
+
269
+ # Replaces the name with a placeholder and removes personal code, birth date, contact details, address, bank
270
+ # account, social-insurance number, notes and sick-leave reasons. Payroll and contract rows stay linked to the
271
+ # record for the statutory retention period.
272
+ #
273
+ # @param request_options [Hash]
274
+ # @param params [Nordlet::Hr::Types::PostV1HrEmployeesAnonymizeRequest]
275
+ # @option request_options [String] :base_url
276
+ # @option request_options [Hash{String => Object}] :additional_headers
277
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
278
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
279
+ # @option request_options [Integer] :timeout_in_seconds
280
+ #
281
+ # @return [Nordlet::Hr::Types::PostV1HrEmployeesAnonymizeResponse]
282
+ def blank_an_employees_personal_data_and_hide_the_record(request_options: {}, **params)
283
+ params = Nordlet::Internal::Types::Utils.normalize_keys(params)
284
+ request = Nordlet::Internal::JSON::Request.new(
285
+ base_url: request_options[:base_url],
286
+ method: "POST",
287
+ path: "v1/hr/employees/anonymize",
288
+ body: Nordlet::Hr::Types::PostV1HrEmployeesAnonymizeRequest.new(params).to_h,
289
+ request_options: request_options
290
+ )
291
+ begin
292
+ response = @client.send(request)
293
+ rescue Net::HTTPRequestTimeout
294
+ raise Nordlet::Errors::TimeoutError
295
+ end
296
+ code = response.code.to_i
297
+ if code.between?(200, 299)
298
+ Nordlet::Hr::Types::PostV1HrEmployeesAnonymizeResponse.load(response.body)
299
+ else
300
+ error_class = Nordlet::Errors::ResponseError.subclass_for_code(code)
301
+ raise error_class.new(response.body, code: code)
302
+ end
303
+ end
304
+
237
305
  # @param request_options [Hash]
238
306
  # @param params [Nordlet::Hr::Types::PostV1HrContractsCreateRequest]
239
307
  # @option request_options [String] :base_url
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Hr
5
+ module Types
6
+ class PostV1HrEmployeesAnonymizeRequest < Internal::Types::Model
7
+ field :id, -> { String }, optional: false, nullable: false
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Hr
5
+ module Types
6
+ class PostV1HrEmployeesAnonymizeResponse < Internal::Types::Model
7
+ field :id, -> { String }, optional: false, nullable: false
8
+
9
+ field :code, -> { String }, optional: false, nullable: true
10
+
11
+ field :first_name, -> { String }, optional: false, nullable: false, api_name: "firstName"
12
+
13
+ field :last_name, -> { String }, optional: false, nullable: false, api_name: "lastName"
14
+
15
+ field :personal_code, -> { String }, optional: false, nullable: true, api_name: "personalCode"
16
+
17
+ field :birth_date, -> { String }, optional: false, nullable: true, api_name: "birthDate"
18
+
19
+ field :email, -> { String }, optional: false, nullable: true
20
+
21
+ field :phone, -> { String }, optional: false, nullable: true
22
+
23
+ field :address, -> { Nordlet::Hr::Types::PostV1HrEmployeesAnonymizeResponseAddress }, optional: false, nullable: true
24
+
25
+ field :iban, -> { String }, optional: false, nullable: true
26
+
27
+ field :social_insurance_no, -> { String }, optional: false, nullable: true, api_name: "socialInsuranceNo"
28
+
29
+ field :social_insurance_start, -> { String }, optional: false, nullable: true, api_name: "socialInsuranceStart"
30
+
31
+ field :hire_date, -> { String }, optional: false, nullable: true, api_name: "hireDate"
32
+
33
+ field :termination_date, -> { String }, optional: false, nullable: true, api_name: "terminationDate"
34
+
35
+ field :apply_npd, -> { Internal::Types::Boolean }, optional: false, nullable: false, api_name: "applyNpd"
36
+
37
+ field :npd_override, -> { String }, optional: false, nullable: true, api_name: "npdOverride"
38
+
39
+ field :pension_accumulation, -> { Internal::Types::Boolean }, optional: false, nullable: false, api_name: "pensionAccumulation"
40
+
41
+ field :status, -> { Nordlet::Hr::Types::PostV1HrEmployeesAnonymizeResponseStatus }, optional: false, nullable: false
42
+
43
+ field :notes, -> { String }, optional: false, nullable: true
44
+
45
+ field :created_at, -> { String }, optional: false, nullable: false, api_name: "createdAt"
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Hr
5
+ module Types
6
+ class PostV1HrEmployeesAnonymizeResponseAddress < Internal::Types::Model
7
+ field :street, -> { String }, optional: true, nullable: false
8
+
9
+ field :city, -> { String }, optional: true, nullable: false
10
+
11
+ field :postal_code, -> { String }, optional: true, nullable: false, api_name: "postalCode"
12
+
13
+ field :country_code, -> { String }, optional: true, nullable: false, api_name: "countryCode"
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Hr
5
+ module Types
6
+ module PostV1HrEmployeesAnonymizeResponseStatus
7
+ extend Nordlet::Internal::Types::Enum
8
+
9
+ ACTIVE = "active"
10
+ TERMINATED = "terminated"
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Hr
5
+ module Types
6
+ class PostV1HrEmployeesDeleteRequest < Internal::Types::Model
7
+ field :id, -> { String }, optional: false, nullable: false
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Hr
5
+ module Types
6
+ class PostV1HrEmployeesDeleteResponse < Internal::Types::Model
7
+ field :id, -> { String }, optional: false, nullable: false
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,86 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Migration
5
+ class Client
6
+ # @param client [Nordlet::Internal::Http::RawClient]
7
+ #
8
+ # @return [void]
9
+ def initialize(client:)
10
+ @client = client
11
+ end
12
+
13
+ # Runs every check the import runs (accounts, partners, balances, open invoices, assets, stock) and returns the
14
+ # same summary and warnings, then rolls everything back. Nothing is stored.
15
+ #
16
+ # @param request_options [Hash]
17
+ # @param params [Nordlet::Migration::Types::PostV1MigrationBooksValidateRequest]
18
+ # @option request_options [String] :base_url
19
+ # @option request_options [Hash{String => Object}] :additional_headers
20
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
21
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
22
+ # @option request_options [Integer] :timeout_in_seconds
23
+ #
24
+ # @return [Nordlet::Migration::Types::PostV1MigrationBooksValidateResponse]
25
+ def check_a_historical_books_package_without_writing_anything(request_options: {}, **params)
26
+ params = Nordlet::Internal::Types::Utils.normalize_keys(params)
27
+ request = Nordlet::Internal::JSON::Request.new(
28
+ base_url: request_options[:base_url],
29
+ method: "POST",
30
+ path: "v1/migration/books/validate",
31
+ body: Nordlet::Migration::Types::PostV1MigrationBooksValidateRequest.new(params).to_h,
32
+ request_options: request_options
33
+ )
34
+ begin
35
+ response = @client.send(request)
36
+ rescue Net::HTTPRequestTimeout
37
+ raise Nordlet::Errors::TimeoutError
38
+ end
39
+ code = response.code.to_i
40
+ if code.between?(200, 299)
41
+ Nordlet::Migration::Types::PostV1MigrationBooksValidateResponse.load(response.body)
42
+ else
43
+ error_class = Nordlet::Errors::ResponseError.subclass_for_code(code)
44
+ raise error_class.new(response.body, code: code)
45
+ end
46
+ end
47
+
48
+ # Brings a company over from another system in one call: chart of accounts, partners, items, opening balances (or
49
+ # the full journal history), open customer and supplier invoices, fixed assets with their accumulated
50
+ # depreciation, and stock on hand. The whole package is written in one database transaction — if any row fails,
51
+ # nothing is stored.
52
+ #
53
+ # @param request_options [Hash]
54
+ # @param params [Nordlet::Migration::Types::PostV1MigrationBooksImportRequest]
55
+ # @option request_options [String] :base_url
56
+ # @option request_options [Hash{String => Object}] :additional_headers
57
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
58
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
59
+ # @option request_options [Integer] :timeout_in_seconds
60
+ #
61
+ # @return [Nordlet::Migration::Types::PostV1MigrationBooksImportResponse]
62
+ def import_historical_books_from_a_previous_accounting_system(request_options: {}, **params)
63
+ params = Nordlet::Internal::Types::Utils.normalize_keys(params)
64
+ request = Nordlet::Internal::JSON::Request.new(
65
+ base_url: request_options[:base_url],
66
+ method: "POST",
67
+ path: "v1/migration/books/import",
68
+ body: Nordlet::Migration::Types::PostV1MigrationBooksImportRequest.new(params).to_h,
69
+ request_options: request_options
70
+ )
71
+ begin
72
+ response = @client.send(request)
73
+ rescue Net::HTTPRequestTimeout
74
+ raise Nordlet::Errors::TimeoutError
75
+ end
76
+ code = response.code.to_i
77
+ if code.between?(200, 299)
78
+ Nordlet::Migration::Types::PostV1MigrationBooksImportResponse.load(response.body)
79
+ else
80
+ error_class = Nordlet::Errors::ResponseError.subclass_for_code(code)
81
+ raise error_class.new(response.body, code: code)
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Migration
5
+ module Types
6
+ class PostV1MigrationBooksImportRequest < Internal::Types::Model
7
+ field :cutover_date, -> { String }, optional: false, nullable: false, api_name: "cutoverDate"
8
+
9
+ field :source, -> { String }, optional: true, nullable: false
10
+
11
+ field :accounts, -> { Internal::Types::Array[Nordlet::Migration::Types::PostV1MigrationBooksImportRequestAccountsItem] }, optional: true, nullable: false
12
+
13
+ field :partners, -> { Internal::Types::Array[Nordlet::Migration::Types::PostV1MigrationBooksImportRequestPartnersItem] }, optional: true, nullable: false
14
+
15
+ field :items, -> { Internal::Types::Array[Nordlet::Migration::Types::PostV1MigrationBooksImportRequestItemsItem] }, optional: true, nullable: false
16
+
17
+ field :opening_balances, -> { Nordlet::Migration::Types::PostV1MigrationBooksImportRequestOpeningBalances }, optional: true, nullable: false, api_name: "openingBalances"
18
+
19
+ field :journal, -> { Internal::Types::Array[Nordlet::Migration::Types::PostV1MigrationBooksImportRequestJournalItem] }, optional: true, nullable: false
20
+
21
+ field :open_receivables, -> { Internal::Types::Array[Nordlet::Migration::Types::PostV1MigrationBooksImportRequestOpenReceivablesItem] }, optional: true, nullable: false, api_name: "openReceivables"
22
+
23
+ field :open_payables, -> { Internal::Types::Array[Nordlet::Migration::Types::PostV1MigrationBooksImportRequestOpenPayablesItem] }, optional: true, nullable: false, api_name: "openPayables"
24
+
25
+ field :asset_groups, -> { Internal::Types::Array[Nordlet::Migration::Types::PostV1MigrationBooksImportRequestAssetGroupsItem] }, optional: true, nullable: false, api_name: "assetGroups"
26
+
27
+ field :fixed_assets, -> { Internal::Types::Array[Nordlet::Migration::Types::PostV1MigrationBooksImportRequestFixedAssetsItem] }, optional: true, nullable: false, api_name: "fixedAssets"
28
+
29
+ field :stock, -> { Internal::Types::Array[Nordlet::Migration::Types::PostV1MigrationBooksImportRequestStockItem] }, optional: true, nullable: false
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Migration
5
+ module Types
6
+ class PostV1MigrationBooksImportRequestAccountsItem < Internal::Types::Model
7
+ field :code, -> { String }, optional: false, nullable: false
8
+
9
+ field :name, -> { String }, optional: false, nullable: false
10
+
11
+ field :type, -> { Nordlet::Migration::Types::PostV1MigrationBooksImportRequestAccountsItemType }, optional: false, nullable: false
12
+
13
+ field :parent_code, -> { String }, optional: true, nullable: false, api_name: "parentCode"
14
+
15
+ field :is_postable, -> { Internal::Types::Boolean }, optional: true, nullable: false, api_name: "isPostable"
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Migration
5
+ module Types
6
+ module PostV1MigrationBooksImportRequestAccountsItemType
7
+ extend Nordlet::Internal::Types::Enum
8
+
9
+ ASSET = "asset"
10
+ LIABILITY = "liability"
11
+ EQUITY = "equity"
12
+ INCOME = "income"
13
+ EXPENSE = "expense"
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Migration
5
+ module Types
6
+ class PostV1MigrationBooksImportRequestAssetGroupsItem < Internal::Types::Model
7
+ field :code, -> { String }, optional: false, nullable: false
8
+
9
+ field :name, -> { String }, optional: false, nullable: false
10
+
11
+ field :asset_account_code, -> { String }, optional: false, nullable: false, api_name: "assetAccountCode"
12
+
13
+ field :depreciation_account_code, -> { String }, optional: false, nullable: false, api_name: "depreciationAccountCode"
14
+
15
+ field :expense_account_code, -> { String }, optional: true, nullable: false, api_name: "expenseAccountCode"
16
+
17
+ field :default_useful_life_months, -> { Integer }, optional: true, nullable: false, api_name: "defaultUsefulLifeMonths"
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Migration
5
+ module Types
6
+ class PostV1MigrationBooksImportRequestFixedAssetsItem < Internal::Types::Model
7
+ field :group_code, -> { String }, optional: false, nullable: false, api_name: "groupCode"
8
+
9
+ field :code, -> { String }, optional: false, nullable: false
10
+
11
+ field :name, -> { String }, optional: false, nullable: false
12
+
13
+ field :acquisition_date, -> { String }, optional: false, nullable: false, api_name: "acquisitionDate"
14
+
15
+ field :depreciation_start_date, -> { String }, optional: true, nullable: false, api_name: "depreciationStartDate"
16
+
17
+ field :acquisition_cost, -> { String }, optional: false, nullable: false, api_name: "acquisitionCost"
18
+
19
+ field :salvage_value, -> { String }, optional: true, nullable: false, api_name: "salvageValue"
20
+
21
+ field :useful_life_months, -> { Integer }, optional: true, nullable: false, api_name: "usefulLifeMonths"
22
+
23
+ field :accumulated_depreciation, -> { String }, optional: true, nullable: false, api_name: "accumulatedDepreciation"
24
+
25
+ field :depreciated_months, -> { Integer }, optional: true, nullable: false, api_name: "depreciatedMonths"
26
+
27
+ field :notes, -> { String }, optional: true, nullable: false
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Migration
5
+ module Types
6
+ class PostV1MigrationBooksImportRequestItemsItem < Internal::Types::Model
7
+ field :code, -> { String }, optional: false, nullable: false
8
+
9
+ field :name, -> { String }, optional: false, nullable: false
10
+
11
+ field :type, -> { Nordlet::Migration::Types::PostV1MigrationBooksImportRequestItemsItemType }, optional: true, nullable: false
12
+
13
+ field :unit, -> { String }, optional: true, nullable: false
14
+
15
+ field :barcode, -> { String }, optional: true, nullable: false
16
+
17
+ field :vat_rate_percent, -> { String }, optional: true, nullable: false, api_name: "vatRatePercent"
18
+
19
+ field :sale_price_excl_vat, -> { String }, optional: true, nullable: false, api_name: "salePriceExclVat"
20
+
21
+ field :purchase_price_excl_vat, -> { String }, optional: true, nullable: false, api_name: "purchasePriceExclVat"
22
+
23
+ field :description, -> { String }, optional: true, nullable: false
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Migration
5
+ module Types
6
+ module PostV1MigrationBooksImportRequestItemsItemType
7
+ extend Nordlet::Internal::Types::Enum
8
+
9
+ PRODUCT = "product"
10
+ SERVICE = "service"
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Migration
5
+ module Types
6
+ class PostV1MigrationBooksImportRequestJournalItem < Internal::Types::Model
7
+ field :date, -> { String }, optional: false, nullable: false
8
+
9
+ field :description, -> { String }, optional: true, nullable: false
10
+
11
+ field :reference, -> { String }, optional: true, nullable: false
12
+
13
+ field :entries, -> { Internal::Types::Array[Nordlet::Migration::Types::PostV1MigrationBooksImportRequestJournalItemEntriesItem] }, optional: false, nullable: false
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Migration
5
+ module Types
6
+ class PostV1MigrationBooksImportRequestJournalItemEntriesItem < Internal::Types::Model
7
+ field :account_code, -> { String }, optional: false, nullable: false, api_name: "accountCode"
8
+
9
+ field :debit, -> { String }, optional: true, nullable: false
10
+
11
+ field :credit, -> { String }, optional: true, nullable: false
12
+
13
+ field :description, -> { String }, optional: true, nullable: false
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Migration
5
+ module Types
6
+ class PostV1MigrationBooksImportRequestOpenPayablesItem < Internal::Types::Model
7
+ field :partner_code, -> { String }, optional: false, nullable: false, api_name: "partnerCode"
8
+
9
+ field :due_date, -> { String }, optional: true, nullable: false, api_name: "dueDate"
10
+
11
+ field :currency, -> { String }, optional: true, nullable: false
12
+
13
+ field :gross_total, -> { String }, optional: false, nullable: false, api_name: "grossTotal"
14
+
15
+ field :vat_total, -> { String }, optional: true, nullable: false, api_name: "vatTotal"
16
+
17
+ field :outstanding, -> { String }, optional: true, nullable: false
18
+
19
+ field :fx_rate, -> { String }, optional: true, nullable: false, api_name: "fxRate"
20
+
21
+ field :notes, -> { String }, optional: true, nullable: false
22
+
23
+ field :document_number, -> { String }, optional: false, nullable: false, api_name: "documentNumber"
24
+
25
+ field :document_date, -> { String }, optional: false, nullable: false, api_name: "documentDate"
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nordlet
4
+ module Migration
5
+ module Types
6
+ class PostV1MigrationBooksImportRequestOpenReceivablesItem < Internal::Types::Model
7
+ field :partner_code, -> { String }, optional: false, nullable: false, api_name: "partnerCode"
8
+
9
+ field :due_date, -> { String }, optional: true, nullable: false, api_name: "dueDate"
10
+
11
+ field :currency, -> { String }, optional: true, nullable: false
12
+
13
+ field :gross_total, -> { String }, optional: false, nullable: false, api_name: "grossTotal"
14
+
15
+ field :vat_total, -> { String }, optional: true, nullable: false, api_name: "vatTotal"
16
+
17
+ field :outstanding, -> { String }, optional: true, nullable: false
18
+
19
+ field :fx_rate, -> { String }, optional: true, nullable: false, api_name: "fxRate"
20
+
21
+ field :notes, -> { String }, optional: true, nullable: false
22
+
23
+ field :number, -> { String }, optional: false, nullable: false
24
+
25
+ field :issue_date, -> { String }, optional: false, nullable: false, api_name: "issueDate"
26
+ end
27
+ end
28
+ end
29
+ end