Class: ReactorSDK::Client

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

Constant Summary collapse

ENDPOINT_CLASSES =
{
  companies: Endpoints::Companies,
  properties: Endpoints::Properties,
  app_configurations: Endpoints::AppConfigurations,
  callbacks: Endpoints::Callbacks,
  secrets: Endpoints::Secrets,
  environments: Endpoints::Environments,
  hosts: Endpoints::Hosts,
  rules: Endpoints::Rules,
  rule_components: Endpoints::RuleComponents,
  data_elements: Endpoints::DataElements,
  extensions: Endpoints::Extensions,
  extension_packages: Endpoints::ExtensionPackages,
  extension_package_usage_authorizations: Endpoints::ExtensionPackageUsageAuthorizations,
  libraries: Endpoints::Libraries,
  builds: Endpoints::Builds,
  audit_events: Endpoints::AuditEvents,
  revisions: Endpoints::Revisions,
  profiles: Endpoints::Profiles,
  search: Endpoints::Search,
  notes: Endpoints::Notes
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Initializes the client and all infrastructure dependencies.

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: Configuration::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 (optional)

  • timeout (Integer) (defaults to: Configuration::DEFAULT_TIMEOUT)

    HTTP timeout in seconds (optional)

  • logger (Logger) (defaults to: nil)

    Custom logger (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:



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/reactor_sdk/client.rb', line 130

def initialize(
  client_id:,
  client_secret:,
  org_id:,
  base_url:           Configuration::DEFAULT_BASE_URL,
  ims_token_url:      Authentication::IMS_TOKEN_URL,
  timeout:            Configuration::DEFAULT_TIMEOUT,
  logger:             nil,
  auto_refresh_token: true
)
  @config = Configuration.new(
    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
  )

  build_infrastructure
  build_endpoints
end

Instance Attribute Details

#app_configurationsReactorSDK::Endpoints::AppConfigurations (readonly)



59
60
61
# File 'lib/reactor_sdk/client.rb', line 59

def app_configurations
  @app_configurations
end

#audit_eventsReactorSDK::Endpoints::AuditEvents (readonly)



98
99
100
# File 'lib/reactor_sdk/client.rb', line 98

def audit_events
  @audit_events
end

#buildsReactorSDK::Endpoints::Builds (readonly)



95
96
97
# File 'lib/reactor_sdk/client.rb', line 95

def builds
  @builds
end

#callbacksReactorSDK::Endpoints::Callbacks (readonly)



62
63
64
# File 'lib/reactor_sdk/client.rb', line 62

def callbacks
  @callbacks
end

#companiesReactorSDK::Endpoints::Companies (readonly)



53
54
55
# File 'lib/reactor_sdk/client.rb', line 53

def companies
  @companies
end

#configReactorSDK::Configuration (readonly)



113
114
115
# File 'lib/reactor_sdk/client.rb', line 113

def config
  @config
end

#data_elementsReactorSDK::Endpoints::DataElements (readonly)



80
81
82
# File 'lib/reactor_sdk/client.rb', line 80

def data_elements
  @data_elements
end

#environmentsReactorSDK::Endpoints::Environments (readonly)



68
69
70
# File 'lib/reactor_sdk/client.rb', line 68

def environments
  @environments
end

#extension_package_usage_authorizationsReactorSDK::Endpoints::ExtensionPackageUsageAuthorizations (readonly)



89
90
91
# File 'lib/reactor_sdk/client.rb', line 89

def extension_package_usage_authorizations
  @extension_package_usage_authorizations
end

#extension_packagesReactorSDK::Endpoints::ExtensionPackages (readonly)



86
87
88
# File 'lib/reactor_sdk/client.rb', line 86

def extension_packages
  @extension_packages
end

#extensionsReactorSDK::Endpoints::Extensions (readonly)



83
84
85
# File 'lib/reactor_sdk/client.rb', line 83

def extensions
  @extensions
end

#hostsReactorSDK::Endpoints::Hosts (readonly)



71
72
73
# File 'lib/reactor_sdk/client.rb', line 71

def hosts
  @hosts
end

#librariesReactorSDK::Endpoints::Libraries (readonly)



92
93
94
# File 'lib/reactor_sdk/client.rb', line 92

def libraries
  @libraries
end

#notesReactorSDK::Endpoints::Notes (readonly)



110
111
112
# File 'lib/reactor_sdk/client.rb', line 110

def notes
  @notes
end

#profilesReactorSDK::Endpoints::Profiles (readonly)



104
105
106
# File 'lib/reactor_sdk/client.rb', line 104

def profiles
  @profiles
end

#propertiesReactorSDK::Endpoints::Properties (readonly)



56
57
58
# File 'lib/reactor_sdk/client.rb', line 56

def properties
  @properties
end

#revisionsReactorSDK::Endpoints::Revisions (readonly)



101
102
103
# File 'lib/reactor_sdk/client.rb', line 101

def revisions
  @revisions
end

#rule_componentsReactorSDK::Endpoints::RuleComponents (readonly)



77
78
79
# File 'lib/reactor_sdk/client.rb', line 77

def rule_components
  @rule_components
end

#rulesReactorSDK::Endpoints::Rules (readonly)



74
75
76
# File 'lib/reactor_sdk/client.rb', line 74

def rules
  @rules
end

#searchReactorSDK::Endpoints::Search (readonly)



107
108
109
# File 'lib/reactor_sdk/client.rb', line 107

def search
  @search
end

#secretsReactorSDK::Endpoints::Secrets (readonly)



65
66
67
# File 'lib/reactor_sdk/client.rb', line 65

def secrets
  @secrets
end