Module: Restful::Request

Extended by:
Request
Included in:
Request
Defined in:
lib/dm-restful-adapter/request.rb

Instance Method Summary collapse

Instance Method Details

#delete(storage_name, id) ⇒ Object



17
18
19
# File 'lib/dm-restful-adapter/request.rb', line 17

def delete(storage_name, id)
  Configuration.backend.call(:delete, resourceify(storage_name, id))
end

#get(storage_name, attrs) ⇒ Object



9
10
11
# File 'lib/dm-restful-adapter/request.rb', line 9

def get(storage_name, attrs)
  Configuration.backend.call(:get, resourceify(storage_name), attrs)
end

#post(storage_name, attrs) ⇒ Object



5
6
7
# File 'lib/dm-restful-adapter/request.rb', line 5

def post(storage_name, attrs)
  Configuration.backend.call(:post, resourceify(storage_name), storage_name.singularize => attrs)
end

#put(storage_name, id, attrs) ⇒ Object



13
14
15
# File 'lib/dm-restful-adapter/request.rb', line 13

def put(storage_name, id, attrs)
  Configuration.backend.call(:put, resourceify(storage_name, id), storage_name.singularize => attrs)
end

#resourceify(storage_name, id = nil) ⇒ Object



21
22
23
# File 'lib/dm-restful-adapter/request.rb', line 21

def resourceify(storage_name, id=nil)
  [Configuration.domain, storage_name, id].compact.join('/')
end