Sha256: 60bbb488f509c96a2da499f9e51464b5a8fb197d72895104f76847de81582761

Contents?: true

Size: 492 Bytes

Versions: 4

Compression:

Stored size: 492 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.to_sym, error.to_sym)
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
roqua-core-api-0.0.36 lib/roqua/core_api/base.rb
roqua-core-api-0.0.35 lib/roqua/core_api/base.rb
roqua-core-api-0.0.32 lib/roqua/core_api/base.rb
roqua-core-api-0.0.31 lib/roqua/core_api/base.rb