Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

probes.active throws an error if active == false #5

Open
rberger opened this issue Oct 31, 2011 · 1 comment
Open

probes.active throws an error if active == false #5

rberger opened this issue Oct 31, 2011 · 1 comment

Comments

@rberger
Copy link

rberger commented Oct 31, 2011

It seems that if you get the list of probes using Pingdom::Probe and a probe listing has "active" => false, the method missing look up fails. I could not figure out why myself.

Here's an example. It turned ou in my case the first probe had actve set to false, the second probe had it true. So when I try to access the active method on the first one, I get an exception, but I can access all the other attributes/methods fine. Here I show accessing the ip method and then failing on active.

client = Pingdom::Client.new :username => u, :password => p, :key => k
probes = client.probes

puts probes[0].inspect #=> #<Pingdom::Probe id: 17 country: "Sweden" city: "Stockholm" name: "Stockholm, Sweden" active: false hostname: "s238.pingdom.com" ip: "83.140.19.38" countryiso: "SE">

puts probes[0].ip #=> 83.140.19.38


puts probes[0].active #=> NoMethodError: undefined method `active' for #<Pingdom::Probe:0x000001022eb0f0>
    from /Users/rberger/.rvm/gems/ruby-1.9.2-p290/gems/pingdom-client-0.0.6.alpha/lib/pingdom/base.rb:26:in `method_missing'
    from (irb):32
    from /Users/rberger/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `<main>'

And on the second probe where active is true I can access all the attributes including active:


puts probes[1].inspect #=> #<Pingdom::Probe id: 21 country: "Canada" city: "Montreal" name: "Montreal, Canada" active: true hostname: "s34.pingdom.com" ip: "67.205.112.79" countryiso: "CA">

puts probes[1].ip #=> 67.205.112.79

puts probes[1].active #=> true
@rberger
Copy link
Author

rberger commented Oct 31, 2011

By the way if I add an attributes alias in probe.rb so that:

    attributes :countryiso => [:country_iso, :country_code],

is changed to:

    attributes :countryiso => [:country_iso, :country_code],
               :active  => [:enabled]

Both probes[0].active and probes[0].enabled works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant