I am trying to update the style for one of my Fusion tables using Rubi gem RestClient.
Here is my code:
require 'rest_client' tableId = '<STRING CONTAINING TABLEID>' styleId = '<STRING CONTAINING STYLEID>' key = '<STRING CONTAINING MY FUSION TABLES API KEY>' table_url = "https://www.googleapis.com/fusiontables/v1/tables/#{tableId}/styles/#{styleId}?key=#{key}" update = '{"polygonOptions": {"strokeColor":"#ffffff"}}' token = 'STRING CONTAINING AUTHORIZATION TOKEN' RestClient.put table_url,update,{"Authorization" => "Bearer #{token}"}
When I run this code, I get this error:
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/abstract_response.rb:48:in `return!': 400 Bad Request (RestClient::BadRequest) from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/request.rb:230:in `process_result' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/request.rb:178:in `block in transmit' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:745:in `start' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient.rb:80:in `put'
When I enter the update code into the official PUT maker thingie style user style , the update works. But this does not work when I run my Ruby code.
Does anyone know what I'm doing wrong?
EDIT: additional output that I get from adding to RestClient.log = logger
RestClient.put "https://www.googleapis.com/fusiontables/v1/tables/<MY TABLE ID HERE>/styles/4?key=<AND HERE WHERE MY FUSION TABLE API KEY GOES>", "{\"polygonOptions\":{\"strokeColor\":\"#ffffff\"}}", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Authorization"=>"Bearer <THIS CONTAINS THE BEARER STRING>", "Content-Length"=>"44"
source share