Currently, the gem does not support resetting values in Fortnox. So if you set for instance Invoice comments field to something and save the resource to Fortnox, you cannot set the value back to nil with this gem.
The problem lies in Fortnox::API::Mapper::ToJson.sanitise:
def sanitise(hash, keys_to_filter)
hash.reject do |key, value|
next false if keys_to_filter.include?(key)
value.nil?
end
end
We reject nil values to avoid sending a lot of nil values to Fortnox when creating a new resource. We need a more sophisticated solution here.
We can probably compare the current model with it's parent to find out what attributes has explicitly been set to nil.
Currently, the gem does not support resetting values in Fortnox. So if you set for instance
Invoicecommentsfield to something and save the resource to Fortnox, you cannot set the value back tonilwith this gem.The problem lies in
Fortnox::API::Mapper::ToJson.sanitise:We reject
nilvalues to avoid sending a lot ofnilvalues to Fortnox when creating a new resource. We need a more sophisticated solution here.We can probably compare the current model with it's parent to find out what attributes has explicitly been set to
nil.