might be cleaner to use faraday or some other ruby-land HTTP client here