Skip to content

Commit 6d1f96d

Browse files
author
Ross Crawford-d'Heureuse
committed
Added booking_id so that the class does not die when v2 provides booking_id… also added accessor that will return campaign_id if present but if not then will use booking_id so that we are forwards and backwards compatible
1 parent 02e05e8 commit 6d1f96d

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

lib/adcloud/report_entry.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class ReportEntry
99
attribute :product_id, Integer
1010
attribute :ad_id, Integer
1111
attribute :campaign_id, Integer
12+
attribute :booking_id, Integer
1213
attribute :page_type, Integer
1314
attribute :ad_position, Integer
1415
attribute :ad_count, Integer
@@ -44,5 +45,16 @@ class ReportEntry
4445
attribute :language, String
4546
attribute :country, String
4647
attribute :currency, String
48+
49+
def campaign_id
50+
"""
51+
in the case of using v2 reporting system which is being depreciated
52+
it is necessary to convert booking_id to the new campaign_id value
53+
this method is here to ensure all services get the correct value
54+
"""
55+
@campaign_id || @booking_id
56+
end
4757
end
58+
59+
4860
end

0 commit comments

Comments
 (0)