Module: MnClient::Request
- Included in:
- Client
- Defined in:
- lib/mn_client/request.rb
Instance Method Summary collapse
-
#delete(path, params = {}) ⇒ Object
Perform an HTTP DELETE request.
-
#get(path, params = {}) ⇒ Object
Perform an HTTP GET request.
-
#post(path, params = {}) ⇒ Object
Perform an HTTP POST request.
-
#put(path, params = {}) ⇒ Object
Perform an HTTP PUT request.
- #request(method, path, params = {}) ⇒ Object
Instance Method Details
#delete(path, params = {}) ⇒ Object
Perform an HTTP DELETE request
5 6 7 |
# File 'lib/mn_client/request.rb', line 5 def delete(path, params={}) request(:delete, path, params) end |
#get(path, params = {}) ⇒ Object
Perform an HTTP GET request
10 11 12 |
# File 'lib/mn_client/request.rb', line 10 def get(path, params={}) request(:get, path, params) end |
#post(path, params = {}) ⇒ Object
Perform an HTTP POST request
15 16 17 18 |
# File 'lib/mn_client/request.rb', line 15 def post(path, params={}) signature_params = params.values.any?{|value| value.respond_to?(:to_io)} ? {} : params request(:post, path, params, signature_params) end |
#put(path, params = {}) ⇒ Object
Perform an HTTP PUT request
21 22 23 |
# File 'lib/mn_client/request.rb', line 21 def put(path, params={}) request(:put, path, params) end |
#request(method, path, params = {}) ⇒ Object
25 26 27 |
# File 'lib/mn_client/request.rb', line 25 def request(method, path, params={}) connection.send(method.to_sym, path, params).body end |