You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by ma...@redhat.com on 2011/08/19 14:42:29 UTC

[PATCH 1/3] Replace 'blob' with 'blob_id' in create blob operation Change also made to API docs for site with reference to 'blob' parameter in POST create blob.

From: marios <ma...@redhat.com>


Signed-off-by: marios <ma...@redhat.com>
---
 client/lib/client_bucket_methods.rb |    2 +-
 server/server.rb                    |    2 +-
 server/views/blobs/new.html.haml    |    2 +-
 site/content/api.mdown              |    8 ++++----
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/client/lib/client_bucket_methods.rb b/client/lib/client_bucket_methods.rb
index 382b108..44eca0f 100644
--- a/client/lib/client_bucket_methods.rb
+++ b/client/lib/client_bucket_methods.rb
@@ -42,7 +42,7 @@ module ClientBucketMethods
       end
       headers = headers.merge(metadata_headers)
     end
-    resource.send(:post, {:blob_data => File.new(params['file_path'], 'rb'), :blob => params[:id]}, headers) do |response, request, block|
+    resource.send(:post, {:blob_data => File.new(params['file_path'], 'rb'), :blob_id => params[:id]}, headers) do |response, request, block|
       handle_backend_error(response) if response.code.eql?(500)
       blob = base_object(:blob, response)
       yield blob if block_given?
diff --git a/server/server.rb b/server/server.rb
index 3427549..231a89e 100644
--- a/server/server.rb
+++ b/server/server.rb
@@ -789,7 +789,7 @@ end
 #create a new blob using html interface - NON STREAMING (i.e. browser POST http form data)
 post "#{Sinatra::UrlForHelper::DEFAULT_URI_PREFIX}/buckets/:bucket" do
   bucket_id = params[:bucket]
-  blob_id = params['blob'] || params['blob_id']
+  blob_id = params['blob_id'] || params['blob'] #keep 'blob' just in case
   blob_data = params['blob_data']
   user_meta = {}
   #metadata from params (i.e., passed by http form post, e.g. browser)
diff --git a/server/views/blobs/new.html.haml b/server/views/blobs/new.html.haml
index f7a99e8..abfe24e 100644
--- a/server/views/blobs/new.html.haml
+++ b/server/views/blobs/new.html.haml
@@ -5,7 +5,7 @@
     %div{ 'data-role' => :fieldcontain }
       %label
         Blob Name:
-      %input{ :name => 'blob', :size => 512}/
+      %input{ :name => 'blob_id', :size => 512}/
       %input{ :type => "hidden", :name => "meta_params", :value => "0"}
     %a{ :href => "javascript:;", :onclick => "more_fields();"} Add Metadata
     %div{ :id => "metadata_holder", :style => "display: none;", :'data-role' => :fieldcontain}
diff --git a/site/content/api.mdown b/site/content/api.mdown
index 6fbed21..757332f 100644
--- a/site/content/api.mdown
+++ b/site/content/api.mdown
@@ -3214,8 +3214,8 @@ The deltacloud server also responds to an alternative `POST` route for creating
 updating a ***blob*** object. As with the `PUT` method for creating/updating a
 ***blob***, the client must specify the ***bucket*** in which the ***blob*** is to
 be created through the call URI (i.e. you `POST` to the specified ***bucket***).
-The rest of the required fields, that is, the name of the ***blob***, the
- ***blob_data*** and the ***content-length*** are specified by the client as
+The rest of the required fields, that is, the ***blob_id*** (name of the blob),
+the  ***blob_data*** and the ***content-length*** are specified by the client as
 ***multipart/form-data*** (i.e. in `HTTP POST` form fields).
 
 In order to specify the optional user metadata for a given ***blob*** the client
@@ -3240,12 +3240,12 @@ deltacloud HTML interface (provided for testing purposes).
     Authorization: Basic AU1J3UB2121Afd1DdyQWxLaTYTmJMNF4zTXBoRGdhMDh2RUw5ZDAN9zVXVa==
     User-Agent: curl/7.20.1 (i386-redhat-linux-gnu) libcurl/7.20.1 N
     Accept: */*
-    Content-Length: 113582
+    Content-Length: 113584
     Expect: 100-continue
     Content-Type: multipart/form-data; boundary=----------------------------517f5f2df858
 
     ------------------------------517f5f2df858
-    Content-Disposition: form-data; name="blob"
+    Content-Disposition: form-data; name="blob_id"
 
     12Jul2011blob
     ------------------------------517f5f2df858
-- 
1.7.3.4