Class: NorthPoleWrapper::Resource

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/north_pole_wrapper.rb

Direct Known Subclasses

Storage, User

Class Method Summary collapse

Class Method Details

.create(h) ⇒ Object

base_uri ‘localhost:3000’



19
20
21
# File 'lib/north_pole_wrapper.rb', line 19

def self.create h
  post("/#{klass}.json", { :body => h.to_json } )
end

.destroy(h) ⇒ Object



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

def self.destroy h
  delete("/#{klass}.json", { :query => h } )
end

.find(h) ⇒ Object



23
24
25
# File 'lib/north_pole_wrapper.rb', line 23

def self.find h
  get("/#{klass}.json", { :query => h } )
end

.klassObject



35
36
37
# File 'lib/north_pole_wrapper.rb', line 35

def self.klass
  to_s.downcase.split(':').last
end

.update(h) ⇒ Object



27
28
29
# File 'lib/north_pole_wrapper.rb', line 27

def self.update h
  put("/#{klass}.json", { :body => h.to_json } )
end