Class: ReactorSDK::Endpoints::Properties
- Inherits:
-
BaseEndpoint
- Object
- BaseEndpoint
- ReactorSDK::Endpoints::Properties
- Defined in:
- lib/reactor_sdk/endpoints/properties.rb
Instance Method Summary collapse
-
#company(property_id) ⇒ ReactorSDK::Resources::Company
Retrieves the company that owns a property.
-
#create(company_id:, name:, platform:, domains: []) ⇒ ReactorSDK::Resources::Property
Creates a new property within a company.
-
#create_note(property_id, text) ⇒ ReactorSDK::Resources::Note
Creates a note on a property.
-
#delete(property_id) ⇒ nil
Deletes a property permanently.
-
#find(property_id) ⇒ ReactorSDK::Resources::Property
Retrieves a single property by its Adobe ID.
-
#list_for_company(company_id) ⇒ Array<ReactorSDK::Resources::Property>
Lists all properties for a given company.
-
#list_notes(property_id) ⇒ Array<ReactorSDK::Resources::Note>
Lists notes attached to a property.
-
#update(property_id, attributes) ⇒ ReactorSDK::Resources::Property
Updates an existing property.
Methods inherited from BaseEndpoint
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.
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.
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.
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.
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.
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.
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.
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.
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 |