Class: Lighthouse::Ticket

Inherits:
Base
  • Object
show all
Defined in:
lib/fresnel/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



255
256
257
258
# File 'lib/fresnel/lighthouse.rb', line 255

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

Instance Method Details

#bodyObject



260
261
262
# File 'lib/fresnel/lighthouse.rb', line 260

def body
  attributes['body'] ||= ''
end

#body=(value) ⇒ Object



264
265
266
# File 'lib/fresnel/lighthouse.rb', line 264

def body=(value)
  attributes['body'] = value
end

#body_htmlObject



268
269
270
# File 'lib/fresnel/lighthouse.rb', line 268

def body_html
  attributes['body_html'] ||= ''
end

#body_html=(value) ⇒ Object



272
273
274
# File 'lib/fresnel/lighthouse.rb', line 272

def body_html=(value)
  attributes['body_html'] = value
end

#idObject



250
251
252
253
# File 'lib/fresnel/lighthouse.rb', line 250

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

#save_with_tagsObject



276
277
278
279
280
281
# File 'lib/fresnel/lighthouse.rb', line 276

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