Sha256: dc2b66992a6037d3c3334714a02096f63afac93b779c5375cad3e734a8f3e3fb

Contents?: true

Size: 599 Bytes

Versions: 1

Compression:

Stored size: 599 Bytes

Contents

# frozen_string_literal: true

require 'duckface'
require 'clean_architecture/interfaces/success_payload'

module CleanArchitecture
  module Serializers
    class SuccessPayload
      implements_interface CleanArchitecture::Interfaces::SuccessPayload

      def initialize(use_case_target)
        @use_case_target = use_case_target
      end

      def data
        {
          type: @use_case_target.type_name,
          id: @use_case_target.identifier,
          attributes: @use_case_target.attribute_hash
        }.compact
      end

      def version
        '1.0'
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
clean-architecture-2.0.0 lib/clean_architecture/serializers/success_payload.rb