Module: SfCli::Sf::Data::GetRecord
- Included in:
- Core
- Defined in:
- lib/sf_cli/sf/data/get_record.rb
Instance Method Summary collapse
-
#get_record(object_type, record_id: nil, where: nil, target_org: nil, model_class: nil) ⇒ Hash, Class
Get a object record.
Instance Method Details
#get_record(object_type, record_id: nil, where: nil, target_org: nil, model_class: nil) ⇒ Hash, Class
Get a object record.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/sf_cli/sf/data/get_record.rb', line 23 def get_record(object_type, record_id: nil, where: nil, target_org: nil, model_class: nil) where_conditions = field_value_pairs(where) flags = { :"sobject" => object_type, :"record-id" => record_id, :"where" => (where_conditions.nil? ? nil : %|"#{where_conditions}"|), :"target-org" => target_org, } action = __method__.to_s.tr('_', ' ') json = exec(action, flags: flags, redirection: :null_stderr) result = json['result'] result.delete 'attributes' model_class ? model_class.new(**result) : result end |