Class: Inferno::Entities::Header
- Includes:
- Attributes
- 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
-
#id ⇒ String
Id of the header.
-
#name ⇒ String
Header name.
-
#request_id ⇒ String
Index of the HTTP request.
-
#type ⇒ String
Request/response.
-
#value ⇒ String
Header value.
Instance Method Summary collapse
-
#initialize(params) ⇒ Header
constructor
A new instance of Header.
- #request? ⇒ Boolean
- #response? ⇒ Boolean
- #to_hash ⇒ Object
Methods included from Attributes
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
#id ⇒ String
Returns 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 |
#name ⇒ String
Returns 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_id ⇒ String
Returns 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 |
#type ⇒ String
Returns 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 |
#value ⇒ String
Returns 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
24 25 26 |
# File 'lib/inferno/entities/header.rb', line 24 def request? type == 'request' end |
#response? ⇒ Boolean
28 29 30 |
# File 'lib/inferno/entities/header.rb', line 28 def response? type == 'response' end |
#to_hash ⇒ Object
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 |