Class: Inferno::Entities::Header

Inherits:
Entity
  • Object
show all
Defined in:
lib/inferno/entities/header.rb

Overview

A Header represents an HTTP request/response header

Constant Summary collapse

ATTRIBUTES =
[:id, :request_id, :name, :type, :value].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Header

Returns a new instance of Header.



20
21
22
# File 'lib/inferno/entities/header.rb', line 20

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

Instance Attribute Details

#idString

Returns id of the header.

Returns:

  • (String)

    id of the header



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/inferno/entities/header.rb', line 15

class Header < Entity
  ATTRIBUTES = [:id, :request_id, :name, :type, :value].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:
    }.compact
  end
end

#nameString

Returns header name.

Returns:

  • (String)

    header name



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/inferno/entities/header.rb', line 15

class Header < Entity
  ATTRIBUTES = [:id, :request_id, :name, :type, :value].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:
    }.compact
  end
end

#request_idString

Returns index of the HTTP request.

Returns:

  • (String)

    index of the HTTP request



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/inferno/entities/header.rb', line 15

class Header < Entity
  ATTRIBUTES = [:id, :request_id, :name, :type, :value].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:
    }.compact
  end
end

#typeString

Returns request/response.

Returns:

  • (String)

    request/response



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/inferno/entities/header.rb', line 15

class Header < Entity
  ATTRIBUTES = [:id, :request_id, :name, :type, :value].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:
    }.compact
  end
end

#valueString

Returns header value.

Returns:

  • (String)

    header value



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/inferno/entities/header.rb', line 15

class Header < Entity
  ATTRIBUTES = [:id, :request_id, :name, :type, :value].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:
    }.compact
  end
end

Instance Method Details

#request?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/inferno/entities/header.rb', line 24

def request?
  type == 'request'
end

#response?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/inferno/entities/header.rb', line 28

def response?
  type == 'response'
end

#to_hashObject



32
33
34
35
36
37
38
39
40
# File 'lib/inferno/entities/header.rb', line 32

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