Class: IssueTrackers::CloudfujiTracker

Inherits:
IssueTracker
  • Object
show all
Defined in:
app/models/issue_trackers/cloudfuji_tracker.rb

Constant Summary collapse

Label =
"cloudfuji"
Fields =
[
  [:project_id, {
    :label       => "Project Ido ID",
    :placeholder => "Ido ID of project to create task on"
  }]
]

Instance Method Summary collapse

Instance Method Details

#body_templateObject



39
40
41
# File 'app/models/issue_trackers/cloudfuji_tracker.rb', line 39

def body_template
  @@body_template ||= ERB.new(File.read(File.expand_path("../../../views/issue_trackers/cloudfuji_body.txt.erb", __FILE__)).gsub(/^\s*/, ''))
end

#create_issue(problem, reported_by) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'app/models/issue_trackers/cloudfuji_tracker.rb', line 11

def create_issue(problem, reported_by)
  if ::Cloudfuji::Platform.on_cloudfuji?
    err = problem.errs.last

    event = {
      :category => :project_task,
      :name     => :created,
      :data     => {
        :ido_id          => err.ido_id,
        :title           => issue_title(problem),
        :description     => body_template.result(binding),
        :task_type       => 'bug',
        :state           => 'unscheduled',
        :requested_by_id => reported_by.ido_id,
        :project_id      => project_id,
        :labels          => "errbit"
      }
    }

    puts "Publishing Cloudfuji Event: #{event.inspect}"

    ::Cloudfuji::Event.publish(event)

    # Display 'pending' message until tracker responds with url
    problem.update_attribute :issue_link, "pending"
  end
end