Class: Lighthouse::Ticket

Inherits:
Base
  • Object
show all
Defined in:
lib/lighthouse.rb

Overview

Find tickets

Lighthouse::Ticket.find(:all, :params => { :project_id => 44 })
Lighthouse::Ticket.find(:all, :params => { :project_id => 44, :q => "state:closed tagged:committed" })

project = Lighthouse::Project.find(44)
project.tickets
project.tickets(:q => "state:closed tagged:committed")

Creating a Ticket

ticket = Lighthouse::Ticket.new(:project_id => 44)
ticket.title = 'asdf'
...
ticket.tags << 'ruby' << 'rails' << '@high'
ticket.save

Updating a Ticket

ticket = Lighthouse::Ticket.find(20, :params => { :project_id => 44 })
ticket.state = 'resolved'
ticket.tags.delete '@high'
ticket.save

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

inherited

Instance Attribute Details

#tagsObject



192
193
194
195
# File 'lib/lighthouse.rb', line 192

def tags
  attributes['tag'] ||= nil
  @tags ||= tag.blank? ? [] : parse_with_spaces(tag)
end

Instance Method Details

#idObject



187
188
189
190
# File 'lib/lighthouse.rb', line 187

def id
  attributes['number'] ||= nil
  number
end

#save_with_tagsObject



197
198
199
200
201
202
# File 'lib/lighthouse.rb', line 197

def save_with_tags
  self.tag = @tags.collect do |tag|
    tag.include?(' ') ? tag.inspect : tag
  end.join(" ") if @tags.is_a?(Array)
  @tags = nil ; save_without_tags
end