lib/ticketing_hub/request.rb in ticketinghub-0.0.2 vs lib/ticketing_hub/request.rb in ticketinghub-0.0.3

- old
+ new

@@ -1,15 +1,15 @@ require 'multi_json' module TicketingHub module Request - def delete(path, options={}) + def delete path, options={} request(:delete, path, options).body end - def get(path, options={}) + def get path, options={} response = request(:get, path, options) body = response.body if auto_traversal && body.is_a?(Array) while next_url = links(response)['next'] @@ -19,19 +19,19 @@ end body end - def patch(path, options={}) + def patch path, options={} request(:patch, path, options).body end - def post(path, options={}) + def post path, options={} request(:post, path, options).body end - def put(path, options={}) + def put path, options={} request(:put, path, options).body end private @@ -48,11 +48,9 @@ force_urlencoded = options.delete(:force_urlencoded) || false url = options.delete(:endpoint) || api_endpoint conn_options = { force_urlencoded: force_urlencoded, url: url } connection(conn_options).send(method) do |request| - request.headers['Accept'] = options.delete(:accept) || 'application/json' - case method when :get, :delete, :head request.url(path, options) when :patch, :post, :put request.path = path \ No newline at end of file