Class: SfCli::Sf::Model::SfCommandConnection

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

Overview

Connection object to access Salesforce based on Sf command

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target_org: nil, instance_url: nil) ⇒ SfCommandConnection

Returns a new instance of SfCommandConnection.

Parameters:

  • target_org (Symbol, String) (defaults to: nil)

    an alias of paticular org, or username can be used

  • instance_url (String) (defaults to: nil)

    URL of the instance that the org lives on.



20
21
22
23
24
25
26
# File 'lib/sf_cli/sf/model/sf_command_connection.rb', line 20

def initialize(target_org: nil, instance_url: nil)
  @sf_org = ::SfCli::Sf::Org::Core.new
  @sf_data = ::SfCli::Sf::Data::Core.new
  @sf_sobject = ::SfCli::Sf::Sobject::Core.new
  @target_org = target_org
  @instance_url = instance_url
end

Instance Attribute Details

#instance_urlObject (readonly)

Returns the value of attribute instance_url.



12
13
14
# File 'lib/sf_cli/sf/model/sf_command_connection.rb', line 12

def instance_url
  @instance_url
end

#target_orgObject (readonly)

Returns the value of attribute target_org.



12
13
14
# File 'lib/sf_cli/sf/model/sf_command_connection.rb', line 12

def target_org
  @target_org
end

Instance Method Details

#exec_query(soql, format: nil, bulk: false, wait: nil, model_class: nil) ⇒ Object

Sf command style query interface for Model module

For query details, see sf data query



40
41
42
# File 'lib/sf_cli/sf/model/sf_command_connection.rb', line 40

def exec_query(soql, format: nil, bulk: false, wait: nil, model_class: nil)
  sf_data.query(soql, target_org: target_org, format: format, bulk: bulk, wait: wait, model_class: model_class)
end

#openObject



28
29
30
31
32
33
34
# File 'lib/sf_cli/sf/model/sf_command_connection.rb', line 28

def open
  if ENV['SF_ACCESS_TOKEN']
    sf_org. target_org: target_org, instance_url: instance_url
  else
    sf_org. target_org: target_org, instance_url: instance_url
  end
end