Skip to content

Resetting values in Fortnox #172

@ehannes

Description

@ehannes

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions