Class: ReactorSDK::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/reactor_sdk/configuration.rb

Constant Summary collapse

DEFAULT_BASE_URL =

Default Reactor API base URL

'https://reactor.adobe.io'
DEFAULT_TIMEOUT =

Default HTTP timeout in seconds

30

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client_id:, client_secret:, org_id:, base_url: DEFAULT_BASE_URL, ims_token_url: Authentication::IMS_TOKEN_URL, timeout: DEFAULT_TIMEOUT, logger: nil, auto_refresh_token: true) ⇒ Configuration

Initializes and validates SDK configuration.

Parameters:

  • client_id (String)

    Adobe Developer Console client ID

  • client_secret (String)

    Adobe Developer Console client secret

  • org_id (String)

    Adobe IMS organisation ID

  • base_url (String) (defaults to: DEFAULT_BASE_URL)

    Override Reactor API base URL (optional)

  • ims_token_url (String) (defaults to: Authentication::IMS_TOKEN_URL)

    Override IMS token URL — for testing only (optional)

  • timeout (Integer) (defaults to: DEFAULT_TIMEOUT)

    HTTP timeout in seconds (optional)

  • logger (Logger) (defaults to: nil)

    Custom logger instance (optional)

  • auto_refresh_token (Boolean) (defaults to: true)

    Auto-refresh token before expiry. When false, the initial token is still fetched, but later expiry raises AuthenticationError instead of refreshing. (optional)

Raises:



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/reactor_sdk/configuration.rb', line 65

def initialize(
  client_id:,
  client_secret:,
  org_id:,
  base_url: DEFAULT_BASE_URL,
  ims_token_url: Authentication::IMS_TOKEN_URL,
  timeout: DEFAULT_TIMEOUT,
  logger: nil,
  auto_refresh_token: true
)
  @client_id          = client_id
  @client_secret      = client_secret
  @org_id             = org_id
  @base_url           = base_url
  @ims_token_url      = ims_token_url
  @timeout            = timeout
  @logger             = logger
  @auto_refresh_token = auto_refresh_token

  validate!
end

Instance Attribute Details

#auto_refresh_tokenBoolean (readonly)

Returns Whether to auto-refresh the token before expiry.

Returns:

  • (Boolean)

    Whether to auto-refresh the token before expiry



48
49
50
# File 'lib/reactor_sdk/configuration.rb', line 48

def auto_refresh_token
  @auto_refresh_token
end

#base_urlString (readonly)

Returns Reactor API base URL.

Returns:

  • (String)

    Reactor API base URL



36
37
38
# File 'lib/reactor_sdk/configuration.rb', line 36

def base_url
  @base_url
end

#client_idString (readonly)

Returns Adobe Developer Console client ID.

Returns:

  • (String)

    Adobe Developer Console client ID



27
28
29
# File 'lib/reactor_sdk/configuration.rb', line 27

def client_id
  @client_id
end

#client_secretString (readonly)

Returns Adobe Developer Console client secret.

Returns:

  • (String)

    Adobe Developer Console client secret



30
31
32
# File 'lib/reactor_sdk/configuration.rb', line 30

def client_secret
  @client_secret
end

#ims_token_urlString (readonly)

Returns Adobe IMS token endpoint URL — overridable for testing.

Returns:

  • (String)

    Adobe IMS token endpoint URL — overridable for testing



39
40
41
# File 'lib/reactor_sdk/configuration.rb', line 39

def ims_token_url
  @ims_token_url
end

#loggerLogger? (readonly)

Returns Optional logger — if provided, HTTP calls are logged.

Returns:

  • (Logger, nil)

    Optional logger — if provided, HTTP calls are logged



45
46
47
# File 'lib/reactor_sdk/configuration.rb', line 45

def logger
  @logger
end

#org_idString (readonly)

Returns Adobe IMS organisation ID (format: XXXXX@AdobeOrg).

Returns:

  • (String)

    Adobe IMS organisation ID (format: XXXXX@AdobeOrg)



33
34
35
# File 'lib/reactor_sdk/configuration.rb', line 33

def org_id
  @org_id
end

#timeoutInteger (readonly)

Returns HTTP timeout in seconds.

Returns:

  • (Integer)

    HTTP timeout in seconds



42
43
44
# File 'lib/reactor_sdk/configuration.rb', line 42

def timeout
  @timeout
end