Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/netbox_client_ruby/api/ipam.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ module IPAM
services: Services,
vlans: Vlans,
vlan_groups: VlanGroups,
vrfs: Vrfs
vrfs: Vrfs,
asns: Asns
}.each_pair do |method_name, class_name|
define_method(method_name) { class_name.new }
module_function(method_name)
Expand All @@ -28,7 +29,8 @@ module IPAM
service: Service,
vlan: Vlan,
vlan_group: VlanGroup,
vrf: Vrf
vrf: Vrf,
asn: Asn
}.each_pair do |method_name, class_name|
define_method(method_name) { |id| class_name.new id }
module_function(method_name)
Expand Down
18 changes: 18 additions & 0 deletions lib/netbox_client_ruby/api/ipam/asn.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

module NetboxClientRuby
module IPAM
class Asn
include Entity

id id: :id
deletable true
path 'ipam/asns/:id/'
creation_path 'ipam/asns/'
object_fields(
tenant: proc { |raw_data| Tenancy::Tenant.new raw_data['id'] }
)
end

end
end
20 changes: 20 additions & 0 deletions lib/netbox_client_ruby/api/ipam/asns.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true

module NetboxClientRuby
module IPAM
class Asns
include Entities

path 'ipam/asns/'
data_key 'results'
count_key 'count'
entity_creator :entity_creator

private

def entity_creator(raw_entity)
Asn.new raw_entity['id']
end
end
end
end
Loading