module NgpVan::Request
Public Instance Methods
delete(path:, params: {})
click to toggle source
Perform an HTTP DELETE request
# File lib/ngp_van/request.rb, line 8 def delete(path:, params: {}) request(method: :delete, path: path, params: params) end
get(path:, params: {})
click to toggle source
Perform an HTTP GET request
# File lib/ngp_van/request.rb, line 13 def get(path:, params: {}) request(method: :get, path: path, params: params) end
post(path:, body: {})
click to toggle source
Perform an HTTP POST request
# File lib/ngp_van/request.rb, line 18 def post(path:, body: {}) request(method: :post, path: path, body: body) end
put(path:, body: {})
click to toggle source
Perform an HTTP PUT request
# File lib/ngp_van/request.rb, line 23 def put(path:, body: {}) request(method: :put, path: path, body: body) end
Private Instance Methods
request(method:, path:, params: {}, body: {})
click to toggle source
# File lib/ngp_van/request.rb, line 29 def request(method:, path:, params: {}, body: {}) response = connection.send(method) do |request| request.path = path request.params = params request.body = ::JSON.generate(body) unless body.empty? end Response.create(response.body) end