Module: Formi9::Request
- Included in:
- API
- Defined in:
- lib/formi9/request.rb
Overview
Defines HTTP request methods
Instance Method Summary collapse
-
#delete(path, options = {}) ⇒ Object
HTTP DELETE request.
-
#get(path, options = {}) ⇒ Object
HTTP GET request.
-
#post(path, options = {}) ⇒ Object
HTTP POST request.
-
#put(path, options = {}) ⇒ Object
HTTP PUT request.
- #request(method, path, options) ⇒ Object
Instance Method Details
#delete(path, options = {}) ⇒ Object
HTTP DELETE request
22 23 24 |
# File 'lib/formi9/request.rb', line 22 def delete(path, ={}) request(:delete, path, ) end |
#get(path, options = {}) ⇒ Object
HTTP GET request
7 8 9 |
# File 'lib/formi9/request.rb', line 7 def get(path, ={}) request(:get, path, ) end |
#post(path, options = {}) ⇒ Object
HTTP POST request
12 13 14 |
# File 'lib/formi9/request.rb', line 12 def post(path, ={}) request(:post, path, ) end |
#put(path, options = {}) ⇒ Object
HTTP PUT request
17 18 19 |
# File 'lib/formi9/request.rb', line 17 def put(path, ={}) request(:put, path, ) end |
#request(method, path, options) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/formi9/request.rb', line 26 def request(method, path, ) response = connection.send(method) do |request| case method when :get, :delete request.url(Addressable::URI.escape(path), ) when :post, :put request.path = Addressable::URI.escape(path) request.body = end end response end |