Class: GroqRuby::Request
- Inherits:
-
Data
- Object
- Data
- GroqRuby::Request
- Defined in:
- lib/groq_ruby/request.rb
Overview
Value object describing a single HTTP request. Built by resources, consumed by Transport. Immutable.
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
Instance Method Summary collapse
-
#initialize(method:, path:, query: nil, body: nil, headers: {}, content_type: nil) ⇒ Request
constructor
A new instance of Request.
- #with_headers(extra) ⇒ Object
Constructor Details
#initialize(method:, path:, query: nil, body: nil, headers: {}, content_type: nil) ⇒ Request
Returns a new instance of Request.
5 6 7 |
# File 'lib/groq_ruby/request.rb', line 5 def initialize(method:, path:, query: nil, body: nil, headers: {}, content_type: nil) super end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body
4 5 6 |
# File 'lib/groq_ruby/request.rb', line 4 def body @body end |
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type
4 5 6 |
# File 'lib/groq_ruby/request.rb', line 4 def content_type @content_type end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers
4 5 6 |
# File 'lib/groq_ruby/request.rb', line 4 def headers @headers end |
#method ⇒ Object (readonly)
Returns the value of attribute method
4 5 6 |
# File 'lib/groq_ruby/request.rb', line 4 def method @method end |
#path ⇒ Object (readonly)
Returns the value of attribute path
4 5 6 |
# File 'lib/groq_ruby/request.rb', line 4 def path @path end |
#query ⇒ Object (readonly)
Returns the value of attribute query
4 5 6 |
# File 'lib/groq_ruby/request.rb', line 4 def query @query end |
Instance Method Details
#with_headers(extra) ⇒ Object
9 10 11 |
# File 'lib/groq_ruby/request.rb', line 9 def with_headers(extra) with(headers: headers.merge(extra)) end |