diff --git a/lib/fortnox/api/models/article.rb b/lib/fortnox/api/models/article.rb index 66c74236..c1d70ad7 100644 --- a/lib/fortnox/api/models/article.rb +++ b/lib/fortnox/api/models/article.rb @@ -73,10 +73,10 @@ class Article < Fortnox::API::Model::Base attribute :purchase_account, Types::Sized::Integer[0, 9_999] # PurchasePrice Purchase price of the article - attribute :purchase_price, Types::Sized::Float[0.0, 99_999_999_999_999.9] + attribute :purchase_price, Types::Sized::Float[-9_999_999_999_999.9, 9_999_999_999_999.9] # QuantityInStock Quantity in stock of the article - attribute :quantity_in_stock, Types::Sized::Float[0.0, 99_999_999_999_999.9] + attribute :quantity_in_stock, Types::Sized::Float[-9_999_999_999_999.9, 9_999_999_999_999.9] # ReservedQuantity Reserved quantity of the article attribute :reserved_quantity, Types::Nullable::Float.is(:read_only) @@ -98,7 +98,7 @@ class Article < Fortnox::API::Model::Base attribute :stock_value, Types::Nullable::Float.is(:read_only) # StockWarning When to start warning for low quantity in stock - attribute :stock_warning, Types::Sized::Float[0.0, 99_999_999_999_999.9] + attribute :stock_warning, Types::Sized::Float[-9_999_999_999_999.9, 9_999_999_999_999.9] # SupplierName Name of the supplier attribute :supplier_name, Types::Nullable::String.is(:read_only) diff --git a/lib/fortnox/api/types/document_row.rb b/lib/fortnox/api/types/document_row.rb index 9d8ba6e8..adda4d80 100644 --- a/lib/fortnox/api/types/document_row.rb +++ b/lib/fortnox/api/types/document_row.rb @@ -20,16 +20,14 @@ class DocumentRow < Fortnox::API::Types::Model attribute :cost_center, Types::Nullable::String # DeliveredQuantity Delivered quantity. 14 digits - attribute :delivered_quantity, Types::Sized::Float[-9_999_999_999_999.9, 9_999_999_999_999.9] + attribute :delivered_quantity, Types::Sized::Float[-999_999.9, 999_999.9] # Description Description Row description. 50 characters attribute :description, Types::Sized::String[50] # Discount amount. 12 digits (for amount) / 5 digits (for percent) - # TODO(hannes): Verify that we can send in more than 5 digits through - # the actual API for DiscountType PERCENT. This cannot be done until - # we fix issue #62... - attribute :discount, Types::Sized::Float[0.0, 99_999_999_999.9] + # TODO: Should be [-100.0, 100.0] for DiscountType PERCENT. + attribute :discount, Types::Sized::Float[-9_999_999_999.9, 9_999_999_999.9] # DiscountType The type of discount used for the row. attribute :discount_type, Types::DiscountType @@ -45,7 +43,7 @@ class DocumentRow < Fortnox::API::Types::Model attribute :housework_type, Types::HouseworkType # Price Price per unit. 12 digits - attribute :price, Types::Sized::Float[0.0, 99_999_999_999.9] + attribute :price, Types::Sized::Float[-9_999_999_999.9, 9_999_999_999.9] # Project Code of the project for the row. attribute :project, Types::Nullable::String diff --git a/spec/fortnox/api/types/examples/document_row.rb b/spec/fortnox/api/types/examples/document_row.rb index 2c5af10f..bb419e7f 100644 --- a/spec/fortnox/api/types/examples/document_row.rb +++ b/spec/fortnox/api/types/examples/document_row.rb @@ -12,14 +12,7 @@ it { is_expected.to have_housework_type(:housework_type, valid_hash) } - it { is_expected.to have_sized_float(:price, 0.0, 99_999_999_999.9, valid_hash) } - - it do - is_expected.to have_sized_float( - :delivered_quantity, - -9_999_999_999_999.9, - 9_999_999_999_999.9, - valid_hash - ) - end + it { is_expected.to have_sized_float(:discount, -9_999_999_999.9, 9_999_999_999.9, valid_hash) } + it { is_expected.to have_sized_float(:price, -9_999_999_999.9, 9_999_999_999.9, valid_hash) } + it { is_expected.to have_sized_float(:delivered_quantity, -999_999.9, 999_999.9, valid_hash) } end