Class: Autoselect::AssertedEnvironment::Autoselect

Inherits:
Base
  • Object
show all
Includes:
Operators
Defined in:
lib/autoselect/asserted_environment/autoselect.rb

Constant Summary

Constants included from Operators

Operators::OPERATORS

Instance Attribute Summary

Attributes inherited from Base

#effective_term, #level_params, #operator, #project_id, #raw_term, #requested_level, #user_id

Instance Method Summary collapse

Methods included from Operators

included

Methods inherited from Base

#build_config, #config_response, #execute_level, #find_level, #format_results, #initialize, #level_map_keys, #next_level_key, #record_list_operator?, #response, #term_response

Methods included from Operators

included, #parse_operators

Constructor Details

This class inherits a constructor from Autoselect::Base

Instance Method Details

#levelsObject

Ordered level stack — defines the fuse escalation sequence.



12
13
14
15
16
17
18
# File 'lib/autoselect/asserted_environment/autoselect.rb', line 12

def levels
  [
    ::Autoselect::AssertedEnvironment::Levels::Fast.new,
    ::Autoselect::AssertedEnvironment::Levels::Smart.new,
    ::Autoselect::AssertedEnvironment::Levels::Envo.new,
  ]
end

#resource_pathObject



7
8
9
# File 'lib/autoselect/asserted_environment/autoselect.rb', line 7

def resource_path
  '/asserted_environments/autoselect'
end

#response_values(record) ⇒ Hash

AssertedEnvironment records are per-object (polymorphic) join rows, so, unlike other models, selecting a result never references its id - a Fast- or Smart-level hit (an existing AssertedEnvironment) and an Envo-level hit (a pseudo-record, id: nil) all carry the same uri/uri_label shape here. The client uses these to create a new AssertedEnvironment for whatever object it is annotating.

Parameters:

Returns:

  • (Hash)


28
29
30
# File 'lib/autoselect/asserted_environment/autoselect.rb', line 28

def response_values(record)
  { uri: record.uri, uri_label: record.uri_label }
end