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, raw_output: false) ⇒ 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

  • raw_output (Boolian) (defaults to: false)

    return the original command’s output.

Returns:

See Also:



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

def display(target_org: nil, api_version: nil, raw_output: false)
  flags    = {:"target-org" => target_org, :"api-version" => api_version}
  output = org_exec(__method__, flags: flags, redirection: :null_stderr, raw_output: raw_output)
  return output if raw_output

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