Class: SfCli::Sf::Data::Query::RegularResultAdjuster

Inherits:
Object
  • Object
show all
Includes:
HelperMethods
Defined in:
lib/sf_cli/sf/data/query_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HelperMethods

#prepare_record_in_bulk_mode

Constructor Details

#initialize(result, model_class) ⇒ RegularResultAdjuster

Returns a new instance of RegularResultAdjuster.



11
12
13
14
# File 'lib/sf_cli/sf/data/query_helper.rb', line 11

def initialize(result, model_class)
  @result = result
  @model_class = model_class
end

Instance Attribute Details

#model_classObject (readonly)

Returns the value of attribute model_class.



9
10
11
# File 'lib/sf_cli/sf/data/query_helper.rb', line 9

def model_class
  @model_class
end

#resultObject (readonly)

Returns the value of attribute result.



9
10
11
# File 'lib/sf_cli/sf/data/query_helper.rb', line 9

def result
  @result
end

Instance Method Details

#get_return_valueObject



16
17
18
19
20
21
# File 'lib/sf_cli/sf/data/query_helper.rb', line 16

def get_return_value
  result['result']['records'].each_with_object([]) do |h, a|
    record = prepare_record(h)
    a << (model_class ? model_class.new(**record) : record)
  end
end