Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/fortnox/api/models/article.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
10 changes: 4 additions & 6 deletions lib/fortnox/api/types/document_row.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
13 changes: 3 additions & 10 deletions spec/fortnox/api/types/examples/document_row.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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