Class: Vultr::PrivateNetworksResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/vultr/resources/private_networks.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Vultr::Resource

Instance Method Details

#create(**attributes) ⇒ Object



8
9
10
# File 'lib/vultr/resources/private_networks.rb', line 8

def create(**attributes)
  PrivateNetwork.new post_request("private-networks", body: attributes).body.dig("network")
end

#delete(network_id:) ⇒ Object



20
21
22
# File 'lib/vultr/resources/private_networks.rb', line 20

def delete(network_id:)
  delete_request("private-networks/#{network_id}")
end

#list(**params) ⇒ Object



3
4
5
6
# File 'lib/vultr/resources/private_networks.rb', line 3

def list(**params)
  response = get_request("private-networks", params: params)
  Collection.from_response(response, key: "networks", type: PrivateNetwork)
end

#retrieve(network_id:) ⇒ Object



12
13
14
# File 'lib/vultr/resources/private_networks.rb', line 12

def retrieve(network_id:)
  PrivateNetwork.new get_request("private-networks/#{network_id}").body.dig("network")
end

#update(network_id:, **attributes) ⇒ Object



16
17
18
# File 'lib/vultr/resources/private_networks.rb', line 16

def update(network_id:, **attributes)
  put_request("private-networks/#{network_id}", body: attributes)
end