tag:help.lighthouseapp.com,2008-09-20:/discussions/api-developers/49-ruby-api-wrapper-ticket-search-parametersLighthouse: Discussion 2013-08-12T09:38:00Ztag:help.lighthouseapp.com,2008-09-20:Comment/157392008-11-14T05:50:14Z2009-06-20T20:04:25Zruby api wrapper - ticket search parameters?<div><p>Hello again. I am moving quite quickly on my project, and I have
both Ruby and Lighthouse to thank.</p>
<p>Anyway, running into another problem:</p>
<p>how do I push search parameters to the tickets subquery?</p>
<p>I got this from lib/lighthouse.rb</p>
<pre>
<code>def tickets(options = {})
Ticket.find(:all, :params => options.update(:project_id => id))
end</code>
</pre>
<p>what would the syntax be to return closed tickets?</p>
<p>i.e -</p>
<p>def tickets_closed(options = {})</p>
<pre>
<code> Ticket.find(:all, :params => options.update(:project_id => id, :state => "resolved"))
end</code>
</pre>
<p>what would the syntax be to ask for "created_at < #{Date.now
- 90}" ?</p>
<p>I've tried a few different things. Basically, the Ticket.find
won't take a :conditions array, the above doesn't work, and I don't
see created_at in the class attributes but I know I can access it
as a field value. I'm going to keep working on this, and if I come
up with something I will post it, but if someone would like to lead
me out of this desert I would be obliged.</p>
<p>thanks</p></div>Krister Axeltag:help.lighthouseapp.com,2008-09-20:Comment/157392008-11-14T05:53:53Z2009-06-20T20:04:25Zruby api wrapper - ticket search parameters?<div><p>got it:</p>
<p>x = Ticket.find(:all, :params => options.update(:project_id
=> id, :q => "state:resolved"))</p>
<p>it's the "q" parameter. Very James Bond.</p></div>Krister Axeltag:help.lighthouseapp.com,2008-09-20:Comment/157392008-11-14T06:11:27Z2009-06-20T20:04:25Zruby api wrapper - ticket search parameters?<div><p>also:</p>
<p>Ticket.find(:all, :params => options.update(:project_id =>
id, :q => "created:'#{i.abs} month ago'"))</p></div>Krister Axeltag:help.lighthouseapp.com,2008-09-20:Comment/157392008-11-14T21:33:53Z2009-06-20T20:04:29Zruby api wrapper - ticket search parameters?<div><p>kristert is right. You should also checkout the "Date based
keywords" section of our help section. The date-based searching is
pretty powerful.</p>
<p>
http://help.lighthouseapp.com/faqs/getting-started/how-do-i-search-for-tickets</p></div>Justin Palmer