Class: LighthouseBranch

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

Instance Method Summary collapse

Constructor Details

#initialize(account, token, project_id) ⇒ LighthouseBranch

Returns a new instance of LighthouseBranch.



4
5
6
7
8
# File 'lib/lighthouse_branch.rb', line 4

def initialize(, token, project_id)
  Lighthouse. = 
  Lighthouse.token = token
  @project = Lighthouse::Project.find(project_id)
end

Instance Method Details

#branch_name(id) ⇒ Object



14
15
16
# File 'lib/lighthouse_branch.rb', line 14

def branch_name(id)
  "#{id}-#{ticket(id).title.gsub(/[^\w ]/, '').gsub(/[^a-z0-9]+/i, '-').downcase}"
end

#ticket(id) ⇒ Object



10
11
12
# File 'lib/lighthouse_branch.rb', line 10

def ticket(id)
  Lighthouse::Ticket.find(id, :params => { :project_id => @project.id })
end