400 error

#1 · closed · 8 comments

View on GitHub ↗

lagrz

while testing in IRB I always get a returned 400 msg although my apikey is correct and so is everything else. using the ruby installation that comes with OSX Snow Leopard 1.8.7

Comments

augustl

Will investigate soon-ish.

PedroDiogo

Same thing happens to me. Running OSX Snow Leopard with Ruby 1.8.7 and Ruby 1.9.1

augustl

This works for me: ``` ~ ∴ irb >> require "rubygems" => false >> require "prowl" => true >> api_key = "123abc" => "123abc" >> Prowl.add(:apikey => api_key, :application => "Fishes", :event => "silly", :description => "Awwawaw.", :priority => 1) => 200 >> ``` I have version 0.1.2 of the gem installed. Can you please post the steps necessary to reproduce this bug?

PedroDiogo

``` >> require "prowl" => true >> apikey = "123abc" => "123abc" >> Prowl.add(:apikey => apikey, :application => "Test", :event => "Testing", :description => "Foo bar") => 400 >> Prowl.add(:apikey => apikey, :application => "Test", :event => "Testing", :description => "Foo bar", :priority => 1) => 400 ``` Doing exactly the same as you did, (replacing the api for the corresponding, of course) as it returns 400. Don't know if this is supposed to happen but here it goes: ``` >> p = Prowl.new(:apikey => apikey, :application => "Foo") => #<Prowl:0x101551fe8 @api_key={:apikey=>"123abc", :application=>"Foo"}> >> p.valid? ArgumentError: wrong number of arguments (1 for 2) from /Library/Ruby/Gems/1.8/gems/prowl-0.1.2/lib/prowl.rb:22:in `perform' from /Library/Ruby/Gems/1.8/gems/prowl-0.1.2/lib/prowl.rb:22:in `valid?' from (irb):5 >> Prowl.verify(api) ArgumentError: wrong number of arguments (1 for 2) from /Library/Ruby/Gems/1.8/gems/prowl-0.1.2/lib/prowl.rb:22:in `perform' from /Library/Ruby/Gems/1.8/gems/prowl-0.1.2/lib/prowl.rb:22:in `valid?' from /Library/Ruby/Gems/1.8/gems/prowl-0.1.2/lib/prowl.rb:32:in `verify' from (irb):6 >> ``` Using gem version 0.1.2

PedroDiogo

After some tweaking I was able to get some results. To fix the verify error I changed perform method header to: ``` def perform(action, params = {}) ``` After looking at the code I noticed this: ``` #<Prowl:0x101551fe8 @api_key={:apikey=>"123abc", :application=>"Foo"}> ``` It is keeping all the other params on the @api_key var. The only way it worked was by call it this way: ``` >> p = Prowl.new(api) >> p.add(:application => "Foo", :event => "Bar", :description => "O Rly?") ```

augustl

@PedroDiogo: that doesn't make sense at all. The stack trace points to line 22, which contains nothing but whitespace. And both the entries in the stack trace points to that same line. Is your IRB-ish paste from script/console of a Rails app, or in plain IRB?

threadhead

I can verify the same steps and errors as PedroDiogo. augustl, when I look at line 22 in the gem that is currently being pushed, I see: line 21:def valid? line 22: @valid ||= (perform("verify") == 200) line 23: end

augustl

The gem and the github repo was is some sort of unsynced twilight zone that I have no explanation of how occurred. It should be fixed now.