Class: CommandTower::Clients::Transport::Response
- Inherits:
-
Data
- Object
- Data
- CommandTower::Clients::Transport::Response
- Defined in:
- app/services/command_tower/clients/transport/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#duration_ms ⇒ Object
readonly
Returns the value of attribute duration_ms.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body
6 7 8 |
# File 'app/services/command_tower/clients/transport/response.rb', line 6 def body @body end |
#duration_ms ⇒ Object (readonly)
Returns the value of attribute duration_ms
6 7 8 |
# File 'app/services/command_tower/clients/transport/response.rb', line 6 def duration_ms @duration_ms end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers
6 7 8 |
# File 'app/services/command_tower/clients/transport/response.rb', line 6 def headers @headers end |
#status ⇒ Object (readonly)
Returns the value of attribute status
6 7 8 |
# File 'app/services/command_tower/clients/transport/response.rb', line 6 def status @status end |
Class Method Details
.build(status:, headers: {}, body: nil, duration_ms: nil) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'app/services/command_tower/clients/transport/response.rb', line 7 def self.build(status:, headers: {}, body: nil, duration_ms: nil) new( status: Integer(status), headers: headers.to_h.transform_keys(&:to_s), body: body, duration_ms: duration_ms ) end |
Instance Method Details
#success? ⇒ Boolean
16 17 18 |
# File 'app/services/command_tower/clients/transport/response.rb', line 16 def success? status >= 200 && status < 300 end |