def add_query_params endpoint, data
      return endpoint if data.nil? || data.empty?

      endpoint += "?" unless endpoint.include? "?"
      endpoint += "&" unless endpoint.end_with? "?"
      endpoint + URI.encode(flatten_hash(data).join("&"))
    end
def add_query_params endpoint, data
      return endpoint if data.nil? || data.empty?

      endpoint += "?" unless endpoint.include? "?"
      endpoint += "&" unless endpoint.end_with? "?"
      endpoint + URI.encode(flatten_hash(data).join("&"))
    end
Internal: Appends data as query params onto an endpoint

 endpoint - A String naming the request endpoint.
 data     - A hash of data to flatten and append

 Returns an endpoint string with the data appended