Class: Blacklight::Suggest::Response
- Inherits:
 - 
      Object
      
        
- Object
 - Blacklight::Suggest::Response
 
 
- Defined in:
 - app/models/concerns/blacklight/suggest/response.rb
 
Instance Attribute Summary collapse
- 
  
    
      #request_params  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute request_params.
 - 
  
    
      #response  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute response.
 - 
  
    
      #suggest_path  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute suggest_path.
 - 
  
    
      #suggester_name  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute suggester_name.
 
Instance Method Summary collapse
- 
  
    
      #initialize(response, request_params, suggest_path, suggester_name)  ⇒ Response 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
Creates a suggest response.
 - 
  
    
      #suggestions  ⇒ Array 
    
    
  
  
  
  
  
  
  
  
  
    
Trys the suggester response to return suggestions if they are present.
 
Constructor Details
#initialize(response, request_params, suggest_path, suggester_name) ⇒ Response
Creates a suggest response
      14 15 16 17 18 19  | 
    
      # File 'app/models/concerns/blacklight/suggest/response.rb', line 14 def initialize(response, request_params, suggest_path, suggester_name) @response = response @request_params = request_params @suggest_path = suggest_path @suggester_name = suggester_name end  | 
  
Instance Attribute Details
#request_params ⇒ Object (readonly)
Returns the value of attribute request_params.
      6 7 8  | 
    
      # File 'app/models/concerns/blacklight/suggest/response.rb', line 6 def request_params @request_params end  | 
  
#response ⇒ Object (readonly)
Returns the value of attribute response.
      6 7 8  | 
    
      # File 'app/models/concerns/blacklight/suggest/response.rb', line 6 def response @response end  | 
  
#suggest_path ⇒ Object (readonly)
Returns the value of attribute suggest_path.
      6 7 8  | 
    
      # File 'app/models/concerns/blacklight/suggest/response.rb', line 6 def suggest_path @suggest_path end  | 
  
#suggester_name ⇒ Object (readonly)
Returns the value of attribute suggester_name.
      6 7 8  | 
    
      # File 'app/models/concerns/blacklight/suggest/response.rb', line 6 def suggester_name @suggester_name end  | 
  
Instance Method Details
#suggestions ⇒ Array
Trys the suggester response to return suggestions if they are present
      25 26 27  | 
    
      # File 'app/models/concerns/blacklight/suggest/response.rb', line 25 def suggestions (response.dig(suggest_path, suggester_name, request_params[:q], 'suggestions') || []).uniq end  |