Class: Lighthouse::Ticket

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

Overview

Find tickets

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

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

Creating a Ticket

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

Updating a Ticket

ticket = 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



168
169
170
171
# File 'lib/lighthouse.rb', line 168

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

Instance Method Details

#idObject



163
164
165
166
# File 'lib/lighthouse.rb', line 163

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

#save_with_tagsObject



173
174
175
176
177
178
# File 'lib/lighthouse.rb', line 173

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