From 46692ca6c674458f7e449308fce0f4d7b60e3208 Mon Sep 17 00:00:00 2001 From: thde Date: Tue, 29 Oct 2024 10:27:44 +0100 Subject: [PATCH] fix: ipam interface should check on virtualmachine nil state --- lib/netbox_client_ruby/api/ipam/ip_address.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/netbox_client_ruby/api/ipam/ip_address.rb b/lib/netbox_client_ruby/api/ipam/ip_address.rb index 0d73890..6661b19 100644 --- a/lib/netbox_client_ruby/api/ipam/ip_address.rb +++ b/lib/netbox_client_ruby/api/ipam/ip_address.rb @@ -33,12 +33,8 @@ def interface interface_data = data['interface'] return nil unless interface_data - - if interface_data.key?('virtual_machine') - Virtualization::Interface.new interface_data['id'] - else - DCIM::Interface.new interface_data['id'] - end + return Virtualization::Interface.new interface_data['id'] unless interface_data.dig('virtual_machine').nil? + return DCIM::Interface.new interface_data['id'] end end end