Sha256: 8f67102393af0fb4b28f2d45a23b09f987ee4906279da3517b4a84062153c55e

Contents?: true

Size: 623 Bytes

Versions: 6

Compression:

Stored size: 623 Bytes

Contents

module InfinumId
  module Resources
    class Updater
      def initialize(params, resource)
        @params = params.deep_symbolize_keys
        @resource = resource
      end

      def self.call(params, resource)
        new(params, resource).call
      end

      def call
        update_resource
        InfinumId::AfterResourceUpdate.call(resource, @params)
      end

      private

      attr_reader :resource_params, :resource

      def update_resource
        resource.update(resource_params)
      end

      def resource_params
        @params.slice(*InfinumId.resource_attributes)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
infinum_id-1.6.0 app/services/infinum_id/resources/updater.rb
infinum_id-1.5.1 app/services/infinum_id/resources/updater.rb
infinum_id-1.5.0 app/services/infinum_id/resources/updater.rb
infinum_id-1.4.2 app/services/infinum_id/resources/updater.rb
infinum_id-1.4.1 app/services/infinum_id/resources/updater.rb
infinum_id-1.4.0 app/services/infinum_id/resources/updater.rb