🔍 Overview

The Voluum integration module provides an interface to manage landers and offers in the Voluum platform. It handles authentication, data synchronization with Redis, and bulk Links updates. The system uses Redis to map URLs to Voluum object IDs for efficient lookups during updates.


📦 Classes

1. VoluumAPIClient

Handles low-level API communication with Voluum API.

📑 Initialization Parameters

ParameterTypeDescription
api_key_idstrVoluum API key ID
api_keystrVoluum API secret key

🧩 Methods

MethodDescription
_authenticate()Authenticates with Voluum API using credentials (settings.VOLUUM_CREDENTIALS).
_send_request(method, endpoint, with_auth=False, params=None, payload=None)Sends HTTP request to Voluum API.
get_landers(include_deleted=False, fields=None)Retrieves landers with optional filtering.
get_lander(lander_id)Gets single lander by ID.
update_lander(lander_id, payload)Updates lander with new data.
get_offers(include_deleted=False, fields=None)Retrieves offers with optional filtering.
get_offer(offer_id)Gets single offer by ID.
update_offer(offer_id, payload)Updates offer with new data.

2. BaseVoluumManager (Abstract)

Defines core logic for URL-object mapping stored in Redis and provides methods for loading data and updating URLs across Voluum objects.

📑 Class Attributes

AttributeDescription
redis_keyRedis storage key (must be overridden).

🧩 Methods

MethodDescription
load()Builds URL → ID map and saves to Redis.
update(old_url, new_url)Updates all objects with matching URL.
_get_items(client)(Abstract) Fetches items from Voluum.
_update_item(client)(Abstract) Updates individual item.
_save_map(_map)Saves URL → ID map to Redis.
_find_url(url)Finds URL in Redis map. Returns matching IDs.

3. LandersVoluumManager & OffersVoluumManager

Manage landers/offers operations (extends BaseVoluumManager).

🔑 Redis Key

ClassRedis Key
LandersVoluumManagervoluum_landers_map
OffersVoluumManagervoluum_offers_map

🔄 Update Logic

  • Uses url field for mapping
  • Removes read-only fields before update
  • Updates all landers/offers with matching URLs

4. VoluumController

Orchestrates operations across managers.

📑 Class Attributes

managers = [LandersVoluumManager, OffersVoluumManager]

🧩 Methods

MethodDescription
load_data()Loads landers and offers data into Redis.
update_url(old_url, new_url)Updates all landers and offers with the old URL to the new URL.

🔄 Workflow Details

Data Loading (load_data())
  1. Iterates through settings.VOLUUM_CREDENTIALS
  2. For each credential:
    • Fetches landers/offers from Voluum.
    • Builds mapping dictionary stored in Redis:
{
    "credential_index": {
        "https://url1.com/123": ["id1", "id2"],
        "https://url2.com/123": ["id3"]
    }
}
  1. Saves maps to Redis under voluum_landers_map and voluum_offers_map.
  1. Searches all Redis maps for old_url.
  2. For each found URL occurrence:
    • Retrieves associated credential indices and object IDs.
    • Uses original credentials to authenticate.
    • Updates all matching objects in Voluum.
  3. Returns True if any manager succeeds (even if some updates fail).