Class: Zaius::RequestLogContext
- Inherits:
-
Object
- Object
- Zaius::RequestLogContext
- Defined in:
- lib/zaius/zaius_client.rb
Overview
RequestLogContext stores information about a request that’s begin made so that we can log certain information. It’s useful because it means that we don’t have to pass around as many parameters.
Instance Attribute Summary collapse
-
#account ⇒ Object
Returns the value of attribute account.
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#api_version ⇒ Object
Returns the value of attribute api_version.
-
#body ⇒ Object
Returns the value of attribute body.
-
#method ⇒ Object
Returns the value of attribute method.
-
#path ⇒ Object
Returns the value of attribute path.
-
#query_params ⇒ Object
Returns the value of attribute query_params.
-
#request_id ⇒ Object
Returns the value of attribute request_id.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#dup_from_response(resp) ⇒ Object
The idea with this method is that we might want to update some of context information because a response that we’ve received from the API contains information that’s more authoritative than what we started with for a request.
Instance Attribute Details
#account ⇒ Object
Returns the value of attribute account.
244 245 246 |
# File 'lib/zaius/zaius_client.rb', line 244 def account @account end |
#api_key ⇒ Object
Returns the value of attribute api_key.
245 246 247 |
# File 'lib/zaius/zaius_client.rb', line 245 def api_key @api_key end |
#api_version ⇒ Object
Returns the value of attribute api_version.
246 247 248 |
# File 'lib/zaius/zaius_client.rb', line 246 def api_version @api_version end |
#body ⇒ Object
Returns the value of attribute body.
243 244 245 |
# File 'lib/zaius/zaius_client.rb', line 243 def body @body end |
#method ⇒ Object
Returns the value of attribute method.
247 248 249 |
# File 'lib/zaius/zaius_client.rb', line 247 def method @method end |
#path ⇒ Object
Returns the value of attribute path.
248 249 250 |
# File 'lib/zaius/zaius_client.rb', line 248 def path @path end |
#query_params ⇒ Object
Returns the value of attribute query_params.
249 250 251 |
# File 'lib/zaius/zaius_client.rb', line 249 def query_params @query_params end |
#request_id ⇒ Object
Returns the value of attribute request_id.
250 251 252 |
# File 'lib/zaius/zaius_client.rb', line 250 def request_id @request_id end |
#url ⇒ Object
Returns the value of attribute url.
251 252 253 |
# File 'lib/zaius/zaius_client.rb', line 251 def url @url end |
Instance Method Details
#dup_from_response(resp) ⇒ Object
The idea with this method is that we might want to update some of context information because a response that we’ve received from the API contains information that’s more authoritative than what we started with for a request.
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/zaius/zaius_client.rb', line 257 def dup_from_response(resp) return self if resp.nil? # Faraday's API is a little unusual. Normally it'll produce a response # object with a `headers` method, but on error what it puts into # `e.response` is an untyped `Hash`. headers = if resp.is_a?(Faraday::Response) resp.headers else resp[:headers] end context = dup context end |