Module: SfCli::Sf::Org::Display

Included in:
Core
Defined in:
lib/sf_cli/sf/org/display.rb

Defined Under Namespace

Classes: ConnectionInfo

Instance Method Summary collapse

Instance Method Details

#display(target_org: nil, api_version: nil) ⇒ ConnectionInfo

Note:

this function returns the org information including security sensitive things such as access token, username and so on.

Returns the org’s connection information

Examples:

(in irb):
> sf.org.display
=>
#<struct SfCli::Sf::Org::Display::ConnectionInfo
 id="00D5j00000DiuxmEAB",
 access_token="<some access token>",
 alias="dev",
 instance_url="https://hoge-bar-baz.abc.my.salesforce.com.example",
 user_name="[email protected]",
 api_version="61.0",
 status="Connected">

Parameters:

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

    an alias of paticular org, or username can be used

  • api_version (Numeric) (defaults to: nil)

    override the api version used for api requests made by this command

Returns:

See Also:



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/sf_cli/sf/org/display.rb', line 32

def display(target_org: nil, api_version: nil)
  flags    = {:"target-org" => target_org, :"api-version" => api_version}
  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