Class: CommandTower::Services::ClientCompatibility::Evaluate::Decision

Inherits:
Object
  • Object
show all
Defined in:
app/services/command_tower/services/client_compatibility/evaluate.rb

Overview

Immutable decision/projection. recommendation_projection is the camelCase clientCompatibility shape (authority §13), present only when identity is parseable and current >= effective minimum.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(decision:, platform: nil, current_version: nil, effective_minimum: nil, scope: nil, recovery: nil, update_url: nil, matched_entity_names: [], recommendation_projection: nil) ⇒ Decision

Returns a new instance of Decision.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'app/services/command_tower/services/client_compatibility/evaluate.rb', line 24

def initialize(
  decision:,
  platform: nil,
  current_version: nil,
  effective_minimum: nil,
  scope: nil,
  recovery: nil,
  update_url: nil,
  matched_entity_names: [],
  recommendation_projection: nil
)
  @decision = decision
  @platform = platform
  @current_version = current_version
  @effective_minimum = effective_minimum
  @scope = scope
  @recovery = recovery
  @update_url = update_url
  @matched_entity_names = matched_entity_names
  @recommendation_projection = recommendation_projection
end

Instance Attribute Details

#current_version ⇒ Object (readonly)

Returns the value of attribute current_version.



21
22
23
# File 'app/services/command_tower/services/client_compatibility/evaluate.rb', line 21

def current_version
  @current_version
end

#decision ⇒ Object (readonly)

Returns the value of attribute decision.



21
22
23
# File 'app/services/command_tower/services/client_compatibility/evaluate.rb', line 21

def decision
  @decision
end

#effective_minimum ⇒ Object (readonly)

Returns the value of attribute effective_minimum.



21
22
23
# File 'app/services/command_tower/services/client_compatibility/evaluate.rb', line 21

def effective_minimum
  @effective_minimum
end

#matched_entity_names ⇒ Object (readonly)

Returns the value of attribute matched_entity_names.



21
22
23
# File 'app/services/command_tower/services/client_compatibility/evaluate.rb', line 21

def matched_entity_names
  @matched_entity_names
end

#platform ⇒ Object (readonly)

Returns the value of attribute platform.



21
22
23
# File 'app/services/command_tower/services/client_compatibility/evaluate.rb', line 21

def platform
  @platform
end

#recommendation_projection ⇒ Object (readonly)

Returns the value of attribute recommendation_projection.



21
22
23
# File 'app/services/command_tower/services/client_compatibility/evaluate.rb', line 21

def recommendation_projection
  @recommendation_projection
end

#recovery ⇒ Object (readonly)

Returns the value of attribute recovery.



21
22
23
# File 'app/services/command_tower/services/client_compatibility/evaluate.rb', line 21

def recovery
  @recovery
end

#scope ⇒ Object (readonly)

Returns the value of attribute scope.



21
22
23
# File 'app/services/command_tower/services/client_compatibility/evaluate.rb', line 21

def scope
  @scope
end

#update_url ⇒ Object (readonly)

Returns the value of attribute update_url.



21
22
23
# File 'app/services/command_tower/services/client_compatibility/evaluate.rb', line 21

def update_url
  @update_url
end

Instance Method Details

#compatible? ⇒ Boolean

Returns:

  • (Boolean)


46
# File 'app/services/command_tower/services/client_compatibility/evaluate.rb', line 46

def compatible? = %i[compatible recommended].include?(@decision)

#incompatible? ⇒ Boolean

Returns:

  • (Boolean)


48
# File 'app/services/command_tower/services/client_compatibility/evaluate.rb', line 48

def incompatible? = !compatible?