Class: Nordlet::Migration::Client
- Inherits:
-
Object
- Object
- Nordlet::Migration::Client
- Defined in:
- lib/nordlet/migration/client.rb
Instance Method Summary collapse
-
#check_a_historical_books_package_without_writing_anything(request_options: {}, **params) ⇒ Nordlet::Migration::Types::PostV1MigrationBooksValidateResponse
Runs every check the import runs (accounts, partners, balances, open invoices, assets, stock) and returns the same summary and warnings, then rolls everything back.
-
#import_historical_books_from_a_previous_accounting_system(request_options: {}, **params) ⇒ Nordlet::Migration::Types::PostV1MigrationBooksImportResponse
Brings a company over from another system in one call: chart of accounts, partners, items, opening balances (or the full journal history), open customer and supplier invoices, fixed assets with their accumulated depreciation, and stock on hand.
- #initialize(client:) ⇒ void constructor
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/nordlet/migration/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#check_a_historical_books_package_without_writing_anything(request_options: {}, **params) ⇒ Nordlet::Migration::Types::PostV1MigrationBooksValidateResponse
Runs every check the import runs (accounts, partners, balances, open invoices, assets, stock) and returns the same summary and warnings, then rolls everything back. Nothing is stored.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/nordlet/migration/client.rb', line 25 def check_a_historical_books_package_without_writing_anything(request_options: {}, **params) params = Nordlet::Internal::Types::Utils.normalize_keys(params) request = Nordlet::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "v1/migration/books/validate", body: Nordlet::Migration::Types::PostV1MigrationBooksValidateRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Nordlet::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Nordlet::Migration::Types::PostV1MigrationBooksValidateResponse.load(response.body) else error_class = Nordlet::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#import_historical_books_from_a_previous_accounting_system(request_options: {}, **params) ⇒ Nordlet::Migration::Types::PostV1MigrationBooksImportResponse
Brings a company over from another system in one call: chart of accounts, partners, items, opening balances (or the full journal history), open customer and supplier invoices, fixed assets with their accumulated depreciation, and stock on hand. The whole package is written in one database transaction — if any row fails, nothing is stored.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/nordlet/migration/client.rb', line 62 def import_historical_books_from_a_previous_accounting_system(request_options: {}, **params) params = Nordlet::Internal::Types::Utils.normalize_keys(params) request = Nordlet::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "v1/migration/books/import", body: Nordlet::Migration::Types::PostV1MigrationBooksImportRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Nordlet::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Nordlet::Migration::Types::PostV1MigrationBooksImportResponse.load(response.body) else error_class = Nordlet::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |