Class: CommandTower::Clients::ClientResult

Inherits:
Object
  • Object
show all
Defined in:
app/services/command_tower/clients/client_result.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#errorObject (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

#metadataObject (readonly)

Returns the value of attribute metadata.



6
7
8
# File 'app/services/command_tower/clients/client_result.rb', line 6

def 
  @metadata
end

#outputObject (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_metadataObject (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

Returns:

  • (Boolean)


20
21
22
# File 'app/services/command_tower/clients/client_result.rb', line 20

def failure?
  !success?
end

#success?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'app/services/command_tower/clients/client_result.rb', line 16

def success?
  @success
end