class AppEngineUtils::Datastore::Blob

Public Instance Methods

create(blob) click to toggle source
# File lib/appengine-utils/datastore/blob.rb, line 7
def create(blob)
  @blob = AppEngine::Datastore::Blob.new(blob).to_java
  entity = AppEngine::Datastore::Entity.new("Blob")
  entity['blob']=@blob
  key = AppEngine::Datastore.put(entity)
  key.to_s
end
delete(key) click to toggle source
# File lib/appengine-utils/datastore/blob.rb, line 35
def delete(key)
  datastore_key = AppEngine::Datastore::Key.new(key)
  result = AppEngine::Datastore.delete(datastore_key)
  result
end
read(key) click to toggle source
# File lib/appengine-utils/datastore/blob.rb, line 15
def read(key)
  result = nil
  
  begin
    datastore_key = AppEngine::Datastore::Key.new(key)
    entity = AppEngine::Datastore.get(datastore_key)
    result = entity['blob']
  rescue AppEngine::Datastore::EntityNotFound
    result = nil 
  end
  result
  
end
update(key,dataset) click to toggle source
# File lib/appengine-utils/datastore/blob.rb, line 29
def update(key,dataset)
  delete(key)
  new_key = create(dataset)
  new_key
end