Class: ReactorSDK::Endpoints::Extensions

Inherits:
BaseEndpoint show all
Defined in:
lib/reactor_sdk/endpoints/extensions.rb

Instance Method Summary collapse

Methods inherited from BaseEndpoint

#initialize

Constructor Details

This class inherits a constructor from ReactorSDK::Endpoints::BaseEndpoint

Instance Method Details

#comprehensive_upstream_chain(extension_or_id, library_id:, property_id:) ⇒ ReactorSDK::Resources::ComprehensiveUpstreamChain

Resolves the extension across the ordered upstream chain using snapshot-aware comprehensive review objects.

Parameters:

Returns:



153
154
155
156
157
158
159
160
# File 'lib/reactor_sdk/endpoints/extensions.rb', line 153

def comprehensive_upstream_chain(extension_or_id, library_id:, property_id:)
  libraries_endpoint.comprehensive_upstream_chain_for_resource(
    extension_or_id,
    library_id: library_id,
    property_id: property_id,
    resource_type: 'extensions'
  )
end

#create(property_id:, attributes:, relationships:) ⇒ ReactorSDK::Resources::Extension

Creates an extension within a property.

Parameters:

  • property_id (String)
  • attributes (Hash)
  • relationships (Hash)

Returns:



54
55
56
57
58
59
60
61
62
# File 'lib/reactor_sdk/endpoints/extensions.rb', line 54

def create(property_id:, attributes:, relationships:)
  create_resource(
    "/properties/#{property_id}/extensions",
    'extensions',
    Resources::Extension,
    attributes: attributes,
    relationships: relationships
  )
end

#create_note(extension_id, text) ⇒ Object



166
167
168
# File 'lib/reactor_sdk/endpoints/extensions.rb', line 166

def create_note(extension_id, text)
  create_note_for_path("/extensions/#{extension_id}/notes", text)
end

#delete(extension_id) ⇒ Object



87
88
89
# File 'lib/reactor_sdk/endpoints/extensions.rb', line 87

def delete(extension_id)
  delete_resource("/extensions/#{extension_id}")
end

#extension_package(extension_id) ⇒ Object



91
92
93
# File 'lib/reactor_sdk/endpoints/extensions.rb', line 91

def extension_package(extension_id)
  fetch_resource("/extensions/#{extension_id}/extension_package", Resources::ExtensionPackage)
end

#find(extension_id) ⇒ ReactorSDK::Resources::Extension

Retrieves a single extension by its Adobe ID.

Parameters:

  • extension_id (String)

    Adobe extension ID (format: “EX” + hex string)

Returns:

Raises:



41
42
43
44
# File 'lib/reactor_sdk/endpoints/extensions.rb', line 41

def find(extension_id)
  response = @connection.get("/extensions/#{extension_id}")
  @parser.parse(response['data'], Resources::Extension)
end

#find_comprehensive(extension_id, library_id:, property_id:) ⇒ ReactorSDK::Resources::ComprehensiveExtension

Fetches the extension from a library-context review snapshot together with dependent resources and normalized review payload.

Parameters:

  • extension_id (String)
  • library_id (String)
  • property_id (String)

Returns:



133
134
135
136
137
138
139
140
141
142
# File 'lib/reactor_sdk/endpoints/extensions.rb', line 133

def find_comprehensive(extension_id, library_id:, property_id:)
  snapshot = libraries_endpoint.find_snapshot(library_id, property_id: property_id)
  comprehensive = snapshot.comprehensive_resource(extension_id, resource_type: 'extensions')
  unless comprehensive
    raise ReactorSDK::ResourceNotFoundError,
          "Extension #{extension_id} was not found in library #{library_id}"
  end

  comprehensive
end

#libraries(extension_id) ⇒ Object



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

def libraries(extension_id)
  list_resources("/extensions/#{extension_id}/libraries", Resources::Library)
end

#list_for_property(property_id) ⇒ Array<ReactorSDK::Resources::Extension>

Lists all extensions installed in a given property. Follows pagination automatically — returns all extensions.

Parameters:

  • property_id (String)

    Adobe property ID

Returns:

Raises:



29
30
31
32
# File 'lib/reactor_sdk/endpoints/extensions.rb', line 29

def list_for_property(property_id)
  records = @paginator.all("/properties/#{property_id}/extensions")
  records.map { |r| @parser.parse(r, Resources::Extension) }
end

#list_notes(extension_id) ⇒ Object



162
163
164
# File 'lib/reactor_sdk/endpoints/extensions.rb', line 162

def list_notes(extension_id)
  list_notes_for_path("/extensions/#{extension_id}/notes")
end

#origin(extension_id) ⇒ Object



103
104
105
# File 'lib/reactor_sdk/endpoints/extensions.rb', line 103

def origin(extension_id)
  fetch_resource("/extensions/#{extension_id}/origin", Resources::Extension)
end

#property(extension_id) ⇒ Object



99
100
101
# File 'lib/reactor_sdk/endpoints/extensions.rb', line 99

def property(extension_id)
  fetch_resource("/extensions/#{extension_id}/property", Resources::Property)
end

#revise(extension_id) ⇒ ReactorSDK::Resources::Extension

Revises an extension so it can be added to a library.

Adobe Launch requires every resource to be explicitly revised before it can be added to a library.

Always call revise before libraries.add_extensions.

Parameters:

  • extension_id (String)

    Adobe extension ID

Returns:

Raises:



76
77
78
79
80
81
82
83
84
85
# File 'lib/reactor_sdk/endpoints/extensions.rb', line 76

def revise(extension_id)
  update_resource(
    "/extensions/#{extension_id}",
    extension_id,
    'extensions',
    Resources::Extension,
    attributes: {},
    meta: { action: 'revise' }
  )
end

#upstream_chain(extension_or_id, library_id:, property_id:) ⇒ ReactorSDK::Resources::UpstreamChain

Resolves the extension across the ordered upstream library chain.

Parameters:

  • extension_or_id (String, ReactorSDK::Resources::Extension)
  • library_id (String)

    Adobe library ID used as the comparison root

  • property_id (String)

    Adobe property ID containing the library chain

Returns:



115
116
117
118
119
120
121
122
# File 'lib/reactor_sdk/endpoints/extensions.rb', line 115

def upstream_chain(extension_or_id, library_id:, property_id:)
  libraries_endpoint.upstream_chain_for_resource(
    extension_or_id,
    library_id: library_id,
    property_id: property_id,
    resource_type: 'extensions'
  )
end