Class: SfCli::Sf::Org::Core

Inherits:
Object
  • Object
show all
Includes:
Core::Base
Defined in:
lib/sf_cli/sf/org/core.rb

Overview

Defined Under Namespace

Classes: ConnectionInfo

Instance Attribute Summary

Attributes included from Core::Base

#varbose

Instance Method Summary collapse

Instance Method Details

#display(target_org: nil) ⇒ Object

returns the org’s connection information. (equivalent to sf org display)

target_org — an alias of paticular org, not default one

For more command details, see the command reference



44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/sf_cli/sf/org/core.rb', line 44

def display(target_org: nil)
  flags    = {:"target-org" => target_org}
  json = exec(__method__, flags: flags, redirection: :null_stderr)

  ConnectionInfo.new(
    id:           json['result']['id'],
    access_token: json['result']['accessToken'],
    alias:        json['result']['alias'],
    instance_url: json['result']['instanceUrl'],
    user_name:    json['result']['username'],
    api_version:  json['result']['apiVersion'],
    status:       json['result']['connectedStatus']
  )
end

#login_web(target_org: nil, instance_url: nil) ⇒ Object

login to the org by the browser. (equivalent to sf org login web)

target_org — an alias of paticular org, not default one
instance_url — custom login url.

examples:

sf.org.
sf.org. target_org: :dev  # if the org you login isn't the default one, you should give it alias name for later use.

For more command details, see the command reference



28
29
30
31
32
33
34
35
# File 'lib/sf_cli/sf/org/core.rb', line 28

def (target_org: nil, instance_url: nil)
  flags    = {
    :"alias"        => target_org,
    :"instance-url" => instance_url,
  }
  action = __method__.to_s.tr('_', ' ')
  exec(action, flags: flags)
end