Sha256: 121cc058612a054f1d205b78ee8d7a83cb45bc12d8f25943717d27b854905254

Contents?: true

Size: 754 Bytes

Versions: 1

Compression:

Stored size: 754 Bytes

Contents

require "fortnox/api/base"
require "fortnox/api/repositories/base/loaders"
require "fortnox/api/repositories/base/savers"

module Fortnox
  module API
    module Repository
      class Base < Fortnox::API::Base

        include Loaders
        include Savers

        attr_reader :mapper, :keys_filtered_on_save

        def initialize( keys_filtered_on_save: [ :url ] )
          super()

          @keys_filtered_on_save = keys_filtered_on_save
          @mapper = Registry[ Mapper::Base.canonical_name_sym( self.class::MODEL )].new
        end

        private

          def instansiate( hash )
            hash[ :new ] = false
            hash[ :unsaved ] = false
            self.class::MODEL.new( hash )
          end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fortnox-api-0.2.0 lib/fortnox/api/repositories/base.rb