NAME
GDPR::IAB::TCFv2::Publisher - Transparency & Consent String version 2 publisher
Combines the creation of GDPR::IAB::TCFv2::PublisherRestrictions and GDPR::IAB::TCFv2::PublisherTC based on the data available.
SYNOPSIS
my $publisher = GDPR::IAB::TCFv2::Publisher->Parse(
core_data => $core_data,
core_data_size => $core_data_size,
publisher_tc_data => $publisher_tc_data, # optional
options => { json => ... },
);
say "there is publisher restriction on purpose id 1, type 0 on vendor 284"
if $publisher->check_restriction(1, 0, 284);
CONSTRUCTOR
Constructor Parse
receives an hash of 4 parameters:
Key
core_data
is the binary core dataKey
core_data_size
is the original binary core data sizeKey
publisher_tc_data
is the binary publisher data. Optional.Key
options
is the GDPR::IAB::TCFv2 options (includes thejson
field 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 = 284;
$ok = $range->check_restriction($purpose_id, $restriction_type, $vendor);
publisher_tc
If the consent string has a Publisher TC
section, we will decode this section as an instance of GDPR::IAB::TCFv2::PublisherTC.
Will return undefined if there is no Publisher TC
section.
TO_JSON
Returns a hashref with the following format:
{
consents => ...,
legitimate_interests => ...,
custom_purposes => {
consents => ...,
legitimate_interests => ...,
},
restrictions => {
'[purpose id]' => {
# 0 - Not Allowed
# 1 - Require Consent
# 2 - Require Legitimate Interest
'[vendor id]' => 1,
},
}
}
Example, by parsing the consent COwAdDhOwAdDhN4ABAENAPCgAAQAAv___wAAAFP_AAp_4AI6ACACAA.argAC0gAAAAAAAAAAAA
we can generate this compact hashref.
{
"consents" : [
2,
4,
6,
8,
9,
10
],
"legitimate_interests" : [
2,
4,
5,
7,
10
],
"custom_purpose" : {
"consents" : [],
"legitimate_interests" : []
},
"restrictions" : {
"7" : {
"32" : 1
}
}
}
However by parsing the consent COwAdDhOwAdDhN4ABAENAPCgAAQAAv___wAAAFP_AAp_4AI6ACACAA
without the Publisher TC
section will omit all fields except restrictions
:
{
"restrictions" : {
"7" : {
"32" : 1
}
}
}