Sha256: 6dae87f2e305af9ee6a91c145230ada32291fb43007759d4a41889e4d61962f6

Contents?: true

Size: 844 Bytes

Versions: 4

Compression:

Stored size: 844 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 data['ido_id'] && 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

4 entries across 4 versions & 1 rubygems

Version Path
errbit_cloudfuji-0.2.4 lib/errbit/cloudfuji/event_observers/project_task_observer.rb
errbit_cloudfuji-0.2.3 lib/errbit/cloudfuji/event_observers/project_task_observer.rb
errbit_cloudfuji-0.2.2 lib/errbit/cloudfuji/event_observers/project_task_observer.rb
errbit_cloudfuji-0.2.1 lib/errbit/cloudfuji/event_observers/project_task_observer.rb