Class: SfCli::Sf::Model::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/sf_cli/sf/model/generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target_org: nil) ⇒ Generator

Returns a new instance of Generator.



10
11
12
13
# File 'lib/sf_cli/sf/model/generator.rb', line 10

def initialize(target_org: nil)
  @sf_sobject = ::SfCli::Sf::Sobject::Core.new
  @target_org = target_org
end

Instance Attribute Details

#sf_sobjectObject (readonly)

Returns the value of attribute sf_sobject.



8
9
10
# File 'lib/sf_cli/sf/model/generator.rb', line 8

def sf_sobject
  @sf_sobject
end

#target_orgObject (readonly)

Returns the value of attribute target_org.



8
9
10
# File 'lib/sf_cli/sf/model/generator.rb', line 8

def target_org
  @target_org
end

Instance Method Details

#describe(object_name) ⇒ Object



21
22
23
# File 'lib/sf_cli/sf/model/generator.rb', line 21

def describe(object_name)
  sf_sobject.describe object_name, target_org: target_org
end

#generate(object_name) ⇒ Object



15
16
17
18
19
# File 'lib/sf_cli/sf/model/generator.rb', line 15

def generate(object_name)
  class_definition = ClassDefinition.new(describe object_name)

  instance_eval "::#{object_name} = #{class_definition}"
end