Sha256: 6be2588345e2b2dd7549c589382477a6fa6ce9e17271770201aa4a3fc1201dac

Contents?: true

Size: 1.12 KB

Versions: 33

Compression:

Stored size: 1.12 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: id,
          request_id: request_id,
          type: type,
          name: name,
          value: value,
          created_at: created_at,
          updated_at: updated_at
        }.compact
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
inferno_core-0.3.12 lib/inferno/entities/header.rb
inferno_core-0.3.11 lib/inferno/entities/header.rb
inferno_core-0.3.10 lib/inferno/entities/header.rb
inferno_core-0.3.9 lib/inferno/entities/header.rb
inferno_core-0.3.8 lib/inferno/entities/header.rb
inferno_core-0.3.7 lib/inferno/entities/header.rb
inferno_core-0.3.6 lib/inferno/entities/header.rb
inferno_core-0.3.5 lib/inferno/entities/header.rb
inferno_core-0.3.4 lib/inferno/entities/header.rb
inferno_core-0.3.3 lib/inferno/entities/header.rb
inferno_core-0.3.2 lib/inferno/entities/header.rb
inferno_core-0.3.1 lib/inferno/entities/header.rb
inferno_core-0.3.0 lib/inferno/entities/header.rb
inferno_core-0.3.0.rc1 lib/inferno/entities/header.rb
inferno_core-0.2.0 lib/inferno/entities/header.rb
inferno_core-0.2.0.rc4 lib/inferno/entities/header.rb
inferno_core-0.2.0.rc3 lib/inferno/entities/header.rb
inferno_core-0.2.0.rc2 lib/inferno/entities/header.rb
inferno_core-0.2.0.rc1 lib/inferno/entities/header.rb
inferno_core-0.1.4.pre lib/inferno/entities/header.rb