Sha256: 511bc9a5318f2e199227edda47bd872c09d341f395bcd0caa6588ab91588b71c

Contents?: true

Size: 613 Bytes

Versions: 3

Compression:

Stored size: 613 Bytes

Contents

# typed: true
# 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

3 entries across 3 versions & 1 rubygems

Version Path
clean-architecture-3.0.2 lib/clean_architecture/serializers/success_payload.rb
clean-architecture-3.0.1 lib/clean_architecture/serializers/success_payload.rb
clean-architecture-3.0.0 lib/clean_architecture/serializers/success_payload.rb