danryan / spice

A zesty Chef server API wrapper
http://documentup.com/danryan/spice
MIT License
103 stars 22 forks source link

Search not working #11

Closed bencaron closed 12 years ago

bencaron commented 13 years ago

I'm having trouble working with the search method.

When I call the search method on a Spice.connection, I'm getting:

NoMethodError: undefined method `search' for #Spice::Connection:0x8842bc0

I've tried it in either Ruby 1.8 or a fresh installed 1.9, same behavior.

danryan commented 12 years ago

Hey @bencaron, a search method does not exist on the Spice::Connection object. To search, one would do the following:

# after Spice.setup && Spice.connect!
result = Spice::Search.search(:node, "query:value")

After looking into this, I think your assumption makes more sense than this way of performing a search, so I added such a method so you can now what you expected would work:

result = Spice.connection.search(:node, "query:value")

Install spice v0.8.0 to get this new method. As an aside, I found a bug while looking into this, so thank you for reporting it! :)