Sha256: 028738a80179f076ae6ced542f170f87a1ddfe22cc1bf41235a394830bbaaba9

Contents?: true

Size: 1.17 KB

Versions: 46

Compression:

Stored size: 1.17 KB

Contents

module Fog
  class Vcloud
    module Terremark
      class Ecloud
        class Node < Fog::Vcloud::Model

          identity :href, :aliases => :Href

          ignore_attributes :xmlns, :xmlns_i
          
          attribute :ip_address, :aliases => :IpAddress
          attribute :description, :aliases => :Description
          attribute :name, :aliases => :Name
          attribute :port, :aliases => :Port
          attribute :enabled, :aliases => :Enabled
          attribute :id, :aliases => :Id

          def delete
            requires :href

            connection.delete_node( href )
          end

          def save
            if new_record?
              result = connection.add_node( collection.href, _compose_node_data )
              merge_attributes(result.body)
            else
              connection.configure_node( href, _compose_node_data )
            end
          end

          private

          def _compose_node_data
            node_data = {}
            self.class.attributes.select{ |attribute| !send(attribute).nil? }.each { |attribute| node_data[attribute] = send(attribute).to_s }
            node_data
          end

        end
      end
    end
  end
end


Version data entries

46 entries across 46 versions & 3 rubygems

Version Path
fog-0.5.3 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.5.2 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.5.1 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.5.0 lib/fog/vcloud/terremark/ecloud/models/node.rb
phpfog-fog-0.4.1.3 lib/fog/vcloud/terremark/ecloud/models/node.rb
phpfog-fog-0.4.1.2 lib/fog/vcloud/terremark/ecloud/models/node.rb
phpfog-fog-0.4.1.1 lib/fog/vcloud/terremark/ecloud/models/node.rb
phpfog-fog-0.4.1 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.4.1 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.4.0 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.3.34 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.3.33 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.3.32 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.3.31 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.3.30 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.3.29 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.3.28 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.3.27 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.3.26 lib/fog/vcloud/terremark/ecloud/models/node.rb
fog-0.3.25 lib/fog/vcloud/terremark/ecloud/models/node.rb