Sha256: cefb15addd81860c0d3bf959c82b4f8806ea262c6c4836b8cff8971aea0da1cb

Contents?: true

Size: 741 Bytes

Versions: 2

Compression:

Stored size: 741 Bytes

Contents

module Itsf
  module Services
    module V2
      module Response
        class Base
          extend ActiveModel::Naming

          attr_reader :errors
          attr_writer :success

          def initialize
            @errors = ActiveModel::Errors.new(self)
          end

          def success?
            @errors.blank?
          end

          def failed?
            !success?
          end

          def read_attribute_for_validation(attr)
            send(attr)
          end

          def self.human_attribute_name(attr, _options = {})
            attr
          end

          def self.lookup_ancestors
            [self]
          end

          private

          attr_writer :errors
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
itsf_services-0.0.3 lib/itsf/services/v2/response/base.rb
itsf_services-0.0.2 lib/itsf/services/v2/response/base.rb