Class: Inferno::DSL::HTTPClientBuilder
- Inherits:
-
Object
- Object
- Inferno::DSL::HTTPClientBuilder
- Defined in:
- lib/inferno/dsl/http_client_builder.rb
Overview
This module contains the HTTP DSL available to test writers.
Instance Attribute Summary collapse
-
#runnable ⇒ Object
Returns the value of attribute runnable.
Instance Method Summary collapse
-
#headers(headers = nil) ⇒ void
Define custom headers for a client.
-
#url(url = nil) ⇒ void
Define the base url for an HTTP client.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name) ⇒ Object
47 48 49 50 51 |
# File 'lib/inferno/dsl/http_client_builder.rb', line 47 def method_missing(name, ...) return runnable.send(name, ...) if runnable.respond_to? name super end |
Instance Attribute Details
#runnable ⇒ Object
Returns the value of attribute runnable.
7 8 9 |
# File 'lib/inferno/dsl/http_client_builder.rb', line 7 def runnable @runnable end |
Instance Method Details
#headers(headers = nil) ⇒ void
This method returns an undefined value.
Define custom headers for a client
42 43 44 |
# File 'lib/inferno/dsl/http_client_builder.rb', line 42 def headers(headers = nil) @headers ||= headers end |
#url(url = nil) ⇒ void
This method returns an undefined value.
Define the base url for an HTTP client. A string or symbol can be provided. A string is interpreted as a url. A symbol is interpreted as the name of an input to the Runnable.
29 30 31 32 33 34 35 36 |
# File 'lib/inferno/dsl/http_client_builder.rb', line 29 def url(url = nil) @url ||= if url.is_a? Symbol runnable.send(url) else url end end |