Class: ReactorSDK::Endpoints::Hosts
- Inherits:
-
BaseEndpoint
- Object
- BaseEndpoint
- ReactorSDK::Endpoints::Hosts
- Defined in:
- lib/reactor_sdk/endpoints/hosts.rb
Instance Method Summary collapse
-
#create(property_id:, attributes:) ⇒ ReactorSDK::Resources::Host
Creates a host within a property.
-
#delete(host_id) ⇒ nil
Deletes a host permanently.
-
#find(host_id) ⇒ ReactorSDK::Resources::Host
Retrieves a single host by its Adobe ID.
-
#list_for_property(property_id) ⇒ Array<ReactorSDK::Resources::Host>
Lists all hosts for a given property.
-
#property(host_id) ⇒ ReactorSDK::Resources::Property
Retrieves the property that owns a host.
-
#update(host_id, attributes) ⇒ ReactorSDK::Resources::Host
Updates an existing host.
Methods inherited from BaseEndpoint
Constructor Details
This class inherits a constructor from ReactorSDK::Endpoints::BaseEndpoint
Instance Method Details
#create(property_id:, attributes:) ⇒ ReactorSDK::Resources::Host
Creates a host within a property.
54 55 56 57 58 59 60 61 |
# File 'lib/reactor_sdk/endpoints/hosts.rb', line 54 def create(property_id:, attributes:) create_resource( "/properties/#{property_id}/hosts", 'hosts', Resources::Host, attributes: attributes ) end |
#delete(host_id) ⇒ nil
Deletes a host permanently.
86 87 88 |
# File 'lib/reactor_sdk/endpoints/hosts.rb', line 86 def delete(host_id) delete_resource("/hosts/#{host_id}") end |
#find(host_id) ⇒ ReactorSDK::Resources::Host
Retrieves a single host by its Adobe ID.
43 44 45 |
# File 'lib/reactor_sdk/endpoints/hosts.rb', line 43 def find(host_id) fetch_resource("/hosts/#{host_id}", Resources::Host) end |
#list_for_property(property_id) ⇒ Array<ReactorSDK::Resources::Host>
Lists all hosts for a given property. Follows pagination automatically — returns all hosts.
Most properties have exactly one host — the Adobe-managed Akamai host. Call this before creating an environment to obtain the host ID.
32 33 34 |
# File 'lib/reactor_sdk/endpoints/hosts.rb', line 32 def list_for_property(property_id) list_resources("/properties/#{property_id}/hosts", Resources::Host) end |
#property(host_id) ⇒ ReactorSDK::Resources::Property
Retrieves the property that owns a host.
96 97 98 |
# File 'lib/reactor_sdk/endpoints/hosts.rb', line 96 def property(host_id) fetch_resource("/hosts/#{host_id}/property", Resources::Property) end |
#update(host_id, attributes) ⇒ ReactorSDK::Resources::Host
Updates an existing host.
70 71 72 73 74 75 76 77 78 |
# File 'lib/reactor_sdk/endpoints/hosts.rb', line 70 def update(host_id, attributes) update_resource( "/hosts/#{host_id}", host_id, 'hosts', Resources::Host, attributes: attributes ) end |