Class: Hook0::Generated::Response
- Inherits:
-
Object
- Object
- Hook0::Generated::Response
- Defined in:
- lib/hook0/generated/models.rb
Overview
The Response the API declares.
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#elapsed_time_ms ⇒ Object
readonly
Returns the value of attribute elapsed_time_ms.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#http_code ⇒ Object
readonly
Returns the value of attribute http_code.
-
#response_error_name ⇒ Object
readonly
Returns the value of attribute response_error_name.
-
#response_id ⇒ Object
readonly
Returns the value of attribute response_id.
Class Method Summary collapse
-
.from_json(value) ⇒ Response
Read one out of what the API answered.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
(also: #eql?)
Whether that value carries the same members as this one.
-
#hash ⇒ Integer
A value two equal instances share, so that either may key a hash.
-
#initialize(response_id:, body: nil, elapsed_time_ms: nil, headers: nil, http_code: nil, response_error_name: nil) ⇒ Response
constructor
A new instance of Response.
-
#to_h ⇒ Hash{String => Object}
Write one back the way the API reads it.
Constructor Details
#initialize(response_id:, body: nil, elapsed_time_ms: nil, headers: nil, http_code: nil, response_error_name: nil) ⇒ Response
Returns a new instance of Response.
2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 |
# File 'lib/hook0/generated/models.rb', line 2560 def initialize( response_id:, body: nil, elapsed_time_ms: nil, headers: nil, http_code: nil, response_error_name: nil ) @response_id = response_id @body = body @elapsed_time_ms = elapsed_time_ms @headers = headers @http_code = http_code @response_error_name = response_error_name freeze end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
2547 2548 2549 |
# File 'lib/hook0/generated/models.rb', line 2547 def body @body end |
#elapsed_time_ms ⇒ Object (readonly)
Returns the value of attribute elapsed_time_ms.
2547 2548 2549 |
# File 'lib/hook0/generated/models.rb', line 2547 def elapsed_time_ms @elapsed_time_ms end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
2547 2548 2549 |
# File 'lib/hook0/generated/models.rb', line 2547 def headers @headers end |
#http_code ⇒ Object (readonly)
Returns the value of attribute http_code.
2547 2548 2549 |
# File 'lib/hook0/generated/models.rb', line 2547 def http_code @http_code end |
#response_error_name ⇒ Object (readonly)
Returns the value of attribute response_error_name.
2547 2548 2549 |
# File 'lib/hook0/generated/models.rb', line 2547 def response_error_name @response_error_name end |
#response_id ⇒ Object (readonly)
Returns the value of attribute response_id.
2547 2548 2549 |
# File 'lib/hook0/generated/models.rb', line 2547 def response_id @response_id end |
Class Method Details
.from_json(value) ⇒ Response
Read one out of what the API answered.
2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 |
# File 'lib/hook0/generated/models.rb', line 2581 def self.from_json(value) fields = Runtime.as_fields(value, "Response") new( response_id: Runtime.read(fields, "response_id", Runtime::UUID), body: Runtime.maybe(fields, "body", Runtime::TEXT), elapsed_time_ms: Runtime.maybe(fields, "elapsed_time_ms", Runtime::INTEGER), headers: Runtime.maybe(fields, "headers", Runtime.map(Runtime::TEXT)), http_code: Runtime.maybe(fields, "http_code", Runtime::INTEGER), response_error_name: Runtime.maybe(fields, "response_error_name", Runtime::TEXT) ) end |
Instance Method Details
#==(other) ⇒ Boolean Also known as: eql?
Whether that value carries the same members as this one.
2611 2612 2613 |
# File 'lib/hook0/generated/models.rb', line 2611 def ==(other) other.is_a?(Response) && to_h == other.to_h end |
#hash ⇒ Integer
A value two equal instances share, so that either may key a hash.
2619 2620 2621 |
# File 'lib/hook0/generated/models.rb', line 2619 def hash to_h.hash end |
#to_h ⇒ Hash{String => Object}
Write one back the way the API reads it.
2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 |
# File 'lib/hook0/generated/models.rb', line 2596 def to_h out = {} out["response_id"] = @response_id out["body"] = @body unless @body.nil? out["elapsed_time_ms"] = @elapsed_time_ms unless @elapsed_time_ms.nil? out["headers"] = @headers unless @headers.nil? out["http_code"] = @http_code unless @http_code.nil? out["response_error_name"] = @response_error_name unless @response_error_name.nil? out end |