Module: Sonar::Request
- Included in:
- Client, RequestIterator
- Defined in:
- lib/sonar/request.rb
Defined Under Namespace
Classes: RequestIterator
Instance Method Summary collapse
- #extract_params(params) ⇒ Object
- #get(path, options = {}) ⇒ Object
- #post(path, options = {}) ⇒ Object
- #put(path, options = {}) ⇒ Object
- #request(method, path, options) ⇒ Object
Instance Method Details
#extract_params(params) ⇒ Object
6 7 8 9 |
# File 'lib/sonar/request.rb', line 6 def extract_params(params) # extract something from Sonar if needed params end |
#get(path, options = {}) ⇒ Object
11 12 13 |
# File 'lib/sonar/request.rb', line 11 def get(path, = {}) request(:get, path, ) end |
#post(path, options = {}) ⇒ Object
15 16 17 |
# File 'lib/sonar/request.rb', line 15 def post(path, = {}) request(:post, path, ) end |
#put(path, options = {}) ⇒ Object
19 20 21 |
# File 'lib/sonar/request.rb', line 19 def put(path, = {}) request(:put, path, ) end |
#request(method, path, options) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/sonar/request.rb', line 23 def request(method, path, ) response = connection.send(method) do |request| .delete(:connection) case method when :get request.url(path, ) when :post, :put request.path = path request.body = MultiJson.encode() unless .empty? end end response.body end |