Sha256: 21fc094f1d3eb22f4d593216d29aab959ab78673b3365ffe2c6bf39906cd8863

Contents?: true

Size: 1.07 KB

Versions: 6

Compression:

Stored size: 1.07 KB

Contents

module Inferno
  module Entities
    # A `Header` represents an HTTP request/response header
    #
    # @!attribute id
    #   @return [String] id of the header
    # @!attribute request_id
    #   @return [String] index of the HTTP request
    # @!attribute name
    #   @return [String] header name
    # @!attribute value
    #   @return [String] header value
    # @!attribute type
    #   @return [String] request/response
    # @!attribute created_at
    #   @return [Time]
    # @!attribute updated_at
    #   @return [Time]
    class Header < Entity
      ATTRIBUTES = [:id, :request_id, :name, :type, :value, :created_at, :updated_at].freeze

      include Inferno::Entities::Attributes

      def initialize(params)
        super(params, ATTRIBUTES)
      end

      def request?
        type == 'request'
      end

      def response?
        type == 'response'
      end

      def to_hash
        {
          id:,
          request_id:,
          type:,
          name:,
          value:,
          created_at:,
          updated_at:
        }.compact
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
inferno_core-0.4.2 lib/inferno/entities/header.rb
inferno_core-0.4.2.pre lib/inferno/entities/header.rb
inferno_core-0.4.1 lib/inferno/entities/header.rb
inferno_core-0.4.1.pre2 lib/inferno/entities/header.rb
inferno_core-0.4.1.pre lib/inferno/entities/header.rb
inferno_core-0.4.0 lib/inferno/entities/header.rb