Class: ReactorSDK::Endpoints::Hosts

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

Instance Method Summary collapse

Methods inherited from BaseEndpoint

#initialize

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.

Parameters:

  • property_id (String)

    Adobe property ID

  • attributes (Hash)

    Host attributes exactly as accepted by Reactor

Returns:



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.

Parameters:

  • host_id (String)

    Adobe host ID

Returns:

  • (nil)


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.

Parameters:

  • host_id (String)

    Adobe host ID (format: “HT” + hex string)

Returns:

Raises:



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.

Parameters:

  • property_id (String)

    Adobe property ID

Returns:

Raises:



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.

Parameters:

  • host_id (String)

    Adobe host ID

Returns:



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.

Parameters:

  • host_id (String)

    Adobe host ID

  • attributes (Hash)

    Fields to update

Returns:



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