Class: Lighthouse::Ticket

Inherits:
Base
  • Object
show all
Defined in:
lib/helm/lighthouse.rb,
lib/helm/commands/create.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



204
205
206
207
# File 'lib/helm/lighthouse.rb', line 204

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

Instance Method Details

#bodyObject



3
4
5
# File 'lib/helm/commands/create.rb', line 3

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

#body=(value) ⇒ Object



7
8
9
# File 'lib/helm/commands/create.rb', line 7

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

#descriptionObject



209
210
211
# File 'lib/helm/lighthouse.rb', line 209

def description
  @description ||= version_body
end

#idObject



195
196
197
198
# File 'lib/helm/lighthouse.rb', line 195

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

#save_with_tagsObject



213
214
215
216
217
218
# File 'lib/helm/lighthouse.rb', line 213

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

#to_sObject



200
201
202
# File 'lib/helm/lighthouse.rb', line 200

def to_s
  title
end