Sha256: 54c78d784a08780905d71f91cdf6c1b0de5daaf69199ee6ca626da226a08cffc

Contents?: true

Size: 561 Bytes

Versions: 3

Compression:

Stored size: 561 Bytes

Contents

# frozen_string_literal: true

module ActiveFunction
  module Functions
    class Response
      attr_accessor :status, :headers, :body

      def initialize(status: 200, headers: {}, body: nil)
        @status     = status
        @headers    = headers
        @body       = body
        @committed  = false
      end

      def to_h
        {
          statusCode: status,
          headers:    headers,
          body:       body
        }
      end

      def commit!
        @committed = true
      end

      def committed? = @committed
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activefunction-0.3.5 lib/active_function/functions/response.rb
activefunction-0.3.4 lib/active_function/functions/response.rb
activefunction-0.3.3 lib/active_function/functions/response.rb