🔍 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
Parameter Type Description api_key_idstr Voluum API key ID api_keystr Voluum API secret key
🧩 Methods
Method Description _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
Attribute Description redis_keyRedis storage key (must be overridden ).
🧩 Methods
Method Description 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
Class Redis Key LandersVoluumManagervoluum_landers_mapOffersVoluumManagervoluum_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
Method Description 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())
Iterates through settings.VOLUUM_CREDENTIALS
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" ]
}
}
Saves maps to Redis under voluum_landers_map and voluum_offers_map.
Link Update (update_url(old_url, new_url))
Searches all Redis maps for old_url.
For each found URL occurrence:
Retrieves associated credential indices and object IDs.
Uses original credentials to authenticate.
Updates all matching objects in Voluum.
Returns True if any manager succeeds (even if some updates fail).