tolerate empty string result from Fiken API
CI / test (3.1) (push) Successful in 35s
CI / test (3.2) (push) Successful in 33s
CI / test (3.3) (push) Successful in 33s

This commit is contained in:
2026-06-23 14:52:51 +02:00
parent 5f2074ee25
commit edc0b2945b
2 changed files with 6 additions and 1 deletions
+2 -1
View File
@@ -12,7 +12,8 @@ module Fiken
class Object
def initialize(attributes = {})
@attributes = {}
(attributes || {}).each { |key, value| @attributes[key.to_sym] = wrap(value) }
attributes = {} unless attributes.is_a?(Hash)
attributes.each { |key, value| @attributes[key.to_sym] = wrap(value) }
end
def [](key)
+4
View File
@@ -46,4 +46,8 @@ RSpec.describe Fiken::Object do
expect(object.key?(:invoiceNumber)).to be(true)
expect(object.key?(:missing)).to be(false)
end
it "treats a non-Hash body (e.g. empty string from a 204 response) as empty" do
expect(described_class.new("").keys).to eq([])
end
end