lib/netbox_client_ruby/api/ipam/prefix.rb in netbox-client-ruby-0.2.3 vs lib/netbox_client_ruby/api/ipam/prefix.rb in netbox-client-ruby-0.3.0

- old
+ new

@@ -19,33 +19,22 @@ object_fields( site: proc { |raw_data| DCIM::Site.new raw_data['id'] }, vrf: proc { |raw_data| Vrf.new raw_data['id'] }, tenant: proc { |raw_data| Tenancy::Tenant.new raw_data['id'] }, vlan: proc { |raw_data| Vlan.new raw_data['id'] }, - status: proc { |raw_data| PrefixStatus.new raw_data['value'] }, + status: proc { |raw_data| PrefixStatus.new raw_data }, role: proc { |raw_data| Role.new raw_data['id'] }, prefix: proc { |raw_data| IPAddress.parse raw_data } ) readonly_fields :display_name end class PrefixStatus attr_reader :value, :label - def initialize(status_value) - @value = status_value - @label = case status_value - when 0 then - 'Container'.freeze - when 1 then - 'Active'.freeze - when 2 then - 'Reserved'.freeze - when 3 then - 'Deprecated'.freeze - else - 'UNDEFINED'.freeze - end + def initialize(raw_data) + @value = raw_data['value'] + @label = raw_data['label'] end end end end