Class: SfCli::Sf::Data::Query::BulkResultAdjuster
- Inherits:
-
Object
- Object
- SfCli::Sf::Data::Query::BulkResultAdjuster
- Includes:
- HelperMethods
- Defined in:
- lib/sf_cli/sf/data/query_helper.rb
Instance Attribute Summary collapse
-
#model_class ⇒ Object
readonly
Returns the value of attribute model_class.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
- #get_return_value ⇒ Object
-
#initialize(result, model_class) ⇒ BulkResultAdjuster
constructor
A new instance of BulkResultAdjuster.
Methods included from HelperMethods
Constructor Details
#initialize(result, model_class) ⇒ BulkResultAdjuster
Returns a new instance of BulkResultAdjuster.
30 31 32 33 |
# File 'lib/sf_cli/sf/data/query_helper.rb', line 30 def initialize(result, model_class) @result = result @model_class = model_class end |
Instance Attribute Details
#model_class ⇒ Object (readonly)
Returns the value of attribute model_class.
28 29 30 |
# File 'lib/sf_cli/sf/data/query_helper.rb', line 28 def model_class @model_class end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
28 29 30 |
# File 'lib/sf_cli/sf/data/query_helper.rb', line 28 def result @result end |
Instance Method Details
#get_return_value ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/sf_cli/sf/data/query_helper.rb', line 35 def get_return_value done = result['result']['done'] id = result['result']['id'] rows = result['result']['records'].each_with_object([]) do |h, a| record = prepare_record_in_bulk_mode(h) a << (model_class ? model_class.new(**record) : record) end done ? [done, rows] : [done, id] end |