Marketcircle / jiraSOAP

Ruby interface to the JIRA SOAP API
http://rdoc.info/github/Marketcircle/jiraSOAP/master/frames
MIT License
31 stars 13 forks source link

Another 'how do I?' #18

Closed scottharman closed 12 years ago

scottharman commented 12 years ago

Hi guys What's the best way to get the status and resolution for an issue knowing the status_id and the resolution_id As they are both arrays, the status ID i'm looking for is 10008, and the resolution is similarly high I can't work out the best way to find it other than iterating throuh the array

db.statuses.each { |status| if status.id == issue.status_id puts status.name end } db.resolutions.each { |res| if res.id == issue.resolution_id puts res.name end } puts issue.key

it's a bit of an ugly munge, but I suppose it will work fine - just wanted something a little lower cost

Has anyone used this in a rails app and have you got any guidance if I'm just going to map specific fields? I'm slotting this into another app (to manage site information) but I want to output incident information too

ferrous26 commented 12 years ago

Try using #find

db.statuses.find { |x| x.id == issue.status_id }
scottharman commented 12 years ago

Oh! Thanks - I didn't even consider that

On Fri, Jun 22, 2012 at 3:15 PM, Mark Rada < reply@reply.github.com

wrote:

Try using #find

db.statuses.find { |x| x.id == issue.status_id }

Reply to this email directly or view it on GitHub: https://github.com/Marketcircle/jiraSOAP/issues/18#issuecomment-6508623