Module: SfCli::Sf::Data::Search
- Defined in:
 - lib/sf_cli/sf/data/search.rb
 
Instance Method Summary collapse
- 
  
    
      #search(sosl, target_org: nil, format: nil, api_version: nil)  ⇒ Hash 
    
    
  
  
  
  
  
  
  
  
  
    
Search objects using SOSL.
 
Instance Method Details
#search(sosl, target_org: nil, format: nil, api_version: nil) ⇒ Hash
    Note:
    
  
if you choose csv as format, csv files are downloaded in current directory
Search objects using SOSL.
      29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49  | 
    
      # File 'lib/sf_cli/sf/data/search.rb', line 29 def search(sosl, target_org: nil, format: nil, api_version: nil) flags = { :"query" => %|"#{sosl}"|, :"target-org" => target_org, :"result-format" => format, :"api-version" => api_version, } raw_output = format ? true : false format = format&.to_sym || :json result = exec(__method__, flags: flags, redirection: :null_stderr, raw_output: raw_output, format: format) return if format == :csv return result if format == :human result['result']['searchRecords'] .group_by{|r| r['attributes']['type']} .each_with_object({}) do |(object_type, records), result| result[object_type] = records.map{|r| r['Id']} end end  |