fortnox-api 0.9.2 → 1.0.0.rc2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +120 -95
- data/{LICENSE.txt → LICENSE.md} +0 -0
- data/README.md +245 -248
- data/bin/fortnox-setup +211 -0
- data/bin/fortnox-update-env +38 -0
- data/fortnox.gemspec +29 -0
- data/lib/fortnox/auth/thread_local.rb +28 -0
- data/lib/fortnox/collection.rb +23 -0
- data/lib/fortnox/mappers/country_code.rb +34 -0
- data/lib/fortnox/mappers/date.rb +21 -0
- data/lib/fortnox/mappers/document_row.rb +12 -0
- data/lib/fortnox/mappers/edi_information.rb +15 -0
- data/lib/fortnox/mappers/email_information.rb +11 -0
- data/lib/fortnox/mappers/invoice_row.rb +14 -0
- data/lib/fortnox/mappers/label_references.rb +24 -0
- data/lib/fortnox/mappers/order_row.rb +9 -0
- data/lib/fortnox/mappers/struct.rb +71 -0
- data/lib/fortnox/mappers/struct_array.rb +31 -0
- data/lib/fortnox/resource.rb +131 -0
- data/lib/fortnox/resources/article.rb +160 -0
- data/lib/fortnox/resources/customer.rb +209 -0
- data/lib/fortnox/resources/document.rb +202 -0
- data/lib/fortnox/resources/invoice.rb +92 -0
- data/lib/fortnox/resources/label.rb +15 -0
- data/lib/fortnox/resources/order.rb +38 -0
- data/lib/fortnox/resources/project.rb +41 -0
- data/lib/fortnox/resources/terms_of_payment.rb +23 -0
- data/lib/fortnox/resources/unit.rb +26 -0
- data/lib/fortnox/struct.rb +24 -0
- data/lib/fortnox/structs/default_delivery_types.rb +16 -0
- data/lib/fortnox/structs/default_templates.rb +19 -0
- data/lib/fortnox/structs/document_row.rb +62 -0
- data/lib/fortnox/structs/edi_information.rb +25 -0
- data/lib/fortnox/structs/email_information.rb +22 -0
- data/lib/fortnox/structs/invoice_row.rb +13 -0
- data/lib/fortnox/structs/order_row.rb +10 -0
- data/lib/fortnox/types.rb +129 -0
- data/lib/fortnox/{api/version.rb → version.rb} +1 -3
- data/lib/fortnox.rb +111 -0
- metadata +55 -580
- data/.codeclimate.yml +0 -20
- data/.env.template +0 -7
- data/.env.test +0 -11
- data/.gitignore +0 -20
- data/.rspec +0 -2
- data/.rubocop.yml +0 -41
- data/.tool-versions +0 -1
- data/.travis.yml +0 -32
- data/CLAUDE.md +0 -79
- data/CONTRIBUTE.md +0 -38
- data/DEVELOPER_README.md +0 -69
- data/Gemfile +0 -6
- data/Guardfile +0 -16
- data/Rakefile +0 -140
- data/bin/console +0 -22
- data/bin/fortnox +0 -285
- data/bin/get_tokens +0 -79
- data/bin/renew_tokens +0 -28
- data/docs/gotchas.md +0 -146
- data/fortnox-api.gemspec +0 -50
- data/lib/fortnox/api/mappers/article.rb +0 -23
- data/lib/fortnox/api/mappers/base/canonical_name_sym.rb +0 -21
- data/lib/fortnox/api/mappers/base/from_json.rb +0 -91
- data/lib/fortnox/api/mappers/base/to_json.rb +0 -66
- data/lib/fortnox/api/mappers/base.rb +0 -30
- data/lib/fortnox/api/mappers/customer.rb +0 -27
- data/lib/fortnox/api/mappers/default_delivery_types.rb +0 -15
- data/lib/fortnox/api/mappers/default_templates.rb +0 -16
- data/lib/fortnox/api/mappers/edi_information.rb +0 -23
- data/lib/fortnox/api/mappers/email_information.rb +0 -19
- data/lib/fortnox/api/mappers/invoice.rb +0 -29
- data/lib/fortnox/api/mappers/invoice_row.rb +0 -25
- data/lib/fortnox/api/mappers/order.rb +0 -26
- data/lib/fortnox/api/mappers/order_row.rb +0 -23
- data/lib/fortnox/api/mappers/project.rb +0 -17
- data/lib/fortnox/api/mappers/terms_of_payment.rb +0 -17
- data/lib/fortnox/api/mappers/unit.rb +0 -17
- data/lib/fortnox/api/mappers/value/array.rb +0 -18
- data/lib/fortnox/api/mappers/value/country_string.rb +0 -24
- data/lib/fortnox/api/mappers/value/date.rb +0 -11
- data/lib/fortnox/api/mappers/value/hash.rb +0 -16
- data/lib/fortnox/api/mappers/value/identity.rb +0 -18
- data/lib/fortnox/api/mappers.rb +0 -21
- data/lib/fortnox/api/models/article.rb +0 -134
- data/lib/fortnox/api/models/base.rb +0 -128
- data/lib/fortnox/api/models/customer.rb +0 -210
- data/lib/fortnox/api/models/document.rb +0 -189
- data/lib/fortnox/api/models/invoice.rb +0 -87
- data/lib/fortnox/api/models/label.rb +0 -19
- data/lib/fortnox/api/models/order.rb +0 -27
- data/lib/fortnox/api/models/project.rb +0 -42
- data/lib/fortnox/api/models/terms_of_payment.rb +0 -28
- data/lib/fortnox/api/models/unit.rb +0 -24
- data/lib/fortnox/api/models.rb +0 -9
- data/lib/fortnox/api/repositories/article.rb +0 -17
- data/lib/fortnox/api/repositories/authentication.rb +0 -61
- data/lib/fortnox/api/repositories/base/loaders.rb +0 -64
- data/lib/fortnox/api/repositories/base/savers.rb +0 -57
- data/lib/fortnox/api/repositories/base.rb +0 -93
- data/lib/fortnox/api/repositories/customer.rb +0 -17
- data/lib/fortnox/api/repositories/invoice.rb +0 -17
- data/lib/fortnox/api/repositories/order.rb +0 -17
- data/lib/fortnox/api/repositories/project.rb +0 -17
- data/lib/fortnox/api/repositories/terms_of_payment.rb +0 -17
- data/lib/fortnox/api/repositories/unit.rb +0 -17
- data/lib/fortnox/api/repositories.rb +0 -10
- data/lib/fortnox/api/request_handling.rb +0 -46
- data/lib/fortnox/api/types/default_delivery_types.rb +0 -20
- data/lib/fortnox/api/types/default_templates.rb +0 -23
- data/lib/fortnox/api/types/defaulted.rb +0 -11
- data/lib/fortnox/api/types/document_row.rb +0 -64
- data/lib/fortnox/api/types/edi_information.rb +0 -29
- data/lib/fortnox/api/types/email_information.rb +0 -26
- data/lib/fortnox/api/types/enums.rb +0 -116
- data/lib/fortnox/api/types/invoice_row.rb +0 -19
- data/lib/fortnox/api/types/model.rb +0 -37
- data/lib/fortnox/api/types/nullable.rb +0 -25
- data/lib/fortnox/api/types/order_row.rb +0 -16
- data/lib/fortnox/api/types/required.rb +0 -13
- data/lib/fortnox/api/types/shim/country_string.rb +0 -10
- data/lib/fortnox/api/types/sized.rb +0 -33
- data/lib/fortnox/api/types.rb +0 -144
- data/lib/fortnox/api.rb +0 -62
- data/spec/fortnox/api/mappers/article_spec.rb +0 -17
- data/spec/fortnox/api/mappers/base/canonical_name_sym_spec.rb +0 -36
- data/spec/fortnox/api/mappers/base/from_json_spec.rb +0 -70
- data/spec/fortnox/api/mappers/base/to_json_spec.rb +0 -68
- data/spec/fortnox/api/mappers/base_spec.rb +0 -154
- data/spec/fortnox/api/mappers/contexts/json_conversion.rb +0 -62
- data/spec/fortnox/api/mappers/customer_spec.rb +0 -27
- data/spec/fortnox/api/mappers/default_delivery_types_spec.rb +0 -14
- data/spec/fortnox/api/mappers/edi_information_spec.rb +0 -23
- data/spec/fortnox/api/mappers/email_information_spec.rb +0 -19
- data/spec/fortnox/api/mappers/examples/mapper.rb +0 -34
- data/spec/fortnox/api/mappers/invoice_row_spec.rb +0 -24
- data/spec/fortnox/api/mappers/invoice_spec.rb +0 -27
- data/spec/fortnox/api/mappers/order_row_spec.rb +0 -21
- data/spec/fortnox/api/mappers/order_spec.rb +0 -23
- data/spec/fortnox/api/mappers/project_spec.rb +0 -12
- data/spec/fortnox/api/mappers/terms_of_payment_spec.rb +0 -16
- data/spec/fortnox/api/mappers/unit_spec.rb +0 -56
- data/spec/fortnox/api/models/article_spec.rb +0 -9
- data/spec/fortnox/api/models/base_spec.rb +0 -117
- data/spec/fortnox/api/models/customer_spec.rb +0 -9
- data/spec/fortnox/api/models/examples/document_base.rb +0 -15
- data/spec/fortnox/api/models/examples/model.rb +0 -22
- data/spec/fortnox/api/models/invoice_spec.rb +0 -11
- data/spec/fortnox/api/models/order_spec.rb +0 -12
- data/spec/fortnox/api/models/project_spec.rb +0 -9
- data/spec/fortnox/api/models/terms_of_payment_spec.rb +0 -9
- data/spec/fortnox/api/models/unit_spec.rb +0 -33
- data/spec/fortnox/api/repositories/article_spec.rb +0 -80
- data/spec/fortnox/api/repositories/authentication_spec.rb +0 -103
- data/spec/fortnox/api/repositories/base_spec.rb +0 -168
- data/spec/fortnox/api/repositories/customer_spec.rb +0 -119
- data/spec/fortnox/api/repositories/examples/all.rb +0 -17
- data/spec/fortnox/api/repositories/examples/find.rb +0 -84
- data/spec/fortnox/api/repositories/examples/only.rb +0 -34
- data/spec/fortnox/api/repositories/examples/save.rb +0 -76
- data/spec/fortnox/api/repositories/examples/save_with_nested_model.rb +0 -28
- data/spec/fortnox/api/repositories/examples/save_with_specially_named_attribute.rb +0 -26
- data/spec/fortnox/api/repositories/examples/search.rb +0 -39
- data/spec/fortnox/api/repositories/invoice_spec.rb +0 -297
- data/spec/fortnox/api/repositories/order_spec.rb +0 -53
- data/spec/fortnox/api/repositories/project_spec.rb +0 -36
- data/spec/fortnox/api/repositories/terms_of_payment_spec.rb +0 -34
- data/spec/fortnox/api/repositories/unit_spec.rb +0 -39
- data/spec/fortnox/api/types/account_number_spec.rb +0 -35
- data/spec/fortnox/api/types/country_code_spec.rb +0 -42
- data/spec/fortnox/api/types/country_spec.rb +0 -67
- data/spec/fortnox/api/types/default_delivery_types_spec.rb +0 -12
- data/spec/fortnox/api/types/edi_information_spec.rb +0 -15
- data/spec/fortnox/api/types/email_information_spec.rb +0 -15
- data/spec/fortnox/api/types/email_spec.rb +0 -56
- data/spec/fortnox/api/types/enums_spec.rb +0 -17
- data/spec/fortnox/api/types/examples/document_row.rb +0 -25
- data/spec/fortnox/api/types/examples/enum.rb +0 -55
- data/spec/fortnox/api/types/examples/types.rb +0 -11
- data/spec/fortnox/api/types/housework_types_spec.rb +0 -149
- data/spec/fortnox/api/types/invoice_row_spec.rb +0 -11
- data/spec/fortnox/api/types/model_spec.rb +0 -69
- data/spec/fortnox/api/types/nullable_spec.rb +0 -79
- data/spec/fortnox/api/types/order_row_spec.rb +0 -15
- data/spec/fortnox/api/types/required_spec.rb +0 -36
- data/spec/fortnox/api/types/sales_account_spec.rb +0 -57
- data/spec/fortnox/api/types/sized_spec.rb +0 -76
- data/spec/fortnox/api_spec.rb +0 -66
- data/spec/spec_helper.rb +0 -35
- data/spec/support/helpers/configuration_helper.rb +0 -39
- data/spec/support/helpers/repository_helper.rb +0 -10
- data/spec/support/helpers.rb +0 -3
- data/spec/support/matchers/type/attribute_matcher.rb +0 -40
- data/spec/support/matchers/type/enum_matcher.rb +0 -23
- data/spec/support/matchers/type/have_account_number_matcher.rb +0 -23
- data/spec/support/matchers/type/have_currency_matcher.rb +0 -9
- data/spec/support/matchers/type/have_customer_type_matcher.rb +0 -15
- data/spec/support/matchers/type/have_default_delivery_type_matcher.rb +0 -9
- data/spec/support/matchers/type/have_discount_type_matcher.rb +0 -9
- data/spec/support/matchers/type/have_email_matcher.rb +0 -24
- data/spec/support/matchers/type/have_housework_type_matcher.rb +0 -9
- data/spec/support/matchers/type/have_nullable_date_matcher.rb +0 -60
- data/spec/support/matchers/type/have_nullable_matcher.rb +0 -54
- data/spec/support/matchers/type/have_nullable_string_matcher.rb +0 -47
- data/spec/support/matchers/type/have_sized_float_matcher.rb +0 -10
- data/spec/support/matchers/type/have_sized_integer_matcher.rb +0 -10
- data/spec/support/matchers/type/have_sized_string_matcher.rb +0 -36
- data/spec/support/matchers/type/have_vat_type_matcher.rb +0 -9
- data/spec/support/matchers/type/numeric_matcher.rb +0 -52
- data/spec/support/matchers/type/require_attribute_matcher.rb +0 -68
- data/spec/support/matchers/type/type_matcher.rb +0 -40
- data/spec/support/matchers/type.rb +0 -19
- data/spec/support/matchers.rb +0 -3
- data/spec/support/vcr_setup.rb +0 -25
- data/spec/vcr_cassettes/articles/all.yml +0 -67
- data/spec/vcr_cassettes/articles/find_by_hash_failure.yml +0 -62
- data/spec/vcr_cassettes/articles/find_failure.yml +0 -62
- data/spec/vcr_cassettes/articles/find_id_1.yml +0 -63
- data/spec/vcr_cassettes/articles/find_new.yml +0 -63
- data/spec/vcr_cassettes/articles/limits/quantity_in_stock_min_value.yml +0 -63
- data/spec/vcr_cassettes/articles/limits/quantity_in_stock_rounding_positive_value.yml +0 -63
- data/spec/vcr_cassettes/articles/multi_param_find_by_hash.yml +0 -62
- data/spec/vcr_cassettes/articles/save_new.yml +0 -63
- data/spec/vcr_cassettes/articles/save_old.yml +0 -63
- data/spec/vcr_cassettes/articles/save_with_specially_named_attribute.yml +0 -63
- data/spec/vcr_cassettes/articles/search_by_name.yml +0 -65
- data/spec/vcr_cassettes/articles/search_miss.yml +0 -62
- data/spec/vcr_cassettes/articles/search_with_special_char.yml +0 -62
- data/spec/vcr_cassettes/articles/single_param_find_by_hash.yml +0 -62
- data/spec/vcr_cassettes/authentication/expired_token.yml +0 -54
- data/spec/vcr_cassettes/authentication/invalid_authorization.yml +0 -57
- data/spec/vcr_cassettes/authentication/invalid_refresh_token.yml +0 -58
- data/spec/vcr_cassettes/authentication/valid_request.yml +0 -63
- data/spec/vcr_cassettes/customers/all.yml +0 -69
- data/spec/vcr_cassettes/customers/find_by_hash_failure.yml +0 -62
- data/spec/vcr_cassettes/customers/find_failure.yml +0 -62
- data/spec/vcr_cassettes/customers/find_id_1.yml +0 -64
- data/spec/vcr_cassettes/customers/find_new.yml +0 -63
- data/spec/vcr_cassettes/customers/find_with_sales_account.yml +0 -63
- data/spec/vcr_cassettes/customers/multi_param_find_by_hash.yml +0 -63
- data/spec/vcr_cassettes/customers/save_new.yml +0 -63
- data/spec/vcr_cassettes/customers/save_new_with_country_code_SE.yml +0 -64
- data/spec/vcr_cassettes/customers/save_new_with_idn_email.yml +0 -67
- data/spec/vcr_cassettes/customers/save_new_with_sales_account.yml +0 -63
- data/spec/vcr_cassettes/customers/save_old.yml +0 -63
- data/spec/vcr_cassettes/customers/save_with_specially_named_attribute.yml +0 -63
- data/spec/vcr_cassettes/customers/search_by_name.yml +0 -64
- data/spec/vcr_cassettes/customers/search_miss.yml +0 -62
- data/spec/vcr_cassettes/customers/search_with_special_char.yml +0 -62
- data/spec/vcr_cassettes/customers/single_param_find_by_hash.yml +0 -64
- data/spec/vcr_cassettes/invoices/all.yml +0 -96
- data/spec/vcr_cassettes/invoices/filter_hit.yml +0 -64
- data/spec/vcr_cassettes/invoices/filter_invalid.yml +0 -60
- data/spec/vcr_cassettes/invoices/find_by_hash_failure.yml +0 -62
- data/spec/vcr_cassettes/invoices/find_failure.yml +0 -62
- data/spec/vcr_cassettes/invoices/find_id_1.yml +0 -65
- data/spec/vcr_cassettes/invoices/find_new.yml +0 -65
- data/spec/vcr_cassettes/invoices/multi_param_find_by_hash.yml +0 -63
- data/spec/vcr_cassettes/invoices/row_delivered_quantity_decimals.yml +0 -65
- data/spec/vcr_cassettes/invoices/row_delivered_quantity_decimals_round_up.yml +0 -65
- data/spec/vcr_cassettes/invoices/row_description_limit.yml +0 -65
- data/spec/vcr_cassettes/invoices/row_price_limit.yml +0 -65
- data/spec/vcr_cassettes/invoices/row_price_limit_round_up.yml +0 -65
- data/spec/vcr_cassettes/invoices/save_new.yml +0 -65
- data/spec/vcr_cassettes/invoices/save_new_with_comments.yml +0 -65
- data/spec/vcr_cassettes/invoices/save_new_with_country.yml +0 -65
- data/spec/vcr_cassettes/invoices/save_new_with_country_GB.yml +0 -66
- data/spec/vcr_cassettes/invoices/save_new_with_country_Norge.yml +0 -65
- data/spec/vcr_cassettes/invoices/save_new_with_country_Norway.yml +0 -65
- data/spec/vcr_cassettes/invoices/save_new_with_country_Sverige.yml +0 -65
- data/spec/vcr_cassettes/invoices/save_new_with_country_VA.yml +0 -66
- data/spec/vcr_cassettes/invoices/save_new_with_country_VI.yml +0 -66
- data/spec/vcr_cassettes/invoices/save_new_with_country_empty_string.yml +0 -65
- data/spec/vcr_cassettes/invoices/save_new_with_country_nil.yml +0 -65
- data/spec/vcr_cassettes/invoices/save_new_with_unsaved_parent.yml +0 -65
- data/spec/vcr_cassettes/invoices/save_old.yml +0 -65
- data/spec/vcr_cassettes/invoices/save_old_with_empty_comments.yml +0 -65
- data/spec/vcr_cassettes/invoices/save_old_with_empty_country.yml +0 -65
- data/spec/vcr_cassettes/invoices/save_old_with_nil_comments.yml +0 -65
- data/spec/vcr_cassettes/invoices/save_old_with_nil_country.yml +0 -65
- data/spec/vcr_cassettes/invoices/save_with_nested_model.yml +0 -65
- data/spec/vcr_cassettes/invoices/save_with_specially_named_attribute.yml +0 -65
- data/spec/vcr_cassettes/invoices/search_by_name.yml +0 -63
- data/spec/vcr_cassettes/invoices/search_miss.yml +0 -62
- data/spec/vcr_cassettes/invoices/search_with_special_char.yml +0 -62
- data/spec/vcr_cassettes/invoices/single_param_find_by_hash.yml +0 -64
- data/spec/vcr_cassettes/orders/all.yml +0 -69
- data/spec/vcr_cassettes/orders/filter_hit.yml +0 -64
- data/spec/vcr_cassettes/orders/filter_invalid.yml +0 -60
- data/spec/vcr_cassettes/orders/find_by_hash_failure.yml +0 -62
- data/spec/vcr_cassettes/orders/find_failure.yml +0 -62
- data/spec/vcr_cassettes/orders/find_id_1.yml +0 -67
- data/spec/vcr_cassettes/orders/find_new.yml +0 -65
- data/spec/vcr_cassettes/orders/housework_invalid_tax_reduction_type.yml +0 -61
- data/spec/vcr_cassettes/orders/housework_othercoses_invalid.yml +0 -61
- data/spec/vcr_cassettes/orders/housework_type_babysitting.yml +0 -65
- data/spec/vcr_cassettes/orders/housework_type_cleaning.yml +0 -65
- data/spec/vcr_cassettes/orders/housework_type_construction.yml +0 -65
- data/spec/vcr_cassettes/orders/housework_type_cooking.yml +0 -61
- data/spec/vcr_cassettes/orders/housework_type_electricity.yml +0 -65
- data/spec/vcr_cassettes/orders/housework_type_gardening.yml +0 -65
- data/spec/vcr_cassettes/orders/housework_type_glassmetalwork.yml +0 -65
- data/spec/vcr_cassettes/orders/housework_type_grounddrainagework.yml +0 -65
- data/spec/vcr_cassettes/orders/housework_type_hvac.yml +0 -65
- data/spec/vcr_cassettes/orders/housework_type_itservices.yml +0 -65
- data/spec/vcr_cassettes/orders/housework_type_majorappliancerepair.yml +0 -65
- data/spec/vcr_cassettes/orders/housework_type_masonry.yml +0 -65
- data/spec/vcr_cassettes/orders/housework_type_movingservices.yml +0 -65
- data/spec/vcr_cassettes/orders/housework_type_othercare.yml +0 -65
- data/spec/vcr_cassettes/orders/housework_type_othercosts.yml +0 -65
- data/spec/vcr_cassettes/orders/housework_type_paintingwallpapering.yml +0 -65
- data/spec/vcr_cassettes/orders/housework_type_snowplowing.yml +0 -65
- data/spec/vcr_cassettes/orders/housework_type_textileclothing.yml +0 -65
- data/spec/vcr_cassettes/orders/housework_type_tutoring.yml +0 -61
- data/spec/vcr_cassettes/orders/multi_param_find_by_hash.yml +0 -63
- data/spec/vcr_cassettes/orders/save_new.yml +0 -65
- data/spec/vcr_cassettes/orders/save_old.yml +0 -65
- data/spec/vcr_cassettes/orders/save_with_nested_model.yml +0 -65
- data/spec/vcr_cassettes/orders/search_by_name.yml +0 -63
- data/spec/vcr_cassettes/orders/search_miss.yml +0 -62
- data/spec/vcr_cassettes/orders/search_with_special_char.yml +0 -62
- data/spec/vcr_cassettes/orders/single_param_find_by_hash.yml +0 -64
- data/spec/vcr_cassettes/projects/all.yml +0 -64
- data/spec/vcr_cassettes/projects/find_by_hash_failure.yml +0 -62
- data/spec/vcr_cassettes/projects/find_failure.yml +0 -62
- data/spec/vcr_cassettes/projects/find_id_1.yml +0 -63
- data/spec/vcr_cassettes/projects/find_new.yml +0 -63
- data/spec/vcr_cassettes/projects/multi_param_find_by_hash.yml +0 -64
- data/spec/vcr_cassettes/projects/save_new.yml +0 -63
- data/spec/vcr_cassettes/projects/save_old.yml +0 -63
- data/spec/vcr_cassettes/projects/single_param_find_by_hash.yml +0 -63
- data/spec/vcr_cassettes/termsofpayments/all.yml +0 -68
- data/spec/vcr_cassettes/termsofpayments/find_failure.yml +0 -62
- data/spec/vcr_cassettes/termsofpayments/find_id_1.yml +0 -62
- data/spec/vcr_cassettes/termsofpayments/find_new.yml +0 -63
- data/spec/vcr_cassettes/termsofpayments/save_new.yml +0 -63
- data/spec/vcr_cassettes/termsofpayments/save_old.yml +0 -63
- data/spec/vcr_cassettes/units/all.yml +0 -64
- data/spec/vcr_cassettes/units/find_failure.yml +0 -62
- data/spec/vcr_cassettes/units/find_id_1.yml +0 -63
- data/spec/vcr_cassettes/units/find_new.yml +0 -63
- data/spec/vcr_cassettes/units/save_new.yml +0 -63
- data/spec/vcr_cassettes/units/save_old.yml +0 -63
- data/spec/vcr_cassettes/units/save_with_specially_named_attribute.yml +0 -63
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Fortnox
|
|
4
|
+
class Invoice < Document
|
|
5
|
+
using RestEasy::Refinements
|
|
6
|
+
|
|
7
|
+
configure do
|
|
8
|
+
path 'invoices'
|
|
9
|
+
instance_wrapper 'Invoice'
|
|
10
|
+
collection_wrapper 'Invoices'
|
|
11
|
+
scope 'invoice'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# AccountingMethod Accounting Method.
|
|
15
|
+
attr :accounting_method, AccountingMethods
|
|
16
|
+
|
|
17
|
+
# Balance Balance of the invoice.
|
|
18
|
+
attr :balance, Coercible::Float.optional, :read_only
|
|
19
|
+
|
|
20
|
+
# Booked If the invoice is bookkept.
|
|
21
|
+
attr :booked, Bool.optional, :read_only, Boolean
|
|
22
|
+
|
|
23
|
+
# Credit If the invoice is a credit invoice.
|
|
24
|
+
attr :credit, Bool.optional, :read_only, Boolean
|
|
25
|
+
|
|
26
|
+
# CreditInvoiceReference Reference to the credit invoice, if one exists.
|
|
27
|
+
attr :credit_invoice_reference, Coercible::Integer.optional
|
|
28
|
+
|
|
29
|
+
# ContractReference Reference to the contract, if one exists.
|
|
30
|
+
attr :contract_reference, Coercible::Integer.optional, :read_only
|
|
31
|
+
|
|
32
|
+
# DueDate Due date of the invoice.
|
|
33
|
+
attr :due_date, Date.optional, Mappers::Date
|
|
34
|
+
|
|
35
|
+
# EDIInformation Separate EDIInformation object
|
|
36
|
+
attr :edi_information <=> 'EDIInformation', Structs::EDIInformation, Mappers::EDIInformation
|
|
37
|
+
|
|
38
|
+
# EUQuarterlyReport EU Quarterly Report On / Off
|
|
39
|
+
attr :eu_quarterly_report <=> 'EUQuarterlyReport', Bool.optional, Boolean
|
|
40
|
+
|
|
41
|
+
# FinalPayDate Final pay date of the invoice.
|
|
42
|
+
attr :final_pay_date, Date.optional, Mappers::Date
|
|
43
|
+
|
|
44
|
+
# InvoiceDate Invoice date.
|
|
45
|
+
attr :invoice_date, Date.optional, Mappers::Date
|
|
46
|
+
|
|
47
|
+
# InvoicePeriodStart Start date of the invoice period.
|
|
48
|
+
attr :invoice_period_start, Date.optional, :read_only, Mappers::Date
|
|
49
|
+
|
|
50
|
+
# InvoicePeriodEnd End date of the invoice period.
|
|
51
|
+
attr :invoice_period_end, Date.optional, :read_only, Mappers::Date
|
|
52
|
+
|
|
53
|
+
# InvoicePeriodReference Reference to the invoice period.
|
|
54
|
+
attr :invoice_period_reference, Coercible::String.optional
|
|
55
|
+
|
|
56
|
+
# InvoiceReference Reference to another invoice.
|
|
57
|
+
attr :invoice_reference, Coercible::String.optional
|
|
58
|
+
|
|
59
|
+
# InvoiceRows Separate object
|
|
60
|
+
attr :invoice_rows, Strict::Array.of(Structs::InvoiceRow), Mappers::StructArray.for(Mappers::InvoiceRow)
|
|
61
|
+
|
|
62
|
+
# InvoiceType The type of invoice.
|
|
63
|
+
attr :invoice_type, InvoiceTypes
|
|
64
|
+
|
|
65
|
+
# LastRemindDate Date of last reminder.
|
|
66
|
+
attr :last_remind_date, Date.optional, :read_only, Mappers::Date
|
|
67
|
+
|
|
68
|
+
# NoxFinans If the invoice is managed by NoxFinans
|
|
69
|
+
attr :nox_finans, Bool.optional, :read_only, Boolean
|
|
70
|
+
|
|
71
|
+
# OCR OCR number of the invoice.
|
|
72
|
+
attr :ocr <=> 'OCR', Coercible::String.optional
|
|
73
|
+
|
|
74
|
+
# OrderReference Reference to the order, if one exists.
|
|
75
|
+
attr :order_reference, Coercible::Integer.optional, :read_only
|
|
76
|
+
|
|
77
|
+
# PaymentWay Payment way of the invoice.
|
|
78
|
+
attr :payment_way, PaymentWays
|
|
79
|
+
|
|
80
|
+
# Reminders Number of reminders sent to the customer.
|
|
81
|
+
attr :reminders, Coercible::Integer.optional, :read_only
|
|
82
|
+
|
|
83
|
+
# VoucherNumber Voucher number for the invoice.
|
|
84
|
+
attr :voucher_number, Coercible::Integer.optional, :read_only
|
|
85
|
+
|
|
86
|
+
# VoucherSeries Voucher series for the invoice.
|
|
87
|
+
attr :voucher_series, Coercible::String.optional, :read_only
|
|
88
|
+
|
|
89
|
+
# VoucherYear Voucher year for the invoice.
|
|
90
|
+
attr :voucher_year, Coercible::Integer.optional, :read_only
|
|
91
|
+
end
|
|
92
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Fortnox
|
|
4
|
+
class Label < Fortnox::Resource
|
|
5
|
+
configure do
|
|
6
|
+
path 'labels'
|
|
7
|
+
instance_wrapper 'Label'
|
|
8
|
+
collection_wrapper 'Labels'
|
|
9
|
+
scope 'settings'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
attr :id, Coercible::Integer.optional, :read_only, :key
|
|
13
|
+
attr :description, Sized::String[25]
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Fortnox
|
|
4
|
+
class Order < Document
|
|
5
|
+
using RestEasy::Refinements
|
|
6
|
+
|
|
7
|
+
configure do
|
|
8
|
+
path 'orders'
|
|
9
|
+
instance_wrapper 'Order'
|
|
10
|
+
collection_wrapper 'Orders'
|
|
11
|
+
scope 'order'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# CopyRemarks If remarks shall be copied from order to invoice
|
|
15
|
+
attr :copy_remarks, Bool.optional, Boolean
|
|
16
|
+
|
|
17
|
+
# InvoiceReference Reference if an invoice is created from order
|
|
18
|
+
attr :invoice_reference, Coercible::Integer.optional, :read_only
|
|
19
|
+
|
|
20
|
+
# OrderDate Date of order
|
|
21
|
+
attr :order_date, Date.optional, Mappers::Date
|
|
22
|
+
|
|
23
|
+
# OrderRows Separate object
|
|
24
|
+
attr :order_rows, Strict::Array.of(Structs::OrderRow), Mappers::StructArray.for(Mappers::OrderRow)
|
|
25
|
+
|
|
26
|
+
# DeliveryState Delivery state of the order.
|
|
27
|
+
attr :delivery_state, DeliveryStates
|
|
28
|
+
|
|
29
|
+
# OrderType Type of order.
|
|
30
|
+
attr :order_type, Coercible::String.optional
|
|
31
|
+
|
|
32
|
+
# StockPointCode Code of the stock point.
|
|
33
|
+
attr :stock_point_code, Coercible::String.optional
|
|
34
|
+
|
|
35
|
+
# StockPointId ID of the stock point.
|
|
36
|
+
attr :stock_point_id, Coercible::String.optional
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Fortnox
|
|
4
|
+
class Project < Fortnox::Resource
|
|
5
|
+
using RestEasy::Refinements
|
|
6
|
+
|
|
7
|
+
configure do
|
|
8
|
+
path 'projects'
|
|
9
|
+
instance_wrapper 'Project'
|
|
10
|
+
collection_wrapper 'Projects'
|
|
11
|
+
scope 'project'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# @url Direct URL to the record.
|
|
15
|
+
attr :url <=> '@url', Coercible::String.optional, :read_only
|
|
16
|
+
|
|
17
|
+
# Comments Comments on project
|
|
18
|
+
attr :comments, Sized::String[512]
|
|
19
|
+
|
|
20
|
+
# ContactPerson ContactPerson for project
|
|
21
|
+
attr :contact_person, Sized::String[50]
|
|
22
|
+
|
|
23
|
+
# Description Description of the project
|
|
24
|
+
attr :description, Sized::String[50]
|
|
25
|
+
|
|
26
|
+
# EndDate End date of the project.
|
|
27
|
+
attr :end_date, Date.optional, Mappers::Date
|
|
28
|
+
|
|
29
|
+
# ProjectLeader Projectleader
|
|
30
|
+
attr :project_leader, Sized::String[50]
|
|
31
|
+
|
|
32
|
+
# ProjectNumber Projectnumber
|
|
33
|
+
key :project_number, Sized::String[20]
|
|
34
|
+
|
|
35
|
+
# Status Status of the project
|
|
36
|
+
attr :status, ProjectStatusTypes
|
|
37
|
+
|
|
38
|
+
# StartDate Start date of the project
|
|
39
|
+
attr :start_date, Date.optional, Mappers::Date
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Fortnox
|
|
4
|
+
class TermsOfPayment < Fortnox::Resource
|
|
5
|
+
using RestEasy::Refinements
|
|
6
|
+
|
|
7
|
+
configure do
|
|
8
|
+
path 'termsofpayments'
|
|
9
|
+
instance_wrapper 'TermsOfPayment'
|
|
10
|
+
collection_wrapper 'TermsOfPayments'
|
|
11
|
+
scope 'settings'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# @url Direct URL to the record.
|
|
15
|
+
attr :url <=> '@url', Coercible::String.optional, :read_only
|
|
16
|
+
|
|
17
|
+
# Code The code of the term of payment.
|
|
18
|
+
key :code, Sized::String[25], :required
|
|
19
|
+
|
|
20
|
+
# Description The description of the term of payment.
|
|
21
|
+
attr :description, Strict::String, :required
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Fortnox
|
|
4
|
+
class Unit < Fortnox::Resource
|
|
5
|
+
using RestEasy::Refinements
|
|
6
|
+
|
|
7
|
+
configure do
|
|
8
|
+
path 'units'
|
|
9
|
+
instance_wrapper 'Unit'
|
|
10
|
+
collection_wrapper 'Units'
|
|
11
|
+
scope 'settings'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# @url Direct URL to the record.
|
|
15
|
+
attr :url <=> '@url', Coercible::String.optional, :read_only
|
|
16
|
+
|
|
17
|
+
# Code The code of the unit.
|
|
18
|
+
key :code, Sized::String[20], :required
|
|
19
|
+
|
|
20
|
+
# Description The description of the unit.
|
|
21
|
+
attr :description, Sized::String[100], :required
|
|
22
|
+
|
|
23
|
+
# CodeEnglish English code of the unit
|
|
24
|
+
attr :code_english, Sized::String[100]
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'dry-struct'
|
|
4
|
+
|
|
5
|
+
module Fortnox
|
|
6
|
+
class Struct < Dry::Struct
|
|
7
|
+
class << self
|
|
8
|
+
def read_only_attributes
|
|
9
|
+
@read_only_attributes ||=
|
|
10
|
+
(superclass.respond_to?(:read_only_attributes) ? superclass.read_only_attributes.dup : [])
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def attribute(name, type, *flags)
|
|
14
|
+
read_only_attributes << name if flags.include?(:read_only)
|
|
15
|
+
super(name, type)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def attribute?(name, type, *flags)
|
|
19
|
+
read_only_attributes << name if flags.include?(:read_only)
|
|
20
|
+
super(name, type)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Fortnox
|
|
4
|
+
module Structs
|
|
5
|
+
class DefaultDeliveryTypes < Fortnox::Struct
|
|
6
|
+
# Default delivery type for invoices. Can be PRINT EMAIL or PRINTSERVICE.
|
|
7
|
+
attribute? :invoice, Types::DefaultDeliveryTypeValues
|
|
8
|
+
|
|
9
|
+
# Default delivery type for orders. Can be PRINT EMAIL or PRINTSERVICE.
|
|
10
|
+
attribute? :order, Types::DefaultDeliveryTypeValues
|
|
11
|
+
|
|
12
|
+
# Default delivery type for offers. Can be PRINT EMAIL or PRINTSERVICE.
|
|
13
|
+
attribute? :offer, Types::DefaultDeliveryTypeValues
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Fortnox
|
|
4
|
+
module Structs
|
|
5
|
+
class DefaultTemplates < Fortnox::Struct
|
|
6
|
+
# Default template for orders. Must be a name of an existing print template.
|
|
7
|
+
attribute? :order, Types::Strict::String
|
|
8
|
+
|
|
9
|
+
# Default template for offers. Must be a name of an existing print template.
|
|
10
|
+
attribute? :offer, Types::Strict::String
|
|
11
|
+
|
|
12
|
+
# Default template for invoices. Must be a name of an existing print template.
|
|
13
|
+
attribute? :invoice, Types::Strict::String
|
|
14
|
+
|
|
15
|
+
# Default template for cash invoices. Must be a name of an existing print template.
|
|
16
|
+
attribute? :cash_invoice, Types::Strict::String
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Fortnox
|
|
4
|
+
module Structs
|
|
5
|
+
class DocumentRow < Fortnox::Struct
|
|
6
|
+
# AccountNumber Account number.
|
|
7
|
+
attribute? :account_number, Types::AccountNumber
|
|
8
|
+
|
|
9
|
+
# ArticleNumber Article number.
|
|
10
|
+
attribute? :article_number, Types::Sized::String[50]
|
|
11
|
+
|
|
12
|
+
# ContributionPercent Contribution Percent.
|
|
13
|
+
attribute? :contribution_percent, Types::Coercible::Float.optional, :read_only
|
|
14
|
+
|
|
15
|
+
# ContributionValue Contribution Value.
|
|
16
|
+
attribute? :contribution_value, Types::Coercible::Float.optional, :read_only
|
|
17
|
+
|
|
18
|
+
# CostCenter Code of the cost center for the row.
|
|
19
|
+
attribute? :cost_center, Types::Coercible::String.optional
|
|
20
|
+
|
|
21
|
+
# DeliveredQuantity Delivered quantity. 14 digits
|
|
22
|
+
attribute? :delivered_quantity, Types::Sized::Float[-9_999_999_999_999.9, 9_999_999_999_999.9]
|
|
23
|
+
|
|
24
|
+
# Description Row description.
|
|
25
|
+
attribute? :description, Types::Sized::String[255]
|
|
26
|
+
|
|
27
|
+
# Discount amount. 12 digits (for amount) / 5 digits (for percent)
|
|
28
|
+
# TODO: Verify that we can send in more than 5 digits through
|
|
29
|
+
# the actual API for DiscountType PERCENT. This cannot be done until
|
|
30
|
+
# we fix issue #62...
|
|
31
|
+
attribute? :discount, Types::Sized::Float[0.0, 99_999_999_999.9]
|
|
32
|
+
|
|
33
|
+
# DiscountType The type of discount used for the row.
|
|
34
|
+
attribute? :discount_type, Types::DiscountTypes
|
|
35
|
+
|
|
36
|
+
# HouseWork If the row is housework
|
|
37
|
+
attribute? :housework, Types::Bool.optional
|
|
38
|
+
|
|
39
|
+
# HouseWorkHoursToReport Hours to be reported if the quantity of the row
|
|
40
|
+
# should not be used as hours. 5 digits
|
|
41
|
+
attribute? :housework_hours_to_report, Types::Sized::Integer[0, 99_999].optional
|
|
42
|
+
|
|
43
|
+
# HouseWorkType The type of housework.
|
|
44
|
+
attribute? :housework_type, Types::HouseworkTypes.optional
|
|
45
|
+
|
|
46
|
+
# Price Price per unit. 12 digits
|
|
47
|
+
attribute? :price, Types::Sized::Float[-99_999_999_999.9, 99_999_999_999.9]
|
|
48
|
+
|
|
49
|
+
# Project Code of the project for the row.
|
|
50
|
+
attribute? :project, Types::Coercible::String.optional
|
|
51
|
+
|
|
52
|
+
# Total Total amount for the row.
|
|
53
|
+
attribute? :total, Types::Coercible::Float.optional, :read_only
|
|
54
|
+
|
|
55
|
+
# Unit Code of the unit for the row.
|
|
56
|
+
attribute? :unit, Types::Coercible::String.optional
|
|
57
|
+
|
|
58
|
+
# VAT VAT percentage of the row.
|
|
59
|
+
attribute? :vat, Types::Coercible::Integer.optional
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Fortnox
|
|
4
|
+
module Structs
|
|
5
|
+
class EDIInformation < Fortnox::Struct
|
|
6
|
+
# EDIGlobalLocationNumber Invoice address GLN for EDI
|
|
7
|
+
attribute? :edi_global_location_number, Types::Coercible::String.optional
|
|
8
|
+
|
|
9
|
+
# EDIGlobalLocationNumberDelivery Delivery address GLN for EDI
|
|
10
|
+
attribute? :edi_global_location_number_delivery, Types::Coercible::String.optional
|
|
11
|
+
|
|
12
|
+
# EDIInvoiceExtra1 Extra EDI Information
|
|
13
|
+
attribute? :edi_invoice_extra1, Types::Coercible::String.optional
|
|
14
|
+
|
|
15
|
+
# EDIInvoiceExtra2 Extra EDI Information
|
|
16
|
+
attribute? :edi_invoice_extra2, Types::Coercible::String.optional
|
|
17
|
+
|
|
18
|
+
# EDIOurElectronicReference Our electronic reference for EDI
|
|
19
|
+
attribute? :edi_our_electronic_reference, Types::Coercible::String.optional
|
|
20
|
+
|
|
21
|
+
# EDIYourElectronicReference Your electronic reference for EDI
|
|
22
|
+
attribute? :edi_your_electronic_reference, Types::Coercible::String.optional
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Fortnox
|
|
4
|
+
module Structs
|
|
5
|
+
class EmailInformation < Fortnox::Struct
|
|
6
|
+
# EmailAddressTo Customer e-mail address. Must be a valid e-mail address.
|
|
7
|
+
attribute? :email_address_to, Types::Email
|
|
8
|
+
|
|
9
|
+
# EmailAddressCC Customer e-mail address, Carbon copy. Must be a valid e-mail address.
|
|
10
|
+
attribute? :email_address_cc, Types::Email
|
|
11
|
+
|
|
12
|
+
# EmailAddressBCC Customer e-mail address, Blind carbon copy. Must be a valid e-mail address.
|
|
13
|
+
attribute? :email_address_bcc, Types::Email
|
|
14
|
+
|
|
15
|
+
# EmailSubject Subject of the e-mail
|
|
16
|
+
attribute? :email_subject, Types::Sized::String[100]
|
|
17
|
+
|
|
18
|
+
# EmailBody Body of the e-mail
|
|
19
|
+
attribute? :email_body, Types::Sized::String[20_000]
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Fortnox
|
|
4
|
+
module Structs
|
|
5
|
+
class InvoiceRow < DocumentRow
|
|
6
|
+
# PriceExcludingVAT Price per unit excluding VAT.
|
|
7
|
+
attribute? :price_excluding_vat, Types::Coercible::Float.optional, :read_only
|
|
8
|
+
|
|
9
|
+
# TotalExcludingVAT Total amount for the row excluding VAT.
|
|
10
|
+
attribute? :total_excluding_vat, Types::Coercible::Float.optional, :read_only
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'dry-struct'
|
|
4
|
+
require 'dry-types'
|
|
5
|
+
|
|
6
|
+
module Fortnox
|
|
7
|
+
module Types
|
|
8
|
+
include Dry.Types()
|
|
9
|
+
|
|
10
|
+
THE_TRUTH = { true => true, 'true' => true, false => false, 'false' => false }.freeze
|
|
11
|
+
|
|
12
|
+
ArticleTypes = Types::Strict::String.enum(
|
|
13
|
+
'SERVICE', 'STOCK'
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
DiscountTypes = Types::Strict::String.enum(
|
|
17
|
+
'AMOUNT', 'PERCENT'
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
CURRENT_HOUSEWORK_TYPES = [
|
|
21
|
+
'CONSTRUCTION', 'ELECTRICITY', 'GLASSMETALWORK', 'GROUNDDRAINAGEWORK',
|
|
22
|
+
'MASONRY', 'PAINTINGWALLPAPERING', 'HVAC', 'MAJORAPPLIANCEREPAIR',
|
|
23
|
+
'MOVINGSERVICES', 'ITSERVICES', 'CLEANING', 'TEXTILECLOTHING',
|
|
24
|
+
'SNOWPLOWING', 'GARDENING', 'BABYSITTING', 'OTHERCARE', 'OTHERCOSTS',
|
|
25
|
+
'FURNISHING', 'HOMEMAINTENANCE', 'TRANSPORTATIONSERVICES',
|
|
26
|
+
'WASHINGANDCAREOFCLOTHING', 'SOLARCELLS', 'STORAGESELFPRODUCEDELECTRICITY',
|
|
27
|
+
'CHARGINGSTATIONELECTRICVEHICLE', 'EMPTYHOUSEWORK'
|
|
28
|
+
].freeze
|
|
29
|
+
|
|
30
|
+
LEGACY_HOUSEWORK_TYPES = ['COOKING', 'TUTORING'].freeze
|
|
31
|
+
|
|
32
|
+
HouseworkTypes = Types::Strict::String.enum(
|
|
33
|
+
*(CURRENT_HOUSEWORK_TYPES + LEGACY_HOUSEWORK_TYPES)
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
Currencies = Types::Strict::String.enum(
|
|
37
|
+
'AED', 'AFN', 'ALL', 'AMD', 'ANG', 'AOA', 'ARS', 'AUD', 'AWG', 'AZN',
|
|
38
|
+
'BAM', 'BBD', 'BDT', 'BGN', 'BHD', 'BIF', 'BMD', 'BND', 'BOB', 'BOV',
|
|
39
|
+
'BRL', 'BSD', 'BTN', 'BWP', 'BYR', 'BZD', 'CAD', 'CDF', 'CHE', 'CHF',
|
|
40
|
+
'CHW', 'CLF', 'CLP', 'CNY', 'COP', 'COU', 'CRC', 'CUP', 'CVE', 'CZK',
|
|
41
|
+
'DJF', 'DKK', 'DOP', 'DZD', 'EGP', 'ERN', 'ETB', 'EUR', 'FJD', 'FKP',
|
|
42
|
+
'GBP', 'GEL', 'GHS', 'GIP', 'GMD', 'GNF', 'GTQ', 'GYD', 'HKD', 'HNL',
|
|
43
|
+
'HRK', 'HTG', 'HUF', 'IDR', 'ILS', 'INR', 'IQD', 'IRR', 'ISK', 'JMD',
|
|
44
|
+
'JOD', 'JPY', 'KES', 'KGS', 'KHR', 'KMF', 'KPW', 'KRW', 'KWD',
|
|
45
|
+
'KYD', 'KZT', 'LAK', 'LBP', 'LKR', 'LRD', 'LSL', 'LYD', 'MAD', 'MDL',
|
|
46
|
+
'MGA', 'MKD', 'MMK', 'MNT', 'MOP', 'MRO', 'MUR', 'MVR', 'MWK', 'MXN',
|
|
47
|
+
'MXV', 'MYR', 'MZN', 'NAD', 'NGN', 'NIO', 'NOK', 'NPR', 'NZD', 'OMR',
|
|
48
|
+
'PAB', 'PEN', 'PGK', 'PHP', 'PKR', 'PLN', 'PYG', 'QAR', 'RON', 'RSD',
|
|
49
|
+
'RUB', 'RWF', 'SAR', 'SBD', 'SCR', 'SDG', 'SEK', 'SGD', 'SHP', 'SLL',
|
|
50
|
+
'SOS', 'SRD', 'SSP', 'STD', 'SYP', 'SZL', 'THB', 'TJS', 'TMM', 'TND',
|
|
51
|
+
'TOP', 'TRY', 'TTD', 'TWD', 'TZS', 'UAH', 'UGX', 'USD', 'USN', 'USS',
|
|
52
|
+
'UYU', 'UZS', 'VEF', 'VND', 'VUV', 'WST', 'XAF', 'XAG', 'XAU', 'XBA',
|
|
53
|
+
'XBB', 'XBC', 'XBD', 'XCD', 'XDR', 'XFU', 'XOF', 'XPD', 'XPF', 'XPT',
|
|
54
|
+
'XTS', 'XXX', 'YER', 'ZAR', 'ZMK', 'ZWD'
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
CustomerTypes = Types::Strict::String.enum(
|
|
58
|
+
'PRIVATE', 'COMPANY'
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
VATTypes = Types::Strict::String.enum(
|
|
62
|
+
'SEVAT', 'SEREVERSEDVAT', 'EUREVERSEDVAT', 'EUVAT', 'EXPORT'
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
DefaultDeliveryTypeValues = Types::Strict::String.enum(
|
|
66
|
+
'PRINT', 'EMAIL', 'PRINTSERVICE'
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
AccountingMethods = Types::Strict::String.enum(
|
|
70
|
+
'', 'ACCRUAL', 'CASH'
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
DeliveryStates = Types::Strict::String.enum(
|
|
74
|
+
'', 'registration', 'reservation', 'delivery'
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
PaymentWays = Types::Strict::String.enum(
|
|
78
|
+
'', 'CASH', 'CARD', 'AG'
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
ProjectStatusTypes = Types::Strict::String.enum(
|
|
82
|
+
'NOTSTARTED', 'ONGOING', 'COMPLETED'
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
InvoiceTypes = Types::Strict::String.enum(
|
|
86
|
+
'', 'INVOICE', 'AGREEMENTINVOICE', 'INTRESTINVOICE', 'SUMMARYINVOICE', 'CASHINVOICE'
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
TaxReductionTypes = Types::Strict::String.enum(
|
|
90
|
+
'', 'none', 'rot', 'rut', 'green'
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
AccountNumber = Coercible::Integer
|
|
94
|
+
.constrained(gteq: 0, lteq: 9999)
|
|
95
|
+
.optional
|
|
96
|
+
|
|
97
|
+
Email = Strict::String
|
|
98
|
+
.constrained(max_size: 1024, format: /\A\z|\A[[[:alnum:]]+-_.]+@[[[:alnum:]]+-_.]+\.[a-z]+\z/i)
|
|
99
|
+
.optional
|
|
100
|
+
.constructor { |v| v&.to_s&.downcase }
|
|
101
|
+
|
|
102
|
+
module Sized
|
|
103
|
+
module String
|
|
104
|
+
def self.[](size)
|
|
105
|
+
Types::Coercible::String.constrained(max_size: size).optional
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
module Integer
|
|
110
|
+
def self.[](low, high)
|
|
111
|
+
Types::Coercible::Integer.constrained(gteq: low, lteq: high).optional
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
module Float
|
|
116
|
+
def self.[](low, high)
|
|
117
|
+
Types::Coercible::Float.constrained(gteq: low, lteq: high).optional
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
require 'fortnox/structs/default_delivery_types'
|
|
123
|
+
require 'fortnox/structs/default_templates'
|
|
124
|
+
require 'fortnox/structs/email_information'
|
|
125
|
+
require 'fortnox/structs/edi_information'
|
|
126
|
+
require 'fortnox/structs/invoice_row'
|
|
127
|
+
require 'fortnox/structs/order_row'
|
|
128
|
+
end
|
|
129
|
+
end
|