NAME

GDPR::IAB::TCFv2::PublisherRestrictions - Transparency & Consent String version 2 publisher restriction

SYNOPSIS

my $range = GDPR::IAB::TCFv2::PublisherRestrictions->new(
    restrictions => {
        purpose id => {
            restriction type => instance of GDPR::IAB::TCFv2::RangeSection
        },
    },
);

die "there is publisher restriction on purpose id 1, type 0 on vendor 284"
    if $range->contains(1, 0, 284);

CONSTRUCTOR

Receive 1 parameters: restrictions. Hashref.

Will die if it is undefined.

METHODS

contains

Return true for a given combination of purpose id, restriction type and vendor

my $purpose_id = 1;
my $restriction_type = 0;
my $vendor = 284;
$ok = $range->contains($purpose_id, $restriction_type, $vendor);

TO_JSON

Returns a hashref with the following format:

{
    '[purpose id]' => {
        # 0 - Not Allowed
        # 1 - Require Consent
        # 2 - Require Legitimate Interest
        '[vendor id]' => 1,
    },
}

Example, by parsing the consent COwAdDhOwAdDhN4ABAENAPCgAAQAAv___wAAAFP_AAp_4AI6ACACAA we can generate this hashref.

{
    "7" => {
        "32" => 1
    }
}