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
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative 'base'
|
|
4
|
-
require_relative '../types'
|
|
5
|
-
|
|
6
|
-
module Fortnox
|
|
7
|
-
module API
|
|
8
|
-
module Model
|
|
9
|
-
class Article < Fortnox::API::Model::Base
|
|
10
|
-
UNIQUE_ID = :article_number
|
|
11
|
-
STUB = { description: '' }.freeze
|
|
12
|
-
|
|
13
|
-
# Url Direct URL to the record
|
|
14
|
-
attribute :url, Types::Nullable::String.is(:read_only)
|
|
15
|
-
|
|
16
|
-
# Active If the article is active
|
|
17
|
-
attribute :active, Types::Nullable::Boolean
|
|
18
|
-
|
|
19
|
-
# ArticleNumber Article number. 50 characters
|
|
20
|
-
attribute :article_number, Types::Sized::String[50]
|
|
21
|
-
|
|
22
|
-
# Bulky If the article is bulky.
|
|
23
|
-
attribute :bulky, Types::Nullable::Boolean
|
|
24
|
-
|
|
25
|
-
# ConstructionAccount Account number for construction work (special VAT rules in Sweden).
|
|
26
|
-
# The number must be of an existing account.
|
|
27
|
-
attribute :construction_account, Types::Sized::Integer[0, 9_999]
|
|
28
|
-
|
|
29
|
-
# Depth The depth of the article in millimeters
|
|
30
|
-
attribute :depth, Types::Sized::Integer[0, 99_999_999]
|
|
31
|
-
|
|
32
|
-
# Description The description of the article
|
|
33
|
-
attribute :description, Types::Sized::String[200].is(:required)
|
|
34
|
-
|
|
35
|
-
# DisposableQuantity Disposable quantity of the article.
|
|
36
|
-
attribute :disposable_quantity, Types::Nullable::Float.is(:read_only)
|
|
37
|
-
|
|
38
|
-
# EAN EAN bar code
|
|
39
|
-
attribute :ean, Types::Sized::String[30]
|
|
40
|
-
|
|
41
|
-
# EUAccount Account number for the sales account to EU.
|
|
42
|
-
# The number must be of an existing account.
|
|
43
|
-
attribute :eu_account, Types::Sized::Integer[0, 9_999]
|
|
44
|
-
|
|
45
|
-
# EUVATAccount Account number for the sales account to EU with VAT.
|
|
46
|
-
# The number must be of an existing account.
|
|
47
|
-
attribute :eu_vat_account, Types::Sized::Integer[0, 9_999]
|
|
48
|
-
|
|
49
|
-
# ExportAccount Account number for the sales account outside EU
|
|
50
|
-
# The number must be of an existing account.
|
|
51
|
-
attribute :export_account, Types::Sized::Integer[0, 9_999]
|
|
52
|
-
|
|
53
|
-
# Height The height of the article in millimeters
|
|
54
|
-
attribute :height, Types::Sized::Integer[0, 99_999_999]
|
|
55
|
-
|
|
56
|
-
# Housework If the article is housework
|
|
57
|
-
attribute :housework, Types::Nullable::Boolean
|
|
58
|
-
|
|
59
|
-
# HouseWorkType The type of housework.
|
|
60
|
-
attribute :housework_type, Types::HouseworkType
|
|
61
|
-
|
|
62
|
-
# Manufacturer The manufacturer of the article
|
|
63
|
-
attribute :manufacturer, Types::Sized::String[50]
|
|
64
|
-
|
|
65
|
-
# ManufacturerArticleNumber The manufacturer's article number
|
|
66
|
-
attribute :manufacturer_article_number, Types::Sized::String[50]
|
|
67
|
-
|
|
68
|
-
# Note Text note
|
|
69
|
-
attribute :note, Types::Sized::String[10_000]
|
|
70
|
-
|
|
71
|
-
# PurchaseAccount Account number for purchase.
|
|
72
|
-
# The number must be of an existing account.
|
|
73
|
-
attribute :purchase_account, Types::Sized::Integer[0, 9_999]
|
|
74
|
-
|
|
75
|
-
# PurchasePrice Purchase price of the article
|
|
76
|
-
attribute :purchase_price, Types::Sized::Float[0.0, 99_999_999_999_999.9]
|
|
77
|
-
|
|
78
|
-
# QuantityInStock Quantity in stock of the article
|
|
79
|
-
attribute :quantity_in_stock, Types::Sized::Float[-100_000_000_000_000.0, 99_999_999_999_999.9]
|
|
80
|
-
|
|
81
|
-
# ReservedQuantity Reserved quantity of the article
|
|
82
|
-
attribute :reserved_quantity, Types::Nullable::Float.is(:read_only)
|
|
83
|
-
|
|
84
|
-
# SalesAccount Account number for the sales account in Sweden.
|
|
85
|
-
# The number must be of an existing account.
|
|
86
|
-
attribute :sales_account, Types::Sized::Integer[0, 9_999]
|
|
87
|
-
|
|
88
|
-
# SalesPrice Price of article for its default price list
|
|
89
|
-
attribute :sales_price, Types::Nullable::Float.is(:read_only)
|
|
90
|
-
|
|
91
|
-
# StockGoods If the article is stock goods
|
|
92
|
-
attribute :stock_goods, Types::Nullable::Boolean
|
|
93
|
-
|
|
94
|
-
# StockPlace Storage place for the article
|
|
95
|
-
attribute :stock_place, Types::Sized::String[100]
|
|
96
|
-
|
|
97
|
-
# StockValue Value in stock of the article
|
|
98
|
-
attribute :stock_value, Types::Nullable::Float.is(:read_only)
|
|
99
|
-
|
|
100
|
-
# StockWarning When to start warning for low quantity in stock
|
|
101
|
-
attribute :stock_warning, Types::Sized::Float[0.0, 99_999_999_999_999.9]
|
|
102
|
-
|
|
103
|
-
# SupplierName Name of the supplier
|
|
104
|
-
attribute :supplier_name, Types::Nullable::String.is(:read_only)
|
|
105
|
-
|
|
106
|
-
# SupplierNumber Supplier number for the article.
|
|
107
|
-
# The number must be of an existing supplier.
|
|
108
|
-
attribute :supplier_number, Types::Nullable::String
|
|
109
|
-
|
|
110
|
-
# Type The type of the article
|
|
111
|
-
attribute :type, Types::ArticleType
|
|
112
|
-
|
|
113
|
-
# Unit Unit code for the article.
|
|
114
|
-
# The code must be of an existing unit.
|
|
115
|
-
attribute :unit, Types::Nullable::String
|
|
116
|
-
|
|
117
|
-
# VAT VAT percent, this is predefined by the VAT for the sales account
|
|
118
|
-
attribute :vat, Types::Nullable::Float
|
|
119
|
-
|
|
120
|
-
# WebshopArticle If the article is a webshop article
|
|
121
|
-
attribute :webshop_article, Types::Nullable::Boolean
|
|
122
|
-
|
|
123
|
-
# Weight Weight of the article in grams
|
|
124
|
-
attribute :weight, Types::Sized::Integer[0, 99_999_999]
|
|
125
|
-
|
|
126
|
-
# Width Width of the article in millimeters.
|
|
127
|
-
attribute :width, Types::Sized::Integer[0, 99_999_999]
|
|
128
|
-
|
|
129
|
-
# Expired If the article has expired
|
|
130
|
-
attribute :expired, Types::Nullable::Boolean
|
|
131
|
-
end
|
|
132
|
-
end
|
|
133
|
-
end
|
|
134
|
-
end
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'ice_nine'
|
|
4
|
-
|
|
5
|
-
require_relative '../types'
|
|
6
|
-
|
|
7
|
-
module Fortnox
|
|
8
|
-
module API
|
|
9
|
-
module Model
|
|
10
|
-
class Base < Fortnox::API::Types::Model
|
|
11
|
-
# TODO(jonas): Restructure this class a bit, it is not very readable.
|
|
12
|
-
|
|
13
|
-
attr_accessor :unsaved
|
|
14
|
-
attr_writer :parent
|
|
15
|
-
|
|
16
|
-
def self.attribute(name, *args)
|
|
17
|
-
define_method("#{name}?") do
|
|
18
|
-
!send(name).nil?
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
super
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def self.new(hash = {})
|
|
25
|
-
begin
|
|
26
|
-
obj = preserve_meta_properties(hash) do
|
|
27
|
-
super(hash)
|
|
28
|
-
end
|
|
29
|
-
rescue Dry::Struct::Error => exception
|
|
30
|
-
raise Fortnox::API::AttributeError, exception
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
IceNine.deep_freeze(obj)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def self.stub
|
|
37
|
-
new(self::STUB.dup)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def unique_id
|
|
41
|
-
send(self.class::UNIQUE_ID)
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
# This filtering logic could be improved since it is currently O(N*M).
|
|
45
|
-
def attributes(*options)
|
|
46
|
-
return self.class.schema if options.nil?
|
|
47
|
-
|
|
48
|
-
options = Array(options)
|
|
49
|
-
|
|
50
|
-
self.class.schema.find_all do |_name, attribute|
|
|
51
|
-
options.all? { |option| attribute.is?(option) }
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def to_hash(recursive = false) # rubocop:disable Style/OptionalBooleanParameter
|
|
56
|
-
return super() if recursive
|
|
57
|
-
|
|
58
|
-
self.class.schema.each_with_object({}) do |key, result|
|
|
59
|
-
# Only output attributes that have a value set
|
|
60
|
-
result[key.name] = self[key.name] if send("#{key.name}?")
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def update(hash)
|
|
65
|
-
old_attributes = to_hash
|
|
66
|
-
new_attributes = old_attributes.merge(hash).compact
|
|
67
|
-
|
|
68
|
-
return self if new_attributes == old_attributes
|
|
69
|
-
|
|
70
|
-
new_attributes[:new] = @new
|
|
71
|
-
new_attributes[:parent] = self
|
|
72
|
-
self.class.new(new_attributes)
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
# Generic comparison, by value, use .eql? or .equal? for object identity.
|
|
76
|
-
def ==(other)
|
|
77
|
-
return false unless other.is_a? self.class
|
|
78
|
-
|
|
79
|
-
to_hash == other.to_hash
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
def new?
|
|
83
|
-
@new
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
def saved?
|
|
87
|
-
@saved
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
def parent?
|
|
91
|
-
!@parent.nil?
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
def parent
|
|
95
|
-
@parent || self.class.new(self.class::STUB.dup)
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
# dry-types filter anything that isn't specified as an attribute on the
|
|
99
|
-
# class that is being instantiated. This wrapper preserves the meta
|
|
100
|
-
# properties we need to track object state during that initialisation and
|
|
101
|
-
# sets them on the object after dry-types is done with it.
|
|
102
|
-
def self.preserve_meta_properties(hash)
|
|
103
|
-
is_unsaved = hash.delete(:unsaved) { true }
|
|
104
|
-
is_new = hash.delete(:new) { true }
|
|
105
|
-
parent = hash.delete(:parent) { nil }
|
|
106
|
-
|
|
107
|
-
obj = yield
|
|
108
|
-
|
|
109
|
-
# TODO: remove new, unsaved, saved
|
|
110
|
-
obj.instance_variable_set(:@unsaved, is_unsaved)
|
|
111
|
-
obj.instance_variable_set(:@saved, !is_unsaved)
|
|
112
|
-
obj.instance_variable_set(:@new, is_new)
|
|
113
|
-
obj.instance_variable_set(:@parent, parent)
|
|
114
|
-
|
|
115
|
-
obj
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
private_class_method :preserve_meta_properties
|
|
119
|
-
|
|
120
|
-
private
|
|
121
|
-
|
|
122
|
-
def private_attributes
|
|
123
|
-
@private_attributes ||= attribute_set.reject(&:public_writer?)
|
|
124
|
-
end
|
|
125
|
-
end
|
|
126
|
-
end
|
|
127
|
-
end
|
|
128
|
-
end
|
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative 'base'
|
|
4
|
-
require_relative '../types'
|
|
5
|
-
|
|
6
|
-
module Fortnox
|
|
7
|
-
module API
|
|
8
|
-
module Model
|
|
9
|
-
class Customer < Fortnox::API::Model::Base
|
|
10
|
-
UNIQUE_ID = :customer_number
|
|
11
|
-
STUB = { name: '' }.freeze
|
|
12
|
-
|
|
13
|
-
# searchable_attributes(
|
|
14
|
-
# :city, :customer_number, :email, :name, :organisation_number,
|
|
15
|
-
# :phone1, :zip_code
|
|
16
|
-
# )
|
|
17
|
-
#
|
|
18
|
-
# sortable_attributes(
|
|
19
|
-
# :customer_number, :name
|
|
20
|
-
# )
|
|
21
|
-
#
|
|
22
|
-
# filter(
|
|
23
|
-
# :active
|
|
24
|
-
# )
|
|
25
|
-
#
|
|
26
|
-
# actions(
|
|
27
|
-
# :hire
|
|
28
|
-
# )
|
|
29
|
-
|
|
30
|
-
# Url Direct URL to the record
|
|
31
|
-
attribute :url, Types::Nullable::String.is(:read_only)
|
|
32
|
-
|
|
33
|
-
# Address1 First address of the customer. 1024 characters
|
|
34
|
-
attribute :address1, Types::Sized::String[1024]
|
|
35
|
-
|
|
36
|
-
# Address2 Second address of the customer. 1024 characters
|
|
37
|
-
attribute :address2, Types::Sized::String[1024]
|
|
38
|
-
|
|
39
|
-
# City City of the customer. 1024 characters
|
|
40
|
-
attribute :city, Types::Sized::String[1024]
|
|
41
|
-
|
|
42
|
-
# Country Country of the customer. Read-only.
|
|
43
|
-
attribute :country, Types::Nullable::String.is(:read_only)
|
|
44
|
-
|
|
45
|
-
# Comments Comments. 1024 characters.
|
|
46
|
-
attribute :comments, Types::Sized::String[1024]
|
|
47
|
-
|
|
48
|
-
# Currency Currency of the customer, 3 letters
|
|
49
|
-
attribute :currency, Types::Currency
|
|
50
|
-
|
|
51
|
-
# CostCenter Cost center of the customer, Cost center in Fortnox
|
|
52
|
-
attribute :cost_center, Types::Nullable::String
|
|
53
|
-
|
|
54
|
-
# CountryCode Country code of the customer, 2 letters
|
|
55
|
-
attribute :country_code, Types::CountryCode
|
|
56
|
-
|
|
57
|
-
# CustomerNumber Customer number. 1024 characters
|
|
58
|
-
attribute :customer_number, Types::Sized::String[1024]
|
|
59
|
-
|
|
60
|
-
# DefaultDeliveryTypes The properties for this object is listed in the table for "Default Delivery Types".
|
|
61
|
-
attribute :default_delivery_types, Types::DefaultDeliveryTypes
|
|
62
|
-
|
|
63
|
-
# The properties for this object is listed in the table for "Default Templates".
|
|
64
|
-
attribute :default_templates, Types::DefaultTemplates
|
|
65
|
-
|
|
66
|
-
# DeliveryAddress1 First delivery address of the customer. 1024 characters
|
|
67
|
-
attribute :delivery_address1, Types::Sized::String[1024]
|
|
68
|
-
|
|
69
|
-
# DeliveryAddress2 Second delivery address of the customer. 1024 characters
|
|
70
|
-
attribute :delivery_address2, Types::Sized::String[1024]
|
|
71
|
-
|
|
72
|
-
# DeliveryCity Delivery city of the customer. 1024 characters
|
|
73
|
-
attribute :delivery_city, Types::Sized::String[1024]
|
|
74
|
-
|
|
75
|
-
# DeliveryCountry Delivery country of the customer. Read-only.
|
|
76
|
-
attribute :delivery_country, Types::Nullable::String.is(:read_only)
|
|
77
|
-
|
|
78
|
-
# DeliveryCountryCode Delivery country code of the customer, 2 letters
|
|
79
|
-
attribute :delivery_country_code, Types::CountryCode
|
|
80
|
-
|
|
81
|
-
# DeliveryFax Delivery fax number of the customer. 1024 characters
|
|
82
|
-
attribute :delivery_fax, Types::Sized::String[1024]
|
|
83
|
-
|
|
84
|
-
# DeliveryName Delivery name of the customer. 1024 characters
|
|
85
|
-
attribute :delivery_name, Types::Sized::String[1024]
|
|
86
|
-
|
|
87
|
-
# DeliveryPhone1 First delivery phone number of the customer. 1024 characters
|
|
88
|
-
attribute :delivery_phone1, Types::Sized::String[1024]
|
|
89
|
-
|
|
90
|
-
# DeliveryPhone2 Second delivery phone number of the customer. 1024 characters
|
|
91
|
-
attribute :delivery_phone2, Types::Sized::String[1024]
|
|
92
|
-
|
|
93
|
-
# DeliveryZipCode Delivery zip code of the customer. 1024 characters.
|
|
94
|
-
attribute :delivery_zip_code, Types::Sized::String[1024]
|
|
95
|
-
|
|
96
|
-
# Email Email address of the customer. 1024 characters
|
|
97
|
-
attribute :email, Types::Email
|
|
98
|
-
|
|
99
|
-
# EmailInvoice Invoice email address of the customer. 1024 characters
|
|
100
|
-
attribute :email_invoice, Types::Email
|
|
101
|
-
|
|
102
|
-
# EmailInvoiceBCC Invoice BCC email address of the customer. 1024 characters
|
|
103
|
-
attribute :email_invoice_bcc, Types::Email
|
|
104
|
-
|
|
105
|
-
# EmailInvoiceCC Invoice CC email address of the customer. 1024 characters
|
|
106
|
-
attribute :email_invoice_cc, Types::Email
|
|
107
|
-
|
|
108
|
-
# EmailOffer Offer email address of the customer. 1024 characters
|
|
109
|
-
attribute :email_offer, Types::Email
|
|
110
|
-
|
|
111
|
-
# EmailOfferBCC Offer BCC email address of the customer. 1024 characters
|
|
112
|
-
attribute :email_offer_bcc, Types::Email
|
|
113
|
-
|
|
114
|
-
# EmailOfferCC Offer CC email address of the customer. 1024 characters
|
|
115
|
-
attribute :email_offer_cc, Types::Email
|
|
116
|
-
|
|
117
|
-
# EmailOrder Order email address of the customer. 1024 characters
|
|
118
|
-
attribute :email_order, Types::Email
|
|
119
|
-
|
|
120
|
-
# EmailOrderBCC Order BCC email address of the customer. 1024 characters
|
|
121
|
-
attribute :email_order_bcc, Types::Email
|
|
122
|
-
|
|
123
|
-
# EmailOrderCC Order CC email address of the customer. 1024 characters
|
|
124
|
-
attribute :email_order_cc, Types::Email
|
|
125
|
-
|
|
126
|
-
# Fax Fax number of the customer. 1024 characters
|
|
127
|
-
attribute :fax, Types::Sized::String[1024]
|
|
128
|
-
|
|
129
|
-
# InvoiceAdministrationFee Invoice administration fee of the customer, 12 digits (incl. decimals).
|
|
130
|
-
attribute :invoice_administration_fee,
|
|
131
|
-
Types::Sized::Float[0.0, 99_999_999_999.9]
|
|
132
|
-
|
|
133
|
-
# InvoiceDiscount Invoice discount of the customer, 12 digits (incl. decimals)
|
|
134
|
-
attribute :invoice_discount, Types::Sized::Float[0.0, 99_999_999_999.9]
|
|
135
|
-
|
|
136
|
-
# InvoiceFreight Invoice freight fee of the customer, 12 digits (incl. decimals)
|
|
137
|
-
attribute :invoice_freight, Types::Sized::Float[0.0, 99_999_999_999.9]
|
|
138
|
-
|
|
139
|
-
# InvoiceRemark Invoice remark of the customer. 1024 characters
|
|
140
|
-
attribute :invoice_remark, Types::Sized::String[1024]
|
|
141
|
-
|
|
142
|
-
# Name Name of the customer, 1024 characters
|
|
143
|
-
attribute :name, Types::Sized::String[1024].is(:required)
|
|
144
|
-
|
|
145
|
-
# OrganisationNumber Organisation number of the customer. 30 characters
|
|
146
|
-
attribute :organisation_number, Types::Sized::String[30]
|
|
147
|
-
|
|
148
|
-
# OurReference Our reference of the customer. 50 characters
|
|
149
|
-
attribute :our_reference, Types::Sized::String[50]
|
|
150
|
-
|
|
151
|
-
# Phone1 First phone number of the customer. 1024 characters
|
|
152
|
-
attribute :phone1, Types::Sized::String[1024]
|
|
153
|
-
|
|
154
|
-
# Phone2 Second phone number of the customer. 1024 characters
|
|
155
|
-
attribute :phone2, Types::Sized::String[1024]
|
|
156
|
-
|
|
157
|
-
# PriceList Price list of the customer, Price list in Fortnox
|
|
158
|
-
attribute :price_list, Types::Nullable::String
|
|
159
|
-
|
|
160
|
-
# Project Project of the customer, Project in Fortnox
|
|
161
|
-
attribute :project, Types::Nullable::String
|
|
162
|
-
|
|
163
|
-
# SalesAccount Sales account of the customer, 4 characters
|
|
164
|
-
attribute :sales_account, Types::SalesAccount
|
|
165
|
-
|
|
166
|
-
# ShowPriceVATIncluded Show prices with VAT included or not
|
|
167
|
-
attribute :show_price_vat_included, Types::Nullable::Boolean
|
|
168
|
-
|
|
169
|
-
# TermsOfDeliveryCode Terms of delivery code of the customer
|
|
170
|
-
attribute :terms_of_delivery, Types::Nullable::String
|
|
171
|
-
|
|
172
|
-
# TermsOfPaymentCode Terms of payment code of the customer
|
|
173
|
-
attribute :terms_of_payment, Types::Nullable::String
|
|
174
|
-
|
|
175
|
-
# Type Customer type, PRIVATE / COMPANY
|
|
176
|
-
attribute :type, Types::CustomerType
|
|
177
|
-
|
|
178
|
-
# VATNumber VAT number of the customer
|
|
179
|
-
attribute :vat_number, Types::Nullable::String
|
|
180
|
-
|
|
181
|
-
# VATType VAT type of the customer, SEVAT / SEREVERSEDVAT / EUREVERSEDVAT / EUVAT / EXPORT
|
|
182
|
-
attribute :vat_type, Types::VATType
|
|
183
|
-
|
|
184
|
-
# VisitAddress Visit address of the customer. 128 characters
|
|
185
|
-
attribute :visiting_address, Types::Sized::String[128]
|
|
186
|
-
|
|
187
|
-
# VisitCity Visit city of the customer. 128 characters
|
|
188
|
-
attribute :visiting_city, Types::Sized::String[128]
|
|
189
|
-
|
|
190
|
-
# VisitCountry Visit country of the customer, read-only
|
|
191
|
-
attribute :visiting_country, Types::Nullable::String.is(:read_only)
|
|
192
|
-
|
|
193
|
-
# VisitingCountryCode Code of the visiting country for the customer, 2 letters
|
|
194
|
-
attribute :visiting_country_code, Types::CountryCode
|
|
195
|
-
|
|
196
|
-
# VisitZipCode Visit zip code of the customer. 10 characters
|
|
197
|
-
attribute :visiting_zip_code, Types::Sized::String[10]
|
|
198
|
-
|
|
199
|
-
# WayOfDeliveryCode Way of delivery code of the customer
|
|
200
|
-
attribute :way_of_delivery, Types::Nullable::String
|
|
201
|
-
|
|
202
|
-
# YourReference Your reference of the customer. 50 characters
|
|
203
|
-
attribute :your_reference, Types::Sized::String[50]
|
|
204
|
-
|
|
205
|
-
# ZipCode Zip code of the customer. 10 characters
|
|
206
|
-
attribute :zip_code, Types::Sized::String[10]
|
|
207
|
-
end
|
|
208
|
-
end
|
|
209
|
-
end
|
|
210
|
-
end
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative '../types'
|
|
4
|
-
require_relative 'label'
|
|
5
|
-
|
|
6
|
-
module Fortnox
|
|
7
|
-
module API
|
|
8
|
-
module Model
|
|
9
|
-
# This model is the shared attributes for Offer, Order and Invoice, the three "docuemnt models" in Fortnox.
|
|
10
|
-
# In the Fortnox implementation these are so close together that they are saved in the same database table.
|
|
11
|
-
# This is never used standalone, only included in the respective models.
|
|
12
|
-
class Document < Fortnox::API::Model::Base
|
|
13
|
-
# Url Direct url to the record.
|
|
14
|
-
attribute :url, Types::Nullable::String.is(:read_only)
|
|
15
|
-
|
|
16
|
-
# AdministrationFee The document administration fee.
|
|
17
|
-
attribute :administration_fee, Types::Nullable::Float
|
|
18
|
-
|
|
19
|
-
# AdministrationFeeVAT VAT of the document administration fee.
|
|
20
|
-
attribute :administration_fee_vat, Types::Nullable::Float.is(:read_only)
|
|
21
|
-
|
|
22
|
-
# Address1 Document address 1. 1024 characters
|
|
23
|
-
attribute :address1, Types::Sized::String[1024]
|
|
24
|
-
|
|
25
|
-
# Address2 Document address 2. 1024 characters
|
|
26
|
-
attribute :address2, Types::Sized::String[1024]
|
|
27
|
-
|
|
28
|
-
# BasisTaxReduction Basis of tax reduction.
|
|
29
|
-
attribute :basis_tax_reduction, Types::Nullable::Float.is(:read_only)
|
|
30
|
-
|
|
31
|
-
# Cancelled If the document is cancelled.
|
|
32
|
-
attribute :cancelled, Types::Nullable::Boolean.is(:read_only)
|
|
33
|
-
|
|
34
|
-
# City City for the document address.
|
|
35
|
-
attribute :city, Types::Sized::String[1024]
|
|
36
|
-
|
|
37
|
-
# Comments Comments of the document
|
|
38
|
-
attribute :comments, Types::Sized::String[1024]
|
|
39
|
-
|
|
40
|
-
# ContributionPercent Document contribution in percent.
|
|
41
|
-
attribute :contribution_percent, Types::Nullable::Float.is(:read_only)
|
|
42
|
-
|
|
43
|
-
# ContributionValue Document contribution in amount.
|
|
44
|
-
attribute :contribution_value, Types::Nullable::Float.is(:read_only)
|
|
45
|
-
|
|
46
|
-
# Country Country for the document address.
|
|
47
|
-
attribute :country, Types::Country
|
|
48
|
-
|
|
49
|
-
# CostCenter Code of the cost center.
|
|
50
|
-
attribute :cost_center, Types::Nullable::String
|
|
51
|
-
|
|
52
|
-
# Currency Code of the currency.
|
|
53
|
-
attribute :currency, Types::Currency
|
|
54
|
-
|
|
55
|
-
# CurrencyRate Currency rate used for the document
|
|
56
|
-
attribute :currency_rate, Types::Nullable::Float
|
|
57
|
-
|
|
58
|
-
# CurrencyUnit Currency unit used for the document
|
|
59
|
-
attribute :currency_unit, Types::Nullable::Float
|
|
60
|
-
|
|
61
|
-
# CustomerName Name of the customer. 1024 characters
|
|
62
|
-
attribute :customer_name, Types::Sized::String[1024]
|
|
63
|
-
|
|
64
|
-
# CustomerNumber Customer number of the customer. Required
|
|
65
|
-
attribute :customer_number, Types::Required::String
|
|
66
|
-
|
|
67
|
-
# DeliveryAddress1 Document delivery address 1.
|
|
68
|
-
attribute :delivery_address1, Types::Sized::String[1024]
|
|
69
|
-
|
|
70
|
-
# DeliveryAddress2 Document delivery address 2.
|
|
71
|
-
attribute :delivery_address2, Types::Sized::String[1024]
|
|
72
|
-
|
|
73
|
-
# DeliveryCity City for the document delivery address.
|
|
74
|
-
attribute :delivery_city, Types::Sized::String[1024]
|
|
75
|
-
|
|
76
|
-
# DeliveryCountry Country for the document delivery address.
|
|
77
|
-
attribute :delivery_country, Types::Country
|
|
78
|
-
|
|
79
|
-
# DeliveryDate Date of delivery.
|
|
80
|
-
attribute :delivery_date, Types::Nullable::Date
|
|
81
|
-
|
|
82
|
-
# DeliveryName Name of the recipient of the delivery
|
|
83
|
-
attribute :delivery_name, Types::Sized::String[1024]
|
|
84
|
-
|
|
85
|
-
# DeliveryZipCode ZipCode for the document delivery address.
|
|
86
|
-
attribute :delivery_zip_code, Types::Sized::String[1024]
|
|
87
|
-
|
|
88
|
-
# DocumentNumber The document number.
|
|
89
|
-
attribute :document_number, Types::Nullable::Integer
|
|
90
|
-
|
|
91
|
-
# EmailInformation Separete EmailInformation object
|
|
92
|
-
attribute :email_information, Types::EmailInformation
|
|
93
|
-
|
|
94
|
-
# ExternalInvoiceReference1 External document reference 1. 80 characters
|
|
95
|
-
attribute :external_invoice_reference1, Types::Sized::String[80]
|
|
96
|
-
|
|
97
|
-
# ExternalInvoiceReference2 External document reference 2. 80 characters
|
|
98
|
-
attribute :external_invoice_reference2, Types::Sized::String[80]
|
|
99
|
-
|
|
100
|
-
# Freight Freight cost of the document. 12 digits (incl. decimals)
|
|
101
|
-
attribute :freight, Types::Sized::Float[0.0, 99_999_999_999.9]
|
|
102
|
-
|
|
103
|
-
# FreightVAT VAT of the freight cost.
|
|
104
|
-
attribute :freight_vat, Types::Nullable::Float.is(:read_only)
|
|
105
|
-
|
|
106
|
-
# Gross Gross value of the document
|
|
107
|
-
attribute :gross, Types::Nullable::Float.is(:read_only)
|
|
108
|
-
|
|
109
|
-
# HouseWork If there is any row of the document marked "housework".
|
|
110
|
-
attribute :housework, Types::Nullable::Boolean.is(:read_only)
|
|
111
|
-
|
|
112
|
-
attribute :labels, Types::Strict::Array.of(Label)
|
|
113
|
-
|
|
114
|
-
# Net Net amount
|
|
115
|
-
attribute :net, Types::Nullable::Float.is(:read_only)
|
|
116
|
-
|
|
117
|
-
# NotCompleted If the document is set as not completed.
|
|
118
|
-
attribute :not_completed, Types::Nullable::Boolean
|
|
119
|
-
|
|
120
|
-
# OfferReference Reference to the offer, if one exists.
|
|
121
|
-
attribute :offer_reference, Types::Nullable::Integer.is(:read_only)
|
|
122
|
-
|
|
123
|
-
# OrganisationNumber Organisation number of the customer for the
|
|
124
|
-
# document.
|
|
125
|
-
attribute :organisation_number, Types::Nullable::String.is(:read_only)
|
|
126
|
-
|
|
127
|
-
# OurReference Our reference. 50 characters
|
|
128
|
-
attribute :our_reference, Types::Sized::String[50]
|
|
129
|
-
|
|
130
|
-
# Phone1 Phone number 1 of the customer for the document. 1024 characters
|
|
131
|
-
attribute :phone1, Types::Sized::String[1024]
|
|
132
|
-
|
|
133
|
-
# Phone2 Phone number 2 of the customer for the document. 1024 characters
|
|
134
|
-
attribute :phone2, Types::Sized::String[1024]
|
|
135
|
-
|
|
136
|
-
# PriceList Code of the price list.
|
|
137
|
-
attribute :price_list, Types::Nullable::String
|
|
138
|
-
|
|
139
|
-
# PrintTemplate Print template of the document.
|
|
140
|
-
attribute :print_template, Types::Nullable::String
|
|
141
|
-
|
|
142
|
-
# Project Code of the project.
|
|
143
|
-
attribute :project, Types::Nullable::String
|
|
144
|
-
|
|
145
|
-
# Remarks Remarks of the document. 1024 characters
|
|
146
|
-
attribute :remarks, Types::Sized::String[1024]
|
|
147
|
-
|
|
148
|
-
# RoundOff Round off amount for the document.
|
|
149
|
-
attribute :round_off, Types::Nullable::Float.is(:read_only)
|
|
150
|
-
|
|
151
|
-
# Sent If the document is printed or sent in any way.
|
|
152
|
-
attribute :sent, Types::Nullable::Boolean.is(:read_only)
|
|
153
|
-
|
|
154
|
-
# TaxReduction The amount of tax reduction.
|
|
155
|
-
attribute :tax_reduction, Types::Nullable::Integer.is(:read_only)
|
|
156
|
-
|
|
157
|
-
# TaxReductionType Tax Reduction Type
|
|
158
|
-
attribute :tax_reduction_type, Types::TaxReductionType
|
|
159
|
-
|
|
160
|
-
# TermsOfDelivery Code of the terms of delivery.
|
|
161
|
-
attribute :terms_of_delivery, Types::Nullable::String
|
|
162
|
-
|
|
163
|
-
# TermsOfPayment Code of the terms of payment.
|
|
164
|
-
attribute :terms_of_payment, Types::Nullable::String
|
|
165
|
-
|
|
166
|
-
# Total The total amount of the document.
|
|
167
|
-
attribute :total, Types::Nullable::Float.is(:read_only)
|
|
168
|
-
|
|
169
|
-
# TotalVAT The total VAT amount of the document.
|
|
170
|
-
attribute :total_vat, Types::Nullable::Float.is(:read_only)
|
|
171
|
-
|
|
172
|
-
# VATIncluded If the price of the document is including VAT.
|
|
173
|
-
attribute :vat_included, Types::Nullable::Boolean
|
|
174
|
-
|
|
175
|
-
# WayOfDelivery Code of the way of delivery.
|
|
176
|
-
attribute :way_of_delivery, Types::Nullable::String
|
|
177
|
-
|
|
178
|
-
# YourOrderNumber Your order number. 30 characters
|
|
179
|
-
attribute :your_order_number, Types::Sized::String[30]
|
|
180
|
-
|
|
181
|
-
# YourReference Your reference. 50 characters
|
|
182
|
-
attribute :your_reference, Types::Sized::String[50]
|
|
183
|
-
|
|
184
|
-
# ZipCode Zip code of the document. 1024 characters
|
|
185
|
-
attribute :zip_code, Types::Sized::String[1024]
|
|
186
|
-
end
|
|
187
|
-
end
|
|
188
|
-
end
|
|
189
|
-
end
|