Sha256: 9ea81105fd99173cdd06108f6b2e440fe2256a5515b75b5f2c1ce0d5fe1e6b44

Contents?: true

Size: 507 Bytes

Versions: 1

Compression:

Stored size: 507 Bytes

Contents

module Roqua
  module CoreApi
    class Base < ActiveInteraction::Base
      private

      def create_enum(headers, rows)
        row_class = Struct.new(*headers.map(&:to_sym))
        rows.lazy.map { |row| row_class.new(*row) }.to_enum
      end

      def errors_to_object(response, obj)
        response['errors'].each do |attribute, errors|
          errors.each do |error|
            obj.errors.add(attribute, I18n.t("errors.messages.#{error}"))
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
roqua-core-api-0.0.30 lib/roqua/core_api/base.rb