Sha256: 85fab8f476a1ff3f595470c6fdf45032ab558249a6d19b571c3f7a4d962f5b2d

Contents?: true

Size: 693 Bytes

Versions: 2

Compression:

Stored size: 693 Bytes

Contents

module Castronaut

  class TicketResult
    InvalidMessageCategories = %w{warn error fatal invalid} 

    attr_reader :ticket, :message, :message_category
    delegate :identifier, :extra_info, :extra_xml, :proxies, :to => :ticket
        
    def initialize(ticket, message=nil, message_category=nil)
      @ticket = ticket
      @message = message
      @message_category = message_category
      Castronaut.logger.info("#{self.class} - #{@message_category} #{@message} for #{@ticket}") if @message && @ticket
    end

    def valid?
      !invalid?
    end
    
    def invalid?
      InvalidMessageCategories.any?{ |cat| message_category.to_s.downcase.include?(cat) }
    end

  end

end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
3mix-castronaut-0.5.0.2 lib/castronaut/ticket_result.rb
masover-castronaut-0.5.0.1 lib/castronaut/ticket_result.rb