Sha256: c575201de533f9c6d2e5dbb7a5a6d31848e83d2c68868464352ea4d106d8a1de

Contents?: true

Size: 593 Bytes

Versions: 19

Compression:

Stored size: 593 Bytes

Contents

module RDStation
  class ErrorHandler
    class InvalidEventType
      attr_reader :errors

      ERROR_CODE = 'INVALID_OPTION'.freeze
      PATH = '$.event_type'.freeze

      def initialize(errors)
        @errors = errors
      end

      def raise_error
        return if invalid_event_type_error.empty?
        raise RDStation::Error::InvalidEventType, invalid_event_type_error.first
      end

      private

      def invalid_event_type_error
        errors.select do |error|
          error.values_at('error_type', 'path') == [ERROR_CODE, PATH]
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
rdstation-ruby-client-2.9.0 lib/rdstation/error_handler/invalid_event_type.rb
rdstation-ruby-client-2.8.2 lib/rdstation/error_handler/invalid_event_type.rb
rdstation-ruby-client-2.8.1 lib/rdstation/error_handler/invalid_event_type.rb
rdstation-ruby-client-2.8.0 lib/rdstation/error_handler/invalid_event_type.rb
rdstation-ruby-client-2.7.0 lib/rdstation/error_handler/invalid_event_type.rb
rdstation-ruby-client-2.6.0 lib/rdstation/error_handler/invalid_event_type.rb
rdstation-ruby-client-2.5.3 lib/rdstation/error_handler/invalid_event_type.rb
rdstation-ruby-client-2.5.2 lib/rdstation/error_handler/invalid_event_type.rb
rdstation-ruby-client-2.5.1 lib/rdstation/error_handler/invalid_event_type.rb
rdstation-ruby-client-2.5.0 lib/rdstation/error_handler/invalid_event_type.rb
rdstation-ruby-client-2.4.0 lib/rdstation/error_handler/invalid_event_type.rb
rdstation-ruby-client-2.3.1 lib/rdstation/error_handler/invalid_event_type.rb
rdstation-ruby-client-2.3.0 lib/rdstation/error_handler/invalid_event_type.rb
rdstation-ruby-client-2.2.0 lib/rdstation/error_handler/invalid_event_type.rb
rdstation-ruby-client-2.1.0 lib/rdstation/error_handler/invalid_event_type.rb
rdstation-ruby-client-2.0.0 lib/rdstation/error_handler/invalid_event_type.rb
rdstation-ruby-client-1.2.1 lib/rdstation/error_handler/invalid_event_type.rb
rdstation-ruby-client-1.2.0 lib/rdstation/error_handler/invalid_event_type.rb
rdstation-ruby-client-1.1.0 lib/rdstation/error_handler/invalid_event_type.rb