Module: SfCli::Sf::Apex::Generate
- Defined in:
- lib/sf_cli/sf/apex/generate.rb
Instance Method Summary collapse
-
#generate_class(name, output_dir: nil, template: nil, api_version: nil, raw_output: false) ⇒ Array
Generate an Apex class.
-
#generate_trigger(name, output_dir: nil, sobject: nil, event: nil, api_version: nil, raw_output: false) ⇒ Array
Generate an Apex trigger.
Instance Method Details
#generate_class(name, output_dir: nil, template: nil, api_version: nil, raw_output: false) ⇒ Array
Generate an Apex class
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/sf_cli/sf/apex/generate.rb', line 14 def generate_class(name, output_dir: nil, template: nil, api_version: nil, raw_output: false) flags = { :"name" => name, :"output-dir" => output_dir, :"template" => template, :"api-version" => api_version, } switches = { } command_output_format = raw_output ? :human : :json redirect_type = raw_output ? nil : :null_stderr action = __method__.to_s.tr('_', ' ') output = exec(action, flags: flags, switches: switches, redirection: redirect_type, raw_output: raw_output, format: command_output_format) return output if raw_output output['result']['created'] end |
#generate_trigger(name, output_dir: nil, sobject: nil, event: nil, api_version: nil, raw_output: false) ⇒ Array
Generate an Apex trigger
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/sf_cli/sf/apex/generate.rb', line 44 def generate_trigger(name, output_dir: nil, sobject: nil, event: nil, api_version: nil, raw_output: false) flags = { :"name" => name, :"output-dir" => output_dir, :"sobject" => sobject, :"event" => event&.map{|ev| %|"#{ev}"|}&.join(' '), :"api-version" => api_version, } switches = { } command_output_format = raw_output ? :human : :json redirect_type = raw_output ? nil : :null_stderr action = __method__.to_s.tr('_', ' ') output = exec(action, flags: flags, switches: switches, redirection: redirect_type, raw_output: raw_output, format: command_output_format) return output if raw_output output['result']['created'] end |