Module: Whiplash::App::FinderMethods
- Included in:
- Whiplash::App
- Defined in:
- lib/whiplash/app/finder_methods.rb
Instance Method Summary collapse
- #count(resource, params = {}, headers = nil) ⇒ Object
- #create(resource, params, headers = nil) ⇒ Object
- #destroy(resource, id, headers = nil) ⇒ Object
- #find(resource, id, headers = nil) ⇒ Object
- #find_all(resource, params = {}, headers = nil) ⇒ Object
- #update(resource, id, params = {}, headers = nil) ⇒ Object
Instance Method Details
#count(resource, params = {}, headers = nil) ⇒ Object
5 6 7 |
# File 'lib/whiplash/app/finder_methods.rb', line 5 def count(resource, params = {}, headers = nil) get("#{resource}/count", params, headers).body["count"] end |
#create(resource, params, headers = nil) ⇒ Object
9 10 11 |
# File 'lib/whiplash/app/finder_methods.rb', line 9 def create(resource, params, headers = nil) post("#{resource}", params, headers) end |
#destroy(resource, id, headers = nil) ⇒ Object
13 14 15 |
# File 'lib/whiplash/app/finder_methods.rb', line 13 def destroy(resource, id, headers = nil) delete("#{resource}", { id: id }, headers) end |
#find(resource, id, headers = nil) ⇒ Object
17 18 19 |
# File 'lib/whiplash/app/finder_methods.rb', line 17 def find(resource, id, headers = nil) get("#{resource}", { id: id }, headers) end |
#find_all(resource, params = {}, headers = nil) ⇒ Object
21 22 23 |
# File 'lib/whiplash/app/finder_methods.rb', line 21 def find_all(resource, params = {}, headers = nil) get("#{resource}", params, headers) end |
#update(resource, id, params = {}, headers = nil) ⇒ Object
25 26 27 |
# File 'lib/whiplash/app/finder_methods.rb', line 25 def update(resource, id, params = {}, headers = nil) put("#{resource}", params.merge(id: id), headers) end |