Class: DataCatalog::Favorite

Inherits:
Base
  • Object
show all
Defined in:
lib/resources/favorite.rb

Class Method Summary collapse

Methods inherited from Base

_first, check_status, cursor, error, filterize, filterize_hash, http_delete, http_get, http_post, http_put, one, query_hash

Class Method Details

.all(conditions = {}) ⇒ Object



5
6
7
# File 'lib/resources/favorite.rb', line 5

def self.all(conditions={})
  cursor(uri, query_hash(conditions))
end

.create(params = {}) ⇒ Object



9
10
11
# File 'lib/resources/favorite.rb', line 9

def self.create(params={})
  one(http_post(uri, :body => params))
end

.destroy(id) ⇒ Object



13
14
15
# File 'lib/resources/favorite.rb', line 13

def self.destroy(id)
  one(http_delete(uri(id)))
end

.first(conditions = {}) ⇒ Object



17
18
19
# File 'lib/resources/favorite.rb', line 17

def self.first(conditions={})
  _first(http_get(uri, :query => query_hash(conditions)))
end

.get(id) ⇒ Object



21
22
23
# File 'lib/resources/favorite.rb', line 21

def self.get(id)
  one(http_get(uri(id)))
end

.update(id, params = {}) ⇒ Object



25
26
27
# File 'lib/resources/favorite.rb', line 25

def self.update(id, params={})
  one(http_put(uri(id), :body => params))
end

.uri(id = nil) ⇒ Object

Helpers



31
32
33
# File 'lib/resources/favorite.rb', line 31

def self.uri(id=nil)
  "/favorites/#{id}"
end