Class: Fog::Network::OpenStack::Network
- Defined in:
- lib/fog/openstack/models/network/network.rb
Instance Attribute Summary
Attributes inherited from Model
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
-
#initialize(attributes) ⇒ Network
constructor
A new instance of Network.
- #save ⇒ Object
- #update ⇒ Object
Methods inherited from Model
#inspect, #reload, #symbolize_keys, #to_json, #wait_for
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one
Constructor Details
#initialize(attributes) ⇒ Network
Returns a new instance of Network.
16 17 18 19 |
# File 'lib/fog/openstack/models/network/network.rb', line 16 def initialize(attributes) @connection = attributes[:connection] super end |
Instance Method Details
#create ⇒ Object
25 26 27 28 |
# File 'lib/fog/openstack/models/network/network.rb', line 25 def create merge_attributes(connection.create_network(self.attributes).body['network']) self end |
#destroy ⇒ Object
37 38 39 40 41 |
# File 'lib/fog/openstack/models/network/network.rb', line 37 def destroy requires :id connection.delete_network(self.id) true end |
#save ⇒ Object
21 22 23 |
# File 'lib/fog/openstack/models/network/network.rb', line 21 def save identity ? update : create end |
#update ⇒ Object
30 31 32 33 34 35 |
# File 'lib/fog/openstack/models/network/network.rb', line 30 def update requires :id merge_attributes(connection.update_network(self.id, self.attributes).body['network']) self end |