Sha256: b4d91938c299ed45f8f7a689b1c6bfc2774723f62ca0566c147d77f18adc7dc7

Contents?: true

Size: 827 Bytes

Versions: 6

Compression:

Stored size: 827 Bytes

Contents

module SfConnect
  #
  # define to salesforce connective module
  #
  class Define
    attr_reader :salesforce_object_name, :fields

    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

    def call
      @define
    end

    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
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sf_connect-0.2.4 lib/sf_connect/define.rb
sf_connect-0.2.3 lib/sf_connect/define.rb
sf_connect-0.2.2 lib/sf_connect/define.rb
sf_connect-0.2.1 lib/sf_connect/define.rb
sf_connect-0.2.0 lib/sf_connect/define.rb
sf_connect-0.1.1 lib/sf_connect/define.rb