Class: SfConnect::Define

Inherits:
Object
  • Object
show all
Defined in:
lib/sf_connect/define.rb

Overview

define to salesforce connective module

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(salesforce_object_name, fields:, where: nil, &block) ⇒ Define

Returns a new instance of Define.



8
9
10
11
12
13
14
# File 'lib/sf_connect/define.rb', line 8

def initialize(salesforce_object_name, fields:, where: nil, &block)
  @salesforce_object_name = salesforce_object_name
  @define = generate_binding
  @define.include(SfConnect::Downloader)
  @define.include(SfConnect::Uploader)
  @fields = SfConnect::Fields.new(fields:, where:, salesforce_object_name:, block:)
end

Instance Attribute Details

#fieldsObject (readonly)

Returns the value of attribute fields.



6
7
8
# File 'lib/sf_connect/define.rb', line 6

def fields
  @fields
end

#salesforce_object_nameObject (readonly)

Returns the value of attribute salesforce_object_name.



6
7
8
# File 'lib/sf_connect/define.rb', line 6

def salesforce_object_name
  @salesforce_object_name
end

Instance Method Details

#callObject



16
17
18
# File 'lib/sf_connect/define.rb', line 16

def call
  @define
end

#generate_bindingObject



20
21
22
23
24
25
26
27
28
29
# File 'lib/sf_connect/define.rb', line 20

def generate_binding
  define = self
  Module.new do
    extend ActiveSupport::Concern
    class_methods do
      define_method(:salesforce_object_name) { define.salesforce_object_name }
      define_method(:salesforce_fields) { define.fields }
    end
  end
end