Sha256: 3b82f5428e3eb8c8f5c48c87c57719f4364f94c2995b202d04fdceb45a0b235e

Contents?: true

Size: 647 Bytes

Versions: 1

Compression:

Stored size: 647 Bytes

Contents

module RestPack::User::Service::Commands
  module User
    class Get < RestPack::Service::Command
      required do
        integer :id
        integer :application_id
      end

      def execute
        #TODO: GJ: remove the :application_id scope when we can specify custom serializer filters
        #          https://github.com/RestPack/restpack_serializer/issues/42
        result = Serializers::User.resource(
          inputs,
          Models::User.where(application_id: inputs[:application_id])
        )

        if result[:users].empty?
          status :not_found
        else
          result
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
restpack_user_service-0.0.4 lib/restpack_user_service/commands/user/get.rb