Sha256: db6a4c42ea84051544890384a641f79569135b7669cf235c57547637c560e703

Contents?: true

Size: 1.73 KB

Versions: 9

Compression:

Stored size: 1.73 KB

Contents

module Fog
  class Vcloud
    module Terremark
      class Ecloud
        module Shared
          private

          def generate_configure_node_request(node_data)
            builder = Builder::XmlMarkup.new
            builder.NodeService(:"xmlns:i" => "http://www.w3.org/2001/XMLSchema-instance",
                                    :xmlns => "urn:tmrk:eCloudExtensions-2.0") {
              builder.Name(node_data[:name])
              builder.Enabled(node_data[:enabled].to_s)
              builder.Description(node_data[:description])
            }
          end

        end

        class Real
          include Shared

          def configure_node(node_uri, node_data)
            validate_node_data(node_data, true)

            request(
              :body     => generate_configure_node_request(node_data),
              :expects  => 200,
              :headers  => {'Content-Type' => 'application/vnd.tmrk.ecloud.nodeService+xml'},
              :method   => 'PUT',
              :uri      => node_uri,
              :parse    => true
            )
          end

        end

        class Mock
          include Shared

          def configure_node(node_uri, node_data)
            node_uri = ensure_unparsed(node_uri)

            validate_node_data(node_data, true)

            if node = mock_node_from_url(node_uri)
              node[:name] = node_data[:name]
              node[:enabled] = node_data[:enabled]
              node[:description] = node_data[:description]
              mock_it 200, mock_node_service_response(node, ecloud_xmlns), { 'Content-Type' => 'application/vnd.tmrk.ecloud.nodeService+xml' }
            else
              mock_error 200, "401 Unauthorized"
            end
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
fog-0.3.16 lib/fog/vcloud/terremark/ecloud/requests/configure_node.rb
fog-0.3.15 lib/fog/vcloud/terremark/ecloud/requests/configure_node.rb
fog-0.3.14 lib/fog/vcloud/terremark/ecloud/requests/configure_node.rb
fog-0.3.13 lib/fog/vcloud/terremark/ecloud/requests/configure_node.rb
fog-0.3.12 lib/fog/vcloud/terremark/ecloud/requests/configure_node.rb
fog-0.3.11 lib/fog/vcloud/terremark/ecloud/requests/configure_node.rb
fog-0.3.10 lib/fog/vcloud/terremark/ecloud/requests/configure_node.rb
fog-0.3.9 lib/fog/vcloud/terremark/ecloud/requests/configure_node.rb
fog-0.3.8 lib/fog/vcloud/terremark/ecloud/requests/configure_node.rb