def call(method, path, data = nil, options = nil)
      instrument("call.bookingsync_api", method: method, path: path) do
        if [:get, :head].include?(method)
          options = data
          data = {}
        end
        options ||= {}
        options[:headers] ||= {}
        options[:headers]["Authorization"] = "Bearer #{token}"

        if options.has_key?(:query)
          if options[:query].has_key?(:ids)
            ids = Array(options[:query].delete(:ids)).join(",")
            path = "#{path}/#{ids}"
          end
          options[:query].keys.each do |key|
            if options[:query][key].is_a?(Array)
              options[:query][key] = options[:query][key].join(",")
            end
          end
        end

        url = expand_url(path, options[:uri])
        res = @conn.send(method, url) do |req|
          if data
            req.body = data.is_a?(String) ? data : encode_body(data)
          end
          if params = options[:query]
            req.params.update params
          end
          req.headers.update options[:headers]
        end
        handle_response(res)
      end
    end
def call(method, path, data = nil, options = nil)
      instrument("call.bookingsync_api", method: method, path: path) do
        if [:get, :head].include?(method)
          options = data
          data = {}
        end
        options ||= {}
        options[:headers] ||= {}
        options[:headers]["Authorization"] = "Bearer #{token}"

        if options.has_key?(:query)
          if options[:query].has_key?(:ids)
            ids = Array(options[:query].delete(:ids)).join(",")
            path = "#{path}/#{ids}"
          end
          options[:query].keys.each do |key|
            if options[:query][key].is_a?(Array)
              options[:query][key] = options[:query][key].join(",")
            end
          end
        end

        url = expand_url(path, options[:uri])
        res = @conn.send(method, url) do |req|
          if data
            req.body = data.is_a?(String) ? data : encode_body(data)
          end
          if params = options[:query]
            req.params.update params
          end
          req.headers.update options[:headers]
        end
        handle_response(res)
      end
    end
Make a HTTP request to given path and returns Response object.

 @param method [Symbol] HTTP verb to use.
 @param path [String] The path, relative to {#api_endpoint}.
 @param data [Hash] Data to be send in the request's body
   it can include query: key with requests params for GET requests
 @param options [Hash] A customizable set of request options.
 @return [BookingSync::API::Response] A Response object.