Class: ReactorSDK::Endpoints::Properties

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

Instance Method Summary collapse

Methods inherited from BaseEndpoint

#initialize

Constructor Details

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

Instance Method Details

#company(property_id) ⇒ ReactorSDK::Resources::Company

Retrieves the company that owns a property.

Parameters:

  • property_id (String)

    Adobe property ID

Returns:



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

def company(property_id)
  fetch_resource("/properties/#{property_id}/company", Resources::Company)
end

#create(company_id:, name:, platform:, domains: []) ⇒ ReactorSDK::Resources::Property

Creates a new property within a company.

Parameters:

  • company_id (String)

    Adobe company ID

  • name (String)

    Display name for the property

  • platform (String)

    One of: “web”, “mobile”, “edge”

  • domains (Array<String>) (defaults to: [])

    Domains — required for web properties

Returns:

Raises:



62
63
64
65
66
67
68
69
# File 'lib/reactor_sdk/endpoints/properties.rb', line 62

def create(company_id:, name:, platform:, domains: [])
  create_resource(
    "/companies/#{company_id}/properties",
    'properties',
    Resources::Property,
    attributes: { name: name, platform: platform, domains: domains }
  )
end

#create_note(property_id, text) ⇒ ReactorSDK::Resources::Note

Creates a note on a property.

Parameters:

  • property_id (String)

    Adobe property ID

  • text (String)

    Note body text

Returns:



108
109
110
# File 'lib/reactor_sdk/endpoints/properties.rb', line 108

def create_note(property_id, text)
  create_note_for_path("/properties/#{property_id}/notes", text)
end

#delete(property_id) ⇒ nil

Deletes a property permanently. This action cannot be undone. All child resources (rules, data elements, environments) are also deleted.

Parameters:

  • property_id (String)

    Adobe property ID

Returns:

  • (nil)

Raises:



97
98
99
# File 'lib/reactor_sdk/endpoints/properties.rb', line 97

def delete(property_id)
  delete_resource("/properties/#{property_id}")
end

#find(property_id) ⇒ ReactorSDK::Resources::Property

Retrieves a single property by its Adobe ID.

Parameters:

  • property_id (String)

    Adobe property ID (format: “PR” + hex string)

Returns:

Raises:



38
39
40
# File 'lib/reactor_sdk/endpoints/properties.rb', line 38

def find(property_id)
  fetch_resource("/properties/#{property_id}", Resources::Property)
end

#list_for_company(company_id) ⇒ Array<ReactorSDK::Resources::Property>

Lists all properties for a given company. Follows pagination automatically — returns all properties.

Parameters:

  • company_id (String)

    Adobe company ID (format: “CO” + hex string)

Returns:

Raises:



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

def list_for_company(company_id)
  list_resources("/companies/#{company_id}/properties", Resources::Property)
end

#list_notes(property_id) ⇒ Array<ReactorSDK::Resources::Note>

Lists notes attached to a property.

Parameters:

  • property_id (String)

Returns:



118
119
120
# File 'lib/reactor_sdk/endpoints/properties.rb', line 118

def list_notes(property_id)
  list_notes_for_path("/properties/#{property_id}/notes")
end

#update(property_id, attributes) ⇒ ReactorSDK::Resources::Property

Updates an existing property.

Parameters:

  • property_id (String)

    Adobe property ID

  • attributes (Hash)

    Fields to update (e.g. { name: “New Name” })

Returns:

Raises:



79
80
81
82
83
84
85
86
87
# File 'lib/reactor_sdk/endpoints/properties.rb', line 79

def update(property_id, attributes)
  update_resource(
    "/properties/#{property_id}",
    property_id,
    'properties',
    Resources::Property,
    attributes: attributes
  )
end