NAME
GDPR::IAB::TCFv2::PublisherRestrictions - TCF v2.3 publisher restrictions parser
SYNOPSIS
use GDPR::IAB::TCFv2::PublisherRestrictions;
my $data = '...'; # raw binary data
my $publisher_restrictions = GDPR::IAB::TCFv2::PublisherRestrictions->Parse(
data => $data,
data_size => length($data),
offset => 213,
options => { json => {} },
);
if ($publisher_restrictions->check_restriction(1, 0, 284)) {
# ...
}
CONSTRUCTOR
Constructor Parse receives a hash of 4 parameters:
Key
datais the binary core dataKey
data_sizeis the core data size in bitsKey
offsetis the bit offsetKey
optionsis the GDPR::IAB::TCFv2 options (includes thejsonfield to modify the "TO_JSON" method output.
METHODS
check_restriction
Return true for a given combination of purpose id, restriction type and vendor
my $purpose_id = 1;
my $restriction_type = 0;
my $vendor_id = 284;
my $ok = $object->check_restriction($purpose_id, $restriction_type, $vendor_id);
restrictions
Return a hashref of purpose => { restriction type => bool } for a given vendor id.
Example, by parsing the consent COwAdDhOwAdDhN4ABAENAPCgAAQAAv___wAAAFP_AAp_4AI6ACACAA we can generate this.
my $restrictions = $object->restrictions(32);
# returns { 7 => { 1 => 1 } }
TO_JSON
Returns a hashref keyed by purpose id; each inner hashref maps vendor id to the integer restriction_type that vendor was given for that purpose:
{
'[purpose id]' => {
# value is the restriction type:
# 0 - Not Allowed
# 1 - Require Consent
# 2 - Require Legitimate Interest
'[vendor id]' => '[restriction type]',
},
}
Example, by parsing the consent COwAdDhOwAdDhN4ABAENAPCgAAQAAv___wAAAFP_AAp_4AI6ACACAA we can generate this hashref (vendor 32 has restriction type 1 -- Require Consent -- for purpose 7):
{
"7" => {
"32" => 1
}
}