taylorbrooks / closeio

A Ruby wrapper for the Close.io API
http://developer.close.com
MIT License
45 stars 57 forks source link

HTTParty Error #11

Closed aknicol closed 9 years ago

aknicol commented 9 years ago

I get the following whenever running any query using the gem:

HTTParty::ResponseError: HTTParty::ResponseError from /Users/Andrew/.rvm/gems/ruby-2.1.3/gems/closeio-0.0.13/lib/closeio/base.rb:31:in bad_response' from /Users/Andrew/.rvm/gems/ruby-2.1.3/gems/closeio-0.0.13/lib/closeio/base.rb:65:infind'

taylorbrooks commented 9 years ago

Are you setting up your API key in the ENV['CLOSEIO_API_KEY'] variable?

aknicol commented 9 years ago

Yes. I'm on Rails 4.3, and I've added ENV['CLOSEIO_API_KEY'] in secrets.yml. I've also tried it on Heroku, where I've set the env variable using heroku config:set. In both cases I get the same error. Any help would be appreciated.

taylorbrooks commented 9 years ago

Hi @aknicol, I just merged in a PR that allows you to configure the gem with a closeio.yml file. Would you try that and see if it works?

Info is in the README.

aknicol commented 9 years ago

Thanks for that. I've updated the gem and created config/initializers/closeio.yml with the following contents:

api_key: '86241a9a99bcaff237079c837ea665456dfff883d3290b264b55b86b'

Is this correct? Because I still get the same error.

taylorbrooks commented 9 years ago

Yes, that's how it should be configured.

But you probably want to delete your api_key now as it's been exposed.

aknicol commented 9 years ago

Yeah, I didn't use the actual key.

No idea then why I'm getting the error?

taylorbrooks commented 9 years ago

I just pushed a 1.0.0 version where you can call Closeio.configure('api_key').

Try that and see if it fixes your issue. You may want to put that in an initializer.

aknicol commented 9 years ago

That works. Thanks!