reactor_sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +19 -0
- data/LICENSE.txt +21 -0
- data/README.md +281 -0
- data/lib/reactor_sdk/authentication.rb +137 -0
- data/lib/reactor_sdk/client.rb +186 -0
- data/lib/reactor_sdk/configuration.rb +102 -0
- data/lib/reactor_sdk/connection.rb +342 -0
- data/lib/reactor_sdk/endpoints/app_configurations.rb +42 -0
- data/lib/reactor_sdk/endpoints/audit_events.rb +64 -0
- data/lib/reactor_sdk/endpoints/base_endpoint.rb +207 -0
- data/lib/reactor_sdk/endpoints/builds.rb +62 -0
- data/lib/reactor_sdk/endpoints/callbacks.rb +38 -0
- data/lib/reactor_sdk/endpoints/companies.rb +42 -0
- data/lib/reactor_sdk/endpoints/data_elements.rb +251 -0
- data/lib/reactor_sdk/endpoints/environments.rb +174 -0
- data/lib/reactor_sdk/endpoints/extension_package_usage_authorizations.rb +51 -0
- data/lib/reactor_sdk/endpoints/extension_packages.rb +63 -0
- data/lib/reactor_sdk/endpoints/extensions.rb +181 -0
- data/lib/reactor_sdk/endpoints/hosts.rb +101 -0
- data/lib/reactor_sdk/endpoints/libraries.rb +872 -0
- data/lib/reactor_sdk/endpoints/notes.rb +11 -0
- data/lib/reactor_sdk/endpoints/profiles.rb +14 -0
- data/lib/reactor_sdk/endpoints/properties.rb +123 -0
- data/lib/reactor_sdk/endpoints/revisions.rb +102 -0
- data/lib/reactor_sdk/endpoints/rule_components.rb +218 -0
- data/lib/reactor_sdk/endpoints/rules.rb +240 -0
- data/lib/reactor_sdk/endpoints/search.rb +23 -0
- data/lib/reactor_sdk/endpoints/secrets.rb +76 -0
- data/lib/reactor_sdk/error.rb +115 -0
- data/lib/reactor_sdk/library_comparison_builder.rb +74 -0
- data/lib/reactor_sdk/library_snapshot_builder.rb +66 -0
- data/lib/reactor_sdk/paginator.rb +92 -0
- data/lib/reactor_sdk/rate_limiter.rb +96 -0
- data/lib/reactor_sdk/reference_extractor.rb +34 -0
- data/lib/reactor_sdk/resource_metadata.rb +73 -0
- data/lib/reactor_sdk/resource_normalizer.rb +90 -0
- data/lib/reactor_sdk/resources/app_configuration.rb +20 -0
- data/lib/reactor_sdk/resources/audit_event.rb +45 -0
- data/lib/reactor_sdk/resources/base_resource.rb +181 -0
- data/lib/reactor_sdk/resources/build.rb +64 -0
- data/lib/reactor_sdk/resources/callback.rb +16 -0
- data/lib/reactor_sdk/resources/company.rb +38 -0
- data/lib/reactor_sdk/resources/comprehensive_data_element.rb +28 -0
- data/lib/reactor_sdk/resources/comprehensive_extension.rb +30 -0
- data/lib/reactor_sdk/resources/comprehensive_resource.rb +31 -0
- data/lib/reactor_sdk/resources/comprehensive_rule.rb +26 -0
- data/lib/reactor_sdk/resources/comprehensive_upstream_chain.rb +50 -0
- data/lib/reactor_sdk/resources/comprehensive_upstream_chain_entry.rb +34 -0
- data/lib/reactor_sdk/resources/data_element.rb +108 -0
- data/lib/reactor_sdk/resources/environment.rb +45 -0
- data/lib/reactor_sdk/resources/extension.rb +66 -0
- data/lib/reactor_sdk/resources/extension_package.rb +49 -0
- data/lib/reactor_sdk/resources/extension_package_usage_authorization.rb +26 -0
- data/lib/reactor_sdk/resources/host.rb +68 -0
- data/lib/reactor_sdk/resources/library.rb +67 -0
- data/lib/reactor_sdk/resources/library_comparison.rb +72 -0
- data/lib/reactor_sdk/resources/library_comparison_entry.rb +144 -0
- data/lib/reactor_sdk/resources/library_snapshot.rb +118 -0
- data/lib/reactor_sdk/resources/library_snapshot_extension_index.rb +70 -0
- data/lib/reactor_sdk/resources/library_snapshot_index.rb +169 -0
- data/lib/reactor_sdk/resources/library_with_resources.rb +194 -0
- data/lib/reactor_sdk/resources/note.rb +37 -0
- data/lib/reactor_sdk/resources/profile.rb +22 -0
- data/lib/reactor_sdk/resources/property.rb +44 -0
- data/lib/reactor_sdk/resources/revision.rb +156 -0
- data/lib/reactor_sdk/resources/rule.rb +44 -0
- data/lib/reactor_sdk/resources/rule_component.rb +101 -0
- data/lib/reactor_sdk/resources/search_results.rb +28 -0
- data/lib/reactor_sdk/resources/secret.rb +17 -0
- data/lib/reactor_sdk/resources/upstream_chain.rb +80 -0
- data/lib/reactor_sdk/resources/upstream_chain_entry.rb +55 -0
- data/lib/reactor_sdk/response_parser.rb +160 -0
- data/lib/reactor_sdk/version.rb +5 -0
- data/lib/reactor_sdk.rb +79 -0
- data/reactor_sdk.gemspec +70 -0
- data/sig/reactor_sdk.rbs +346 -0
- metadata +293 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ReactorSDK
|
|
4
|
+
module Resources
|
|
5
|
+
class ComprehensiveExtension < ComprehensiveResource
|
|
6
|
+
attr_reader :data_elements, :rule_components, :rules
|
|
7
|
+
|
|
8
|
+
def initialize(resource:, data_elements:, rule_components:, rules:)
|
|
9
|
+
super(resource: resource)
|
|
10
|
+
@data_elements = Array(data_elements)
|
|
11
|
+
@rule_components = Array(rule_components)
|
|
12
|
+
@rules = Array(rules)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def associated_records
|
|
16
|
+
(@data_elements + @rule_components + @rules).uniq
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def normalized_payload
|
|
20
|
+
payload = normalized_resource_payload
|
|
21
|
+
payload['associations'] = {
|
|
22
|
+
'data_elements' => summaries_for(@data_elements),
|
|
23
|
+
'rule_components' => summaries_for(@rule_components),
|
|
24
|
+
'rules' => summaries_for(@rules)
|
|
25
|
+
}
|
|
26
|
+
payload
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ReactorSDK
|
|
4
|
+
module Resources
|
|
5
|
+
class ComprehensiveResource
|
|
6
|
+
attr_reader :resource
|
|
7
|
+
|
|
8
|
+
def initialize(resource:)
|
|
9
|
+
@resource = resource
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def associated_records
|
|
13
|
+
[]
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def normalized_json
|
|
17
|
+
ReactorSDK::ResourceNormalizer.to_json(normalized_payload)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
protected
|
|
21
|
+
|
|
22
|
+
def normalized_resource_payload
|
|
23
|
+
ReactorSDK::ResourceNormalizer.normalize_resource(resource)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def summaries_for(resources)
|
|
27
|
+
Array(resources).map { |item| ReactorSDK::ResourceNormalizer.summary(item) }
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ReactorSDK
|
|
4
|
+
module Resources
|
|
5
|
+
class ComprehensiveRule < ComprehensiveResource
|
|
6
|
+
attr_reader :rule_components
|
|
7
|
+
|
|
8
|
+
def initialize(resource:, rule_components:)
|
|
9
|
+
super(resource: resource)
|
|
10
|
+
@rule_components = Array(rule_components)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def associated_records
|
|
14
|
+
@rule_components
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def normalized_payload
|
|
18
|
+
payload = normalized_resource_payload
|
|
19
|
+
payload['associations'] = {
|
|
20
|
+
'rule_components' => @rule_components.map { |component| ReactorSDK::ResourceNormalizer.normalize_resource(component) }
|
|
21
|
+
}
|
|
22
|
+
payload
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ReactorSDK
|
|
4
|
+
module Resources
|
|
5
|
+
class ComprehensiveUpstreamChain
|
|
6
|
+
include Enumerable
|
|
7
|
+
|
|
8
|
+
attr_reader :resource_id,
|
|
9
|
+
:resource_type,
|
|
10
|
+
:property_id,
|
|
11
|
+
:target_library_id,
|
|
12
|
+
:target_resource,
|
|
13
|
+
:target_revision_id,
|
|
14
|
+
:target_comprehensive_resource,
|
|
15
|
+
:entries
|
|
16
|
+
|
|
17
|
+
def initialize(
|
|
18
|
+
resource_id:,
|
|
19
|
+
resource_type:,
|
|
20
|
+
property_id:,
|
|
21
|
+
target_library_id:,
|
|
22
|
+
target_resource:,
|
|
23
|
+
target_revision_id:,
|
|
24
|
+
target_comprehensive_resource:,
|
|
25
|
+
entries:
|
|
26
|
+
)
|
|
27
|
+
@resource_id = resource_id
|
|
28
|
+
@resource_type = resource_type
|
|
29
|
+
@property_id = property_id
|
|
30
|
+
@target_library_id = target_library_id
|
|
31
|
+
@target_resource = target_resource
|
|
32
|
+
@target_revision_id = target_revision_id
|
|
33
|
+
@target_comprehensive_resource = target_comprehensive_resource
|
|
34
|
+
@entries = Array(entries)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def each(&)
|
|
38
|
+
@entries.each(&)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def nearest_match
|
|
42
|
+
@entries.find(&:present?)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def found?
|
|
46
|
+
!nearest_match.nil?
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ReactorSDK
|
|
4
|
+
module Resources
|
|
5
|
+
class ComprehensiveUpstreamChainEntry
|
|
6
|
+
attr_reader :library, :stage, :resource, :revision_id, :revision, :comprehensive_resource
|
|
7
|
+
|
|
8
|
+
def initialize(library:, stage:, resource:, revision_id:, revision:, comprehensive_resource:)
|
|
9
|
+
@library = library
|
|
10
|
+
@stage = stage
|
|
11
|
+
@resource = resource
|
|
12
|
+
@revision_id = revision_id
|
|
13
|
+
@revision = revision
|
|
14
|
+
@comprehensive_resource = comprehensive_resource
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def present?
|
|
18
|
+
!@resource.nil?
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def entity_snapshot
|
|
22
|
+
@revision&.entity_snapshot
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def normalized_payload
|
|
26
|
+
@comprehensive_resource&.normalized_payload
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def normalized_json
|
|
30
|
+
@comprehensive_resource&.normalized_json
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
##
|
|
4
|
+
# @file resources/data_element.rb
|
|
5
|
+
# @description Represents an Adobe Launch Data Element resource.
|
|
6
|
+
#
|
|
7
|
+
# Data elements are the building blocks of Adobe Launch's data layer.
|
|
8
|
+
# They define reusable values that can be referenced in rules and other
|
|
9
|
+
# data elements. Each data element is powered by an extension delegate.
|
|
10
|
+
#
|
|
11
|
+
# The settings field varies across extension types:
|
|
12
|
+
# - Core custom code data elements store JavaScript in settings["source"]
|
|
13
|
+
# - Other extensions define their own settings structure
|
|
14
|
+
#
|
|
15
|
+
# Use parsed_settings to access the full settings object as a Ruby Hash.
|
|
16
|
+
# This is the primary accessor for data element configuration — it covers
|
|
17
|
+
# all extension types uniformly, exactly as Adobe Launch displays settings
|
|
18
|
+
# in its own version comparison UI.
|
|
19
|
+
#
|
|
20
|
+
# @domain Resources
|
|
21
|
+
# @see https://developer.adobe.com/experience-platform/documentation/tags/api/endpoints/data-elements/
|
|
22
|
+
#
|
|
23
|
+
|
|
24
|
+
module ReactorSDK
|
|
25
|
+
module Resources
|
|
26
|
+
class DataElement < BaseResource
|
|
27
|
+
# @return [String] Display name of the data element
|
|
28
|
+
attribute :name
|
|
29
|
+
|
|
30
|
+
# @return [Boolean] Whether the data element is enabled
|
|
31
|
+
attribute :enabled, as: :boolean
|
|
32
|
+
|
|
33
|
+
# @return [Boolean] Whether to clean text values
|
|
34
|
+
attribute :clean_text, as: :boolean
|
|
35
|
+
|
|
36
|
+
# @return [Boolean] Whether to force lowercase
|
|
37
|
+
attribute :force_lower_case, as: :boolean
|
|
38
|
+
|
|
39
|
+
# @return [String, nil] Default value when the element returns nil
|
|
40
|
+
attribute :default_value
|
|
41
|
+
|
|
42
|
+
# @return [String, nil] How long to cache the value
|
|
43
|
+
# One of: "none", "pageview", "session", "visitor", or seconds as string
|
|
44
|
+
attribute :storage_duration
|
|
45
|
+
|
|
46
|
+
# @return [String] Identifies the extension delegate powering this element
|
|
47
|
+
# Format: "extension-package-name::data-element::element-name"
|
|
48
|
+
# Example: "core::dataElements::custom-code"
|
|
49
|
+
attribute :delegate_descriptor_id
|
|
50
|
+
|
|
51
|
+
# @return [String] Raw settings value exactly as returned by Adobe.
|
|
52
|
+
# May be a JSON-encoded string or a plain Hash depending on the extension.
|
|
53
|
+
# Use parsed_settings for reliable Hash access.
|
|
54
|
+
attribute :settings
|
|
55
|
+
|
|
56
|
+
# @return [String] ISO8601 timestamp when the element was created
|
|
57
|
+
attribute :created_at
|
|
58
|
+
|
|
59
|
+
# @return [String] ISO8601 timestamp when the element was last updated
|
|
60
|
+
attribute :updated_at
|
|
61
|
+
|
|
62
|
+
# @return [String, nil] ISO8601 timestamp when the element was last published
|
|
63
|
+
attribute :published_at
|
|
64
|
+
|
|
65
|
+
##
|
|
66
|
+
# Returns the settings field parsed into a Ruby Hash.
|
|
67
|
+
#
|
|
68
|
+
# This is the primary accessor for data element configuration. It handles
|
|
69
|
+
# all extension types uniformly:
|
|
70
|
+
# - Core custom code elements storing JavaScript as JSON-encoded string
|
|
71
|
+
# - Any third-party extension settings structure
|
|
72
|
+
#
|
|
73
|
+
# The app can render this as formatted JSON for display and diffing —
|
|
74
|
+
# exactly as Adobe Launch does in its own version comparison UI.
|
|
75
|
+
#
|
|
76
|
+
# Behaviour by input type:
|
|
77
|
+
# - JSON-encoded string → parsed into Hash
|
|
78
|
+
# - Already a Hash → returned as-is
|
|
79
|
+
# - nil or blank → returns empty Hash
|
|
80
|
+
# - Unparseable string → returns empty Hash, raw value still on settings
|
|
81
|
+
#
|
|
82
|
+
# The raw settings value is always preserved on the settings attribute
|
|
83
|
+
# unchanged — this method never modifies the underlying data.
|
|
84
|
+
#
|
|
85
|
+
# @return [Hash] Parsed settings or empty hash if nil, blank, or unparseable
|
|
86
|
+
#
|
|
87
|
+
def parsed_settings
|
|
88
|
+
raw = @attributes['settings']
|
|
89
|
+
return {} if raw.nil? || raw == ''
|
|
90
|
+
return raw if raw.is_a?(Hash)
|
|
91
|
+
|
|
92
|
+
JSON.parse(raw)
|
|
93
|
+
rescue JSON::ParserError
|
|
94
|
+
{}
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
##
|
|
98
|
+
# @return [String] Human-readable representation
|
|
99
|
+
#
|
|
100
|
+
def inspect
|
|
101
|
+
'#<ReactorSDK::Resources::DataElement ' \
|
|
102
|
+
"id=#{id.inspect} " \
|
|
103
|
+
"name=#{name.inspect} " \
|
|
104
|
+
"delegate=#{delegate_descriptor_id.inspect}>"
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
##
|
|
4
|
+
# @file resources/environment.rb
|
|
5
|
+
# @description Represents an Adobe Launch Environment resource.
|
|
6
|
+
#
|
|
7
|
+
# Environments map to deployment targets within a property.
|
|
8
|
+
# Each property has three built-in environments: development,
|
|
9
|
+
# staging, and production. Additional environments can be created
|
|
10
|
+
# for personal developer sandboxes.
|
|
11
|
+
#
|
|
12
|
+
# @domain Resources
|
|
13
|
+
# @see https://developer.adobe.com/experience-platform/documentation/tags/api/endpoints/environments/
|
|
14
|
+
#
|
|
15
|
+
|
|
16
|
+
module ReactorSDK
|
|
17
|
+
module Resources
|
|
18
|
+
class Environment < BaseResource
|
|
19
|
+
# @return [String] Display name of the environment
|
|
20
|
+
attribute :name
|
|
21
|
+
|
|
22
|
+
# @return [String] Stage — one of: "development", "staging", "production"
|
|
23
|
+
attribute :stage
|
|
24
|
+
|
|
25
|
+
# @return [Boolean] Whether the environment is archived
|
|
26
|
+
attribute :archived, as: :boolean
|
|
27
|
+
|
|
28
|
+
# @return [String, nil] Embed code for this environment
|
|
29
|
+
attribute :token
|
|
30
|
+
|
|
31
|
+
# @return [String] ISO8601 timestamp when the environment was created
|
|
32
|
+
attribute :created_at
|
|
33
|
+
|
|
34
|
+
# @return [String] ISO8601 timestamp when the environment was last updated
|
|
35
|
+
attribute :updated_at
|
|
36
|
+
|
|
37
|
+
##
|
|
38
|
+
# @return [String] Human-readable representation
|
|
39
|
+
#
|
|
40
|
+
def inspect
|
|
41
|
+
"#<ReactorSDK::Resources::Environment id=#{id.inspect} name=#{name.inspect} stage=#{stage.inspect}>"
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
##
|
|
4
|
+
# @file resources/extension.rb
|
|
5
|
+
# @description Represents an Adobe Launch Extension resource.
|
|
6
|
+
#
|
|
7
|
+
# Extensions provide the delegates (conditions, actions, data element
|
|
8
|
+
# types) available within a property. The Core extension is always
|
|
9
|
+
# present. Third-party extensions such as Adobe Analytics are installed
|
|
10
|
+
# separately. Extension versions are tracked via delegate_descriptor_id.
|
|
11
|
+
#
|
|
12
|
+
# @domain Resources
|
|
13
|
+
# @see https://developer.adobe.com/experience-platform/documentation/tags/api/endpoints/extensions/
|
|
14
|
+
#
|
|
15
|
+
|
|
16
|
+
module ReactorSDK
|
|
17
|
+
module Resources
|
|
18
|
+
class Extension < BaseResource
|
|
19
|
+
# @return [String] Identifies the extension package and version
|
|
20
|
+
attribute :delegate_descriptor_id
|
|
21
|
+
|
|
22
|
+
# @return [String] Display name of the extension
|
|
23
|
+
attribute :name
|
|
24
|
+
|
|
25
|
+
# @return [String] Raw settings value exactly as returned by Adobe
|
|
26
|
+
attribute :settings
|
|
27
|
+
|
|
28
|
+
# @return [String] ISO8601 timestamp when the extension was installed
|
|
29
|
+
attribute :created_at
|
|
30
|
+
|
|
31
|
+
# @return [String] ISO8601 timestamp when the extension was last updated
|
|
32
|
+
attribute :updated_at
|
|
33
|
+
|
|
34
|
+
# @return [String, nil] ISO8601 timestamp when the extension was published
|
|
35
|
+
attribute :published_at
|
|
36
|
+
|
|
37
|
+
##
|
|
38
|
+
# Returns the settings field parsed into a Ruby Hash.
|
|
39
|
+
#
|
|
40
|
+
# Extension-level settings vary by extension type. Use this for
|
|
41
|
+
# display and diffing — exactly as Adobe Launch does in its own
|
|
42
|
+
# version comparison UI.
|
|
43
|
+
#
|
|
44
|
+
# @return [Hash] Parsed settings or empty hash if nil, blank, or unparseable
|
|
45
|
+
#
|
|
46
|
+
def parsed_settings
|
|
47
|
+
raw = @attributes['settings']
|
|
48
|
+
return {} if raw.nil? || raw == ''
|
|
49
|
+
return raw if raw.is_a?(Hash)
|
|
50
|
+
|
|
51
|
+
JSON.parse(raw)
|
|
52
|
+
rescue JSON::ParserError
|
|
53
|
+
{}
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
##
|
|
57
|
+
# @return [String] Human-readable representation
|
|
58
|
+
#
|
|
59
|
+
def inspect
|
|
60
|
+
'#<ReactorSDK::Resources::Extension ' \
|
|
61
|
+
"id=#{id.inspect} " \
|
|
62
|
+
"delegate=#{delegate_descriptor_id.inspect}>"
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
##
|
|
4
|
+
# @file resources/extension_package.rb
|
|
5
|
+
# @description Represents an Adobe Launch Extension Package resource.
|
|
6
|
+
#
|
|
7
|
+
# Extension packages are the installable packages behind property extensions.
|
|
8
|
+
# They are returned when traversing extension relationships or audit events
|
|
9
|
+
# that reference package changes.
|
|
10
|
+
#
|
|
11
|
+
# @domain Resources
|
|
12
|
+
#
|
|
13
|
+
|
|
14
|
+
module ReactorSDK
|
|
15
|
+
module Resources
|
|
16
|
+
class ExtensionPackage < BaseResource
|
|
17
|
+
# @return [String] Package name
|
|
18
|
+
attribute :name
|
|
19
|
+
|
|
20
|
+
# @return [String, nil] Human-readable display name
|
|
21
|
+
attribute :display_name
|
|
22
|
+
|
|
23
|
+
# @return [String, nil] Supported platform, such as "web" or "edge"
|
|
24
|
+
attribute :platform
|
|
25
|
+
|
|
26
|
+
# @return [String, nil] Package availability
|
|
27
|
+
attribute :availability
|
|
28
|
+
|
|
29
|
+
# @return [String, nil] Package version
|
|
30
|
+
attribute :version
|
|
31
|
+
|
|
32
|
+
# @return [String] ISO8601 timestamp when the package was created
|
|
33
|
+
attribute :created_at
|
|
34
|
+
|
|
35
|
+
# @return [String] ISO8601 timestamp when the package was last updated
|
|
36
|
+
attribute :updated_at
|
|
37
|
+
|
|
38
|
+
##
|
|
39
|
+
# @return [String] Human-readable representation
|
|
40
|
+
#
|
|
41
|
+
def inspect
|
|
42
|
+
'#<ReactorSDK::Resources::ExtensionPackage ' \
|
|
43
|
+
"id=#{id.inspect} " \
|
|
44
|
+
"name=#{name.inspect} " \
|
|
45
|
+
"version=#{version.inspect}>"
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ReactorSDK
|
|
4
|
+
module Resources
|
|
5
|
+
class ExtensionPackageUsageAuthorization < BaseResource
|
|
6
|
+
attribute :name
|
|
7
|
+
attribute :platform
|
|
8
|
+
attribute :owner_org_id
|
|
9
|
+
attribute :owner_org_name
|
|
10
|
+
attribute :authorized_org_id
|
|
11
|
+
attribute :authorized_org_name
|
|
12
|
+
attribute :state
|
|
13
|
+
attribute :created_by_email
|
|
14
|
+
attribute :created_by_display_name
|
|
15
|
+
attribute :updated_by_email
|
|
16
|
+
attribute :updated_by_display_name
|
|
17
|
+
attribute :created_at
|
|
18
|
+
attribute :updated_at
|
|
19
|
+
|
|
20
|
+
def inspect
|
|
21
|
+
'#<ReactorSDK::Resources::ExtensionPackageUsageAuthorization ' \
|
|
22
|
+
"id=#{id.inspect} authorized_org_id=#{authorized_org_id.inspect} state=#{state.inspect}>"
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
##
|
|
4
|
+
# @file resources/host.rb
|
|
5
|
+
# @description Represents an Adobe Launch Host resource.
|
|
6
|
+
#
|
|
7
|
+
# Hosts define where Adobe Launch builds are deployed. Every environment
|
|
8
|
+
# requires a host assignment before it can be created. Adobe manages
|
|
9
|
+
# the default Akamai host automatically — most properties have exactly
|
|
10
|
+
# one host of type "akamai".
|
|
11
|
+
#
|
|
12
|
+
# Hosts must be fetched before creating an environment so the correct
|
|
13
|
+
# host ID can be included in the environment creation payload.
|
|
14
|
+
#
|
|
15
|
+
# @domain Resources
|
|
16
|
+
# @see https://developer.adobe.com/experience-platform/documentation/tags/api/endpoints/hosts/
|
|
17
|
+
#
|
|
18
|
+
|
|
19
|
+
module ReactorSDK
|
|
20
|
+
module Resources
|
|
21
|
+
class Host < BaseResource
|
|
22
|
+
# @return [String] Display name of the host
|
|
23
|
+
attribute :name
|
|
24
|
+
|
|
25
|
+
# @return [String] Host type — typically "akamai" for Adobe-managed hosts
|
|
26
|
+
attribute :type_of
|
|
27
|
+
|
|
28
|
+
# @return [String] Host status — "succeeded", "failed", "pending"
|
|
29
|
+
attribute :status
|
|
30
|
+
|
|
31
|
+
# @return [String] ISO8601 timestamp when the host was created
|
|
32
|
+
attribute :created_at
|
|
33
|
+
|
|
34
|
+
# @return [String] ISO8601 timestamp when the host was last updated
|
|
35
|
+
attribute :updated_at
|
|
36
|
+
|
|
37
|
+
##
|
|
38
|
+
# Returns true if the host is an Adobe-managed Akamai host.
|
|
39
|
+
# Most properties have exactly one Akamai host by default.
|
|
40
|
+
#
|
|
41
|
+
# @return [Boolean]
|
|
42
|
+
#
|
|
43
|
+
def akamai?
|
|
44
|
+
type_of == 'akamai'
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
##
|
|
48
|
+
# Returns true if the host is ready for use.
|
|
49
|
+
#
|
|
50
|
+
# @return [Boolean]
|
|
51
|
+
#
|
|
52
|
+
def ready?
|
|
53
|
+
status == 'succeeded'
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
##
|
|
57
|
+
# @return [String] Human-readable representation
|
|
58
|
+
#
|
|
59
|
+
def inspect
|
|
60
|
+
'#<ReactorSDK::Resources::Host ' \
|
|
61
|
+
"id=#{id.inspect} " \
|
|
62
|
+
"name=#{name.inspect} " \
|
|
63
|
+
"type_of=#{type_of.inspect} " \
|
|
64
|
+
"status=#{status.inspect}>"
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
##
|
|
4
|
+
# @file resources/library.rb
|
|
5
|
+
# @description Represents an Adobe Launch Library resource.
|
|
6
|
+
#
|
|
7
|
+
# A library is a collection of rules, data elements, and extensions
|
|
8
|
+
# that gets built into a deployable JavaScript bundle. Libraries move
|
|
9
|
+
# through a state machine: development -> submitted -> approved ->
|
|
10
|
+
# rejected -> published. Each library is assigned to one environment.
|
|
11
|
+
#
|
|
12
|
+
# @domain Resources
|
|
13
|
+
# @see https://developer.adobe.com/experience-platform/documentation/tags/api/endpoints/libraries/
|
|
14
|
+
#
|
|
15
|
+
|
|
16
|
+
module ReactorSDK
|
|
17
|
+
module Resources
|
|
18
|
+
class Library < BaseResource
|
|
19
|
+
# @return [String] Display name of the library
|
|
20
|
+
attribute :name
|
|
21
|
+
|
|
22
|
+
# @return [String] Current state of the library in its workflow
|
|
23
|
+
# One of: "development", "submitted", "approved", "rejected", "published"
|
|
24
|
+
attribute :state
|
|
25
|
+
|
|
26
|
+
# @return [Boolean] Whether the library has been published
|
|
27
|
+
attribute :published, as: :boolean
|
|
28
|
+
|
|
29
|
+
# @return [String] ISO8601 timestamp when the library was created
|
|
30
|
+
attribute :created_at
|
|
31
|
+
|
|
32
|
+
# @return [String] ISO8601 timestamp when the library was last updated
|
|
33
|
+
attribute :updated_at
|
|
34
|
+
|
|
35
|
+
# @return [String, nil] ISO8601 timestamp when the library was published
|
|
36
|
+
attribute :published_at
|
|
37
|
+
|
|
38
|
+
# @return [String, nil] ISO8601 timestamp when the library build completed
|
|
39
|
+
attribute :build_required_detail
|
|
40
|
+
|
|
41
|
+
##
|
|
42
|
+
# Returns true if the library is in a state where it can be built.
|
|
43
|
+
#
|
|
44
|
+
# @return [Boolean]
|
|
45
|
+
#
|
|
46
|
+
def buildable?
|
|
47
|
+
state == 'development'
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
##
|
|
51
|
+
# Returns true if the library has been successfully published.
|
|
52
|
+
#
|
|
53
|
+
# @return [Boolean]
|
|
54
|
+
#
|
|
55
|
+
def published?
|
|
56
|
+
state == 'published'
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
##
|
|
60
|
+
# @return [String] Human-readable representation
|
|
61
|
+
#
|
|
62
|
+
def inspect
|
|
63
|
+
"#<ReactorSDK::Resources::Library id=#{id.inspect} name=#{name.inspect} state=#{state.inspect}>"
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ReactorSDK
|
|
4
|
+
module Resources
|
|
5
|
+
class LibraryComparison
|
|
6
|
+
include Enumerable
|
|
7
|
+
|
|
8
|
+
attr_reader :current_library_id,
|
|
9
|
+
:baseline_library_id,
|
|
10
|
+
:property_id,
|
|
11
|
+
:current_snapshot,
|
|
12
|
+
:baseline_snapshot,
|
|
13
|
+
:entries
|
|
14
|
+
|
|
15
|
+
def initialize(
|
|
16
|
+
current_library_id:,
|
|
17
|
+
baseline_library_id:,
|
|
18
|
+
property_id:,
|
|
19
|
+
current_snapshot:,
|
|
20
|
+
baseline_snapshot:,
|
|
21
|
+
entries:
|
|
22
|
+
)
|
|
23
|
+
@current_library_id = current_library_id
|
|
24
|
+
@baseline_library_id = baseline_library_id
|
|
25
|
+
@property_id = property_id
|
|
26
|
+
@current_snapshot = current_snapshot
|
|
27
|
+
@baseline_snapshot = baseline_snapshot
|
|
28
|
+
@entries = Array(entries)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def current_library
|
|
32
|
+
@current_snapshot.library
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def baseline_library
|
|
36
|
+
@baseline_snapshot.library
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def each(&)
|
|
40
|
+
@entries.each(&)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def added_entries
|
|
44
|
+
@entries.select(&:added?)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def removed_entries
|
|
48
|
+
@entries.select(&:removed?)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def modified_entries
|
|
52
|
+
@entries.select(&:modified?)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def unchanged_entries
|
|
56
|
+
@entries.select(&:unchanged?)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def changed_entries
|
|
60
|
+
@entries.reject(&:unchanged?)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def changeset_documents(include_unchanged: false)
|
|
64
|
+
selected_entries = include_unchanged ? @entries : changed_entries
|
|
65
|
+
|
|
66
|
+
selected_entries.each_with_index.map do |entry, index|
|
|
67
|
+
entry.changeset_document(position: index)
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|