It's clearly issue with `ENV["google_api_key"]` you should inspect
what it returns. As you said you are using Figaro - you should not use
`ENV["google_api_key"]` in code, instead use
`Figaro.env.google_api_key`. In any case this is out of the scope of
HTTP gem.
On Sat, May 19, 2018 at 9:45 PM, Brian F. <
benfo...@gmail.com> wrote:
> Hello, I am a new developer and I'm trying to implement HTTP.rb for a GET
> request to Google Civic Information API - I've authorized my app on Google
> and have an API key that I've protected using the Figaro Gem.
>
> I'm getting a "Bad Request" message with the way my code is currently
> written, but it works fine if I post the API key itself to the 'params'
> hash.
>
>>> legislators =
>>> HTTP.get("
https://www.googleapis.com/civicinfo/v2/representatives", :params
>>> => {:key => ENV["google_api_key"], :address => "#{zipcode}", :includeOffices
>>> => "true", :roles => "legislatorUpperBody" })
>
>
> Can anyone point me in the right direction?
>
> Thanks in advance.
>
> --
> You received this message because you are subscribed to the Google Groups
> "http.rb: a fast, easy-to-use Ruby HTTP client with a chainable API" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
httprb+un...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.
--
Sincerely yours, Alexey Zapparov
http://ixti.net |
+34 677 990 688