Method: Clouder::Entity.get

Defined in:
lib/clouder/entity.rb

.get(id_or_uri) ⇒ Object

Retrieves an existing object with the given id or uri. Returns nil if the object is not found.

note = Note.get("ce655c90-cf09-012b-cd41-0016cb91f13d")


61
62
63
64
65
66
67
68
69
# File 'lib/clouder/entity.rb', line 61

def get(id_or_uri)
  uri = uri_from_id(id_or_uri)
  document = Rest.get(uri)
  new({'uri' => uri, 'etag' => document.headers[:etag], 
      'last_modified' => document.headers[:last_modified],
      'document' => document })
rescue RestClient::ResourceNotFound
  nil
end