Class: CommandTower::Clients::ClientResult
- Inherits:
-
Object
- Object
- CommandTower::Clients::ClientResult
- Defined in:
- app/services/command_tower/clients/client_result.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#provider_metadata ⇒ Object
readonly
Returns the value of attribute provider_metadata.
Class Method Summary collapse
- .failure(error:, output: nil, metadata: {}, provider_metadata: {}) ⇒ Object
- .success(output:, metadata: {}, provider_metadata: {}) ⇒ Object
Instance Method Summary collapse
- #failure? ⇒ Boolean
-
#initialize(success:, output:, error:, metadata:, provider_metadata: {}) ⇒ ClientResult
constructor
A new instance of ClientResult.
- #success? ⇒ Boolean
Constructor Details
#initialize(success:, output:, error:, metadata:, provider_metadata: {}) ⇒ ClientResult
Returns a new instance of ClientResult.
8 9 10 11 12 13 14 |
# File 'app/services/command_tower/clients/client_result.rb', line 8 def initialize(success:, output:, error:, metadata:, provider_metadata: {}) @success = success @output = output @error = error @metadata = @provider_metadata = end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
6 7 8 |
# File 'app/services/command_tower/clients/client_result.rb', line 6 def error @error end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
6 7 8 |
# File 'app/services/command_tower/clients/client_result.rb', line 6 def @metadata end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
6 7 8 |
# File 'app/services/command_tower/clients/client_result.rb', line 6 def output @output end |
#provider_metadata ⇒ Object (readonly)
Returns the value of attribute provider_metadata.
6 7 8 |
# File 'app/services/command_tower/clients/client_result.rb', line 6 def @provider_metadata end |
Class Method Details
.failure(error:, output: nil, metadata: {}, provider_metadata: {}) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'app/services/command_tower/clients/client_result.rb', line 34 def self.failure(error:, output: nil, metadata: {}, provider_metadata: {}) new( success: false, output: output, error: error, metadata: , provider_metadata: ) end |
.success(output:, metadata: {}, provider_metadata: {}) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'app/services/command_tower/clients/client_result.rb', line 24 def self.success(output:, metadata: {}, provider_metadata: {}) new( success: true, output: output, error: nil, metadata: , provider_metadata: ) end |
Instance Method Details
#failure? ⇒ Boolean
20 21 22 |
# File 'app/services/command_tower/clients/client_result.rb', line 20 def failure? !success? end |
#success? ⇒ Boolean
16 17 18 |
# File 'app/services/command_tower/clients/client_result.rb', line 16 def success? @success end |