Sha256: 3ccab14a1fa1d754ce643efcdf776411f77857078c3d551090aa2921da5362f3

Contents?: true

Size: 826 Bytes

Versions: 1

Compression:

Stored size: 826 Bytes

Contents

module Errbit
  module Cloudfuji
    module EventObservers
      class ProjectTaskObserver < ::Cloudfuji::EventObserver

        def project_task_created
          data = params['data']
          # Find error with matching ido_id
          if err = Err.where(:ido_id => data['ido_id']).first
            # Update issue link on error with task url
            if data['url'] && err.problem.issue_link != data['url']
              err.problem.update_attribute :issue_link, data['url']
            end

            # If task state is 'accepted', then resolve the error
            if data['state'] == 'accepted'
              err.problem.resolve!
            end
          end
        end
        # Use same method for task create and update
        alias :project_task_updated :project_task_created

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
errbit_cloudfuji-0.2.0 lib/errbit/cloudfuji/event_observers/project_task_observer.rb