hanklords/flickraw

flickr.photos.getRecent NoMethodError

Closed this issue · 1 comments

Hello guys, first of all, thanks for this awesome gem abstraction!

I've experiencing a strange behavior with the flickr.photos.getRecent method. Sometimes it pass on my tests, but sometimes it breaks. This is how I'm using it:

flickr.photos.getRecent(page: @page, per_page: 200)

And sometimes I get this error exception/message:

NoMethodError:
       undefined method `split' for #<FlickRaw::Response:0x00000005010f68>
     # /home/gustavo/.rvm/gems/ruby-2.3.3@stock_images/gems/flickraw-0.9.9/lib/flickraw/request.rb:13:in `build_request'
     # /home/gustavo/.rvm/gems/ruby-2.3.3@stock_images/gems/flickraw-0.9.9/lib/flickraw/api.rb:37:in `block in build'
     # /home/gustavo/.rvm/gems/ruby-2.3.3@stock_images/gems/flickraw-0.9.9/lib/flickraw/response.rb:41:in `block in each'
     # /home/gustavo/.rvm/gems/ruby-2.3.3@stock_images/gems/flickraw-0.9.9/lib/flickraw/response.rb:41:in `each'
     # /home/gustavo/.rvm/gems/ruby-2.3.3@stock_images/gems/flickraw-0.9.9/lib/flickraw/response.rb:41:in `each'
     # /home/gustavo/.rvm/gems/ruby-2.3.3@stock_images/gems/flickraw-0.9.9/lib/flickraw/api.rb:37:in `build'
     # /home/gustavo/.rvm/gems/ruby-2.3.3@stock_images/gems/flickraw-0.9.9/lib/flickraw/api.rb:55:in `initialize'
     # /home/gustavo/.rvm/gems/ruby-2.3.3@stock_images/gems/flickraw-0.9.9/lib/flickraw.rb:22:in `new'
     # /home/gustavo/.rvm/gems/ruby-2.3.3@stock_images/gems/flickraw-0.9.9/lib/flickraw.rb:22:in `flickr'

I can't figure out why this method sometimes works and sometimes not. Especially because I'm using VCR for record the API calls, so I believe that if it works one time, should works always.

My application is an sinatra (1.4.8) app with Ruby 2.3.3 and flickraw (0.9.9). For tests, I'm using rspec (3.5.0), airborne (0.2.7) and vcr (3.0.3) gems.

I've figured out and solved this issue, the "problem" it was related with the VCR gem. The Flickr request query is passed on body and by the default the VCR only matches the request by the URI and the verb. So, it was necessarily to match the request by the body too. 😃