adzerk_decision_sdk 1.0.0.pre.beta.7 → 1.0.0.pre.beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -4
- data/README.md +42 -2
- data/adzerk_decision_sdk.gemspec +1 -1
- data/docs/Decision.md +2 -0
- data/docs/Placement.md +5 -1
- data/lib/adzerk_decision_sdk/api/decision_api.rb +1 -1
- data/lib/adzerk_decision_sdk/api/userdb_api.rb +1 -1
- data/lib/adzerk_decision_sdk/api_client.rb +1 -1
- data/lib/adzerk_decision_sdk/api_error.rb +1 -1
- data/lib/adzerk_decision_sdk/client.rb +2 -1
- data/lib/adzerk_decision_sdk/configuration.rb +1 -1
- data/lib/adzerk_decision_sdk/decision_client.rb +22 -6
- data/lib/adzerk_decision_sdk/models/consent_request.rb +1 -1
- data/lib/adzerk_decision_sdk/models/content.rb +1 -1
- data/lib/adzerk_decision_sdk/models/decision.rb +11 -2
- data/lib/adzerk_decision_sdk/models/decision_request.rb +1 -1
- data/lib/adzerk_decision_sdk/models/decision_response.rb +1 -1
- data/lib/adzerk_decision_sdk/models/event.rb +1 -1
- data/lib/adzerk_decision_sdk/models/matched_point.rb +1 -1
- data/lib/adzerk_decision_sdk/models/placement.rb +26 -6
- data/lib/adzerk_decision_sdk/models/pricing_data.rb +1 -1
- data/lib/adzerk_decision_sdk/models/user.rb +1 -1
- data/lib/adzerk_decision_sdk/pixel_client.rb +2 -1
- data/lib/adzerk_decision_sdk/user_db_client.rb +2 -2
- data/lib/adzerk_decision_sdk/version.rb +1 -1
- data/openapitools.json +7 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd5561f16ac87cdf9ea7619126432851c4b9c0413ea34ce1cf30cf6e2a9f56ea
|
4
|
+
data.tar.gz: 4d61a0b491a1f5f966963ec2dddcdab46ac2ab528bcc79eeee3af2589cd66610
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5f8f13c91ee22ec0a8401e54cb5ac5005d5ea845f51b464b8b207454adfec0265bd90310711ced69512640676939de3855eef14028392438ce3c66d7e1e6386
|
7
|
+
data.tar.gz: bf992d722db2042adbe5a4740929c0286562aafcda5cf97bd69bd1f15549c0dc3e7806de00479b213bad0193b53fa000b7b2944277266ec8a57723948b085e8b
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
adzerk_decision_sdk (1.0.0.pre.beta.
|
4
|
+
adzerk_decision_sdk (1.0.0.pre.beta.11)
|
5
5
|
typhoeus (~> 1.0, >= 1.0.1)
|
6
6
|
|
7
7
|
GEM
|
@@ -11,9 +11,9 @@ GEM
|
|
11
11
|
byebug (11.1.1)
|
12
12
|
coderay (1.1.2)
|
13
13
|
diff-lcs (1.3)
|
14
|
-
ethon (0.
|
14
|
+
ethon (0.15.0)
|
15
15
|
ffi (>= 1.15.0)
|
16
|
-
ffi (1.15.
|
16
|
+
ffi (1.15.4)
|
17
17
|
jaro_winkler (1.5.4)
|
18
18
|
method_source (0.9.2)
|
19
19
|
parallel (1.19.1)
|
@@ -65,4 +65,4 @@ DEPENDENCIES
|
|
65
65
|
rubocop (~> 0.66.0)
|
66
66
|
|
67
67
|
BUNDLED WITH
|
68
|
-
2.2.
|
68
|
+
2.2.33
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ Requires [Ruby 2.5](https://en.wikipedia.org/wiki/Ruby_(programming_language)#Ta
|
|
9
9
|
[RubyGem Package](https://rubygems.org/gems/adzerk_decision_sdk)
|
10
10
|
|
11
11
|
```shell
|
12
|
-
gem install adzerk_decision_sdk
|
12
|
+
gem install adzerk_decision_sdk --pre
|
13
13
|
```
|
14
14
|
|
15
15
|
Or add to your `Gemfile`:
|
@@ -92,10 +92,50 @@ client.user_db.set_custom_properties("abc", props)
|
|
92
92
|
require "adzerk_decision_sdk"
|
93
93
|
|
94
94
|
# Demo network ID and API key; find your own via the Adzerk UI!
|
95
|
-
client = AdzerkDecisionSdk::Client.new(network_id: 23, api_key: "
|
95
|
+
client = AdzerkDecisionSdk::Client.new(network_id: 23, api_key: ENV["ADZERK_API_KEY"])
|
96
96
|
client.user_db.forget("abc")
|
97
97
|
```
|
98
98
|
|
99
|
+
### Decision Explainer
|
100
|
+
|
101
|
+
The Decision Explainer returns information on a Decision API request explaining why each candidate ad was or was not chosen.
|
102
|
+
|
103
|
+
```ruby
|
104
|
+
require "adzerk_decision_sdk"
|
105
|
+
|
106
|
+
# Demo network, site, and ad type IDs; find your own via the Adzerk UI!
|
107
|
+
client = AdzerkDecisionSdk::Client.new(network_id: 23, site_id: 667480)
|
108
|
+
|
109
|
+
request = {
|
110
|
+
placements: [{ adTypes: [5] }],
|
111
|
+
user: { key: "abc" },
|
112
|
+
keywords: ["keyword1", "keyword2"],
|
113
|
+
}
|
114
|
+
|
115
|
+
options = {
|
116
|
+
include_explanation: true,
|
117
|
+
api_key: ENV["ADZERK_API_KEY"]
|
118
|
+
}
|
119
|
+
|
120
|
+
pp client.decisions.get(request, options)
|
121
|
+
```
|
122
|
+
|
123
|
+
The response returns a decision object with placement, buckets, rtb logs, and result information.
|
124
|
+
``` json
|
125
|
+
{
|
126
|
+
"div0": {
|
127
|
+
"placement": {},
|
128
|
+
"buckets": [],
|
129
|
+
"rtb_log": [],
|
130
|
+
"results": []
|
131
|
+
}
|
132
|
+
}
|
133
|
+
```
|
134
|
+
The "placement" object represents a decision in which an ad may be served. A Explainer Request can have multiple placements in the request.
|
135
|
+
The "buckets" array contains channel and priority information.
|
136
|
+
The "rtb_logs" array contains information about Real Time Bidding.
|
137
|
+
The "results" array contains the list of candidate ads that did and did not serve, along with a brief explanation.
|
138
|
+
|
99
139
|
### Logging
|
100
140
|
|
101
141
|
Our logging implementation is meant to be flexible enough to fit into any common Ruby logging framework.
|
data/adzerk_decision_sdk.gemspec
CHANGED
data/docs/Decision.md
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
| Name | Type | Description | Notes |
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
7
7
|
| **ad_id** | **Integer** | | [optional] |
|
8
|
+
| **advertiser_id** | **Integer** | | [optional] |
|
8
9
|
| **creative_id** | **Integer** | | [optional] |
|
9
10
|
| **flight_id** | **Integer** | | [optional] |
|
10
11
|
| **campaign_id** | **Integer** | | [optional] |
|
@@ -23,6 +24,7 @@ require 'adzerk_decision_sdk'
|
|
23
24
|
|
24
25
|
instance = AdzerkDecisionSdk::Decision.new(
|
25
26
|
ad_id: null,
|
27
|
+
advertiser_id: null,
|
26
28
|
creative_id: null,
|
27
29
|
flight_id: null,
|
28
30
|
campaign_id: null,
|
data/docs/Placement.md
CHANGED
@@ -24,6 +24,8 @@
|
|
24
24
|
| **event_multiplier** | **Integer** | | [optional] |
|
25
25
|
| **skip_selection** | **Boolean** | | [optional] |
|
26
26
|
| **ad_query** | **Object** | | [optional] |
|
27
|
+
| **floor_price** | **Float** | | [optional] |
|
28
|
+
| **floor_cpc** | **Float** | | [optional] |
|
27
29
|
|
28
30
|
## Example
|
29
31
|
|
@@ -50,7 +52,9 @@ instance = AdzerkDecisionSdk::Placement.new(
|
|
50
52
|
ecpm_partitions: null,
|
51
53
|
event_multiplier: null,
|
52
54
|
skip_selection: null,
|
53
|
-
ad_query: null
|
55
|
+
ad_query: null,
|
56
|
+
floor_price: null,
|
57
|
+
floor_cpc: null
|
54
58
|
)
|
55
59
|
```
|
56
60
|
|
@@ -25,8 +25,9 @@ module AdzerkDecisionSdk
|
|
25
25
|
configuration = Configuration.new
|
26
26
|
configuration.scheme = protocol
|
27
27
|
configuration.host = host
|
28
|
-
configuration.api_key['
|
28
|
+
configuration.api_key['ApiKeyAuth'] = api_key
|
29
29
|
configuration.debugging = is_debug
|
30
|
+
configuration.server_index = nil
|
30
31
|
|
31
32
|
unless logger.nil?
|
32
33
|
configuration.logger = logger
|
@@ -14,17 +14,17 @@ module AdzerkDecisionSdk
|
|
14
14
|
def get(request, opts = {})
|
15
15
|
opts ||= {}
|
16
16
|
header_params = opts[:header_params] || {}
|
17
|
-
opts[:
|
17
|
+
opts[:debug_body] ||= request.respond_to?('to_hash') ? request.to_hash() : request
|
18
18
|
|
19
|
-
@logger.info("Processing request: #{opts[:
|
19
|
+
@logger.info("Processing request: #{opts[:debug_body]}")
|
20
20
|
|
21
|
-
opts[:
|
21
|
+
opts[:debug_body][:enableBotFiltering] = false if not opts[:debug_body].has_key?(:enableBotFiltering)
|
22
22
|
|
23
|
-
if !opts[:
|
23
|
+
if !opts[:debug_body].has_key?(:placements) or !opts[:debug_body][:placements] or opts[:debug_body][:placements].length() == 0
|
24
24
|
fail ArgumentError, "Each request requires at least one placement"
|
25
25
|
end
|
26
26
|
|
27
|
-
opts[:
|
27
|
+
opts[:debug_body][:placements].each_with_index do |placement, idx|
|
28
28
|
if !placement.has_key?(:adTypes) or !placement[:adTypes] or placement[:adTypes].length() == 0
|
29
29
|
fail ArgumentError, "Each placement needs at least one ad type"
|
30
30
|
end
|
@@ -44,6 +44,22 @@ module AdzerkDecisionSdk
|
|
44
44
|
header_params['User-Agent'] = opts[:user_agent] if opts.has_key?(:user_agent)
|
45
45
|
|
46
46
|
if opts.has_key?(:include_explanation) and opts[:include_explanation] == true
|
47
|
+
if opts[:desired_ads]
|
48
|
+
header_object = {
|
49
|
+
api_key: opts[:api_key],
|
50
|
+
desired_ads: opts[:desired_ads]
|
51
|
+
}
|
52
|
+
header_params['X-Adzerk-Explain'] = header_object.to_json
|
53
|
+
end
|
54
|
+
|
55
|
+
if opts[:desired_ad_map]
|
56
|
+
header_object = {
|
57
|
+
api_key: opts[:api_key],
|
58
|
+
desired_ad_map: opts[:desired_ad_map]
|
59
|
+
}
|
60
|
+
header_params['X-Adzerk-Explain'] = header_object.to_json
|
61
|
+
end
|
62
|
+
|
47
63
|
header_params['X-Adzerk-Explain'] = opts[:api_key]
|
48
64
|
@logger.warn("--------------------------------------------------------------")
|
49
65
|
@logger.warn(" !!! WARNING - WARNING - WARNING !!! ")
|
@@ -56,7 +72,7 @@ module AdzerkDecisionSdk
|
|
56
72
|
|
57
73
|
opts[:header_params] = header_params
|
58
74
|
|
59
|
-
@logger.info("Processed request: #{opts[:
|
75
|
+
@logger.info("Processed request: #{opts[:debug_body]}")
|
60
76
|
@logger.info("Requesting with headers: #{opts[:header_params]}")
|
61
77
|
|
62
78
|
response = @api.get_decisions(opts)
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 5.0
|
9
|
+
OpenAPI Generator version: 5.1.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -17,6 +17,8 @@ module AdzerkDecisionSdk
|
|
17
17
|
class Decision
|
18
18
|
attr_accessor :ad_id
|
19
19
|
|
20
|
+
attr_accessor :advertiser_id
|
21
|
+
|
20
22
|
attr_accessor :creative_id
|
21
23
|
|
22
24
|
attr_accessor :flight_id
|
@@ -41,6 +43,7 @@ module AdzerkDecisionSdk
|
|
41
43
|
def self.attribute_map
|
42
44
|
{
|
43
45
|
:'ad_id' => :'adId',
|
46
|
+
:'advertiser_id' => :'advertiserId',
|
44
47
|
:'creative_id' => :'creativeId',
|
45
48
|
:'flight_id' => :'flightId',
|
46
49
|
:'campaign_id' => :'campaignId',
|
@@ -63,6 +66,7 @@ module AdzerkDecisionSdk
|
|
63
66
|
def self.openapi_types
|
64
67
|
{
|
65
68
|
:'ad_id' => :'Integer',
|
69
|
+
:'advertiser_id' => :'Integer',
|
66
70
|
:'creative_id' => :'Integer',
|
67
71
|
:'flight_id' => :'Integer',
|
68
72
|
:'campaign_id' => :'Integer',
|
@@ -101,6 +105,10 @@ module AdzerkDecisionSdk
|
|
101
105
|
self.ad_id = attributes[:'ad_id']
|
102
106
|
end
|
103
107
|
|
108
|
+
if attributes.key?(:'advertiser_id')
|
109
|
+
self.advertiser_id = attributes[:'advertiser_id']
|
110
|
+
end
|
111
|
+
|
104
112
|
if attributes.key?(:'creative_id')
|
105
113
|
self.creative_id = attributes[:'creative_id']
|
106
114
|
end
|
@@ -167,6 +175,7 @@ module AdzerkDecisionSdk
|
|
167
175
|
return true if self.equal?(o)
|
168
176
|
self.class == o.class &&
|
169
177
|
ad_id == o.ad_id &&
|
178
|
+
advertiser_id == o.advertiser_id &&
|
170
179
|
creative_id == o.creative_id &&
|
171
180
|
flight_id == o.flight_id &&
|
172
181
|
campaign_id == o.campaign_id &&
|
@@ -188,7 +197,7 @@ module AdzerkDecisionSdk
|
|
188
197
|
# Calculates hash code according to all attributes.
|
189
198
|
# @return [Integer] Hash code
|
190
199
|
def hash
|
191
|
-
[ad_id, creative_id, flight_id, campaign_id, priority_id, click_url, contents, impression_url, events, matched_points, pricing].hash
|
200
|
+
[ad_id, advertiser_id, creative_id, flight_id, campaign_id, priority_id, click_url, contents, impression_url, events, matched_points, pricing].hash
|
192
201
|
end
|
193
202
|
|
194
203
|
# Builds the object from hash
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 5.0
|
9
|
+
OpenAPI Generator version: 5.1.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -72,6 +72,10 @@ module AdzerkDecisionSdk
|
|
72
72
|
|
73
73
|
attr_accessor :ad_query
|
74
74
|
|
75
|
+
attr_accessor :floor_price
|
76
|
+
|
77
|
+
attr_accessor :floor_cpc
|
78
|
+
|
75
79
|
# Attribute mapping from ruby-style variable name to JSON key.
|
76
80
|
def self.attribute_map
|
77
81
|
{
|
@@ -94,7 +98,9 @@ module AdzerkDecisionSdk
|
|
94
98
|
:'ecpm_partitions' => :'ecpmPartitions',
|
95
99
|
:'event_multiplier' => :'eventMultiplier',
|
96
100
|
:'skip_selection' => :'skipSelection',
|
97
|
-
:'ad_query' => :'adQuery'
|
101
|
+
:'ad_query' => :'adQuery',
|
102
|
+
:'floor_price' => :'floorPrice',
|
103
|
+
:'floor_cpc' => :'floorCpc'
|
98
104
|
}
|
99
105
|
end
|
100
106
|
|
@@ -125,7 +131,9 @@ module AdzerkDecisionSdk
|
|
125
131
|
:'ecpm_partitions' => :'Array<String>',
|
126
132
|
:'event_multiplier' => :'Integer',
|
127
133
|
:'skip_selection' => :'Boolean',
|
128
|
-
:'ad_query' => :'Object'
|
134
|
+
:'ad_query' => :'Object',
|
135
|
+
:'floor_price' => :'Float',
|
136
|
+
:'floor_cpc' => :'Float'
|
129
137
|
}
|
130
138
|
end
|
131
139
|
|
@@ -147,7 +155,9 @@ module AdzerkDecisionSdk
|
|
147
155
|
:'ecpm_partitions',
|
148
156
|
:'event_multiplier',
|
149
157
|
:'skip_selection',
|
150
|
-
:'ad_query'
|
158
|
+
:'ad_query',
|
159
|
+
:'floor_price',
|
160
|
+
:'floor_cpc'
|
151
161
|
])
|
152
162
|
end
|
153
163
|
|
@@ -255,6 +265,14 @@ module AdzerkDecisionSdk
|
|
255
265
|
if attributes.key?(:'ad_query')
|
256
266
|
self.ad_query = attributes[:'ad_query']
|
257
267
|
end
|
268
|
+
|
269
|
+
if attributes.key?(:'floor_price')
|
270
|
+
self.floor_price = attributes[:'floor_price']
|
271
|
+
end
|
272
|
+
|
273
|
+
if attributes.key?(:'floor_cpc')
|
274
|
+
self.floor_cpc = attributes[:'floor_cpc']
|
275
|
+
end
|
258
276
|
end
|
259
277
|
|
260
278
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -318,7 +336,9 @@ module AdzerkDecisionSdk
|
|
318
336
|
ecpm_partitions == o.ecpm_partitions &&
|
319
337
|
event_multiplier == o.event_multiplier &&
|
320
338
|
skip_selection == o.skip_selection &&
|
321
|
-
ad_query == o.ad_query
|
339
|
+
ad_query == o.ad_query &&
|
340
|
+
floor_price == o.floor_price &&
|
341
|
+
floor_cpc == o.floor_cpc
|
322
342
|
end
|
323
343
|
|
324
344
|
# @see the `==` method
|
@@ -330,7 +350,7 @@ module AdzerkDecisionSdk
|
|
330
350
|
# Calculates hash code according to all attributes.
|
331
351
|
# @return [Integer] Hash code
|
332
352
|
def hash
|
333
|
-
[div_name, network_id, site_id, ad_types, zone_ids, campaign_id, flight_id, ad_id, click_url, properties, event_ids, overrides, content_keys, count, proportionality, ecpm_partition, ecpm_partitions, event_multiplier, skip_selection, ad_query].hash
|
353
|
+
[div_name, network_id, site_id, ad_types, zone_ids, campaign_id, flight_id, ad_id, click_url, properties, event_ids, overrides, content_keys, count, proportionality, ecpm_partition, ecpm_partitions, event_multiplier, skip_selection, ad_query, floor_price, floor_cpc].hash
|
334
354
|
end
|
335
355
|
|
336
356
|
# Builds the object from hash
|
@@ -8,7 +8,7 @@ module AdzerkDecisionSdk
|
|
8
8
|
@logger = logger
|
9
9
|
end
|
10
10
|
|
11
|
-
def fire(url, revenue_override: nil, additional_revenue: nil, event_multiplier: nil)
|
11
|
+
def fire(url, revenue_override: nil, additional_revenue: nil, event_multiplier: nil, gross_merchandise_value: nil)
|
12
12
|
uri = URI(url)
|
13
13
|
@logger.info("Firing Pixel at base url of: #{uri.to_s}")
|
14
14
|
|
@@ -16,6 +16,7 @@ module AdzerkDecisionSdk
|
|
16
16
|
query_params << ["override", revenue_override] if not revenue_override.nil?
|
17
17
|
query_params << ["additional", additional_revenue] if not additional_revenue.nil?
|
18
18
|
query_params << ["eventMultiplier", event_multiplier] if not event_multiplier.nil?
|
19
|
+
query_params << ["gmv", gross_merchandise_value] if not gross_merchandise_value.nil?
|
19
20
|
uri.query = URI.encode_www_form(query_params)
|
20
21
|
new_url = uri.to_s()
|
21
22
|
|
@@ -10,7 +10,7 @@ module AdzerkDecisionSdk
|
|
10
10
|
|
11
11
|
def set_custom_properties(user_key, properties, network_id: nil)
|
12
12
|
@logger.info("Setting custom properties for #{user_key} on #{network_id || @network_id} to: #{properties}")
|
13
|
-
@api.add_custom_properties(network_id || @network_id, user_key, {
|
13
|
+
@api.add_custom_properties(network_id || @network_id, user_key, { debug_body: properties })
|
14
14
|
end
|
15
15
|
|
16
16
|
def add_interest(user_key, interest, network_id: nil)
|
@@ -31,7 +31,7 @@ module AdzerkDecisionSdk
|
|
31
31
|
def gdpr_consent(gdpr_consent, network_id: nil)
|
32
32
|
body = gdpr_consent.respond_to?('to_hash') ? gdpr_consent.to_hash() : gdpr_consent
|
33
33
|
@logger.info("Setting GDPR consent on #{network_id || @network_id} with: #{body}")
|
34
|
-
@api.gdpr_consent(network_id || @network_id, {
|
34
|
+
@api.gdpr_consent(network_id || @network_id, { debug_body: body })
|
35
35
|
end
|
36
36
|
|
37
37
|
def ip_override(user_key, ip, network_id: nil)
|
data/openapitools.json
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adzerk_decision_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.pre.beta.
|
4
|
+
version: 1.0.0.pre.beta.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adzerk, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -105,6 +105,7 @@ files:
|
|
105
105
|
- lib/adzerk_decision_sdk/rate_type.rb
|
106
106
|
- lib/adzerk_decision_sdk/user_db_client.rb
|
107
107
|
- lib/adzerk_decision_sdk/version.rb
|
108
|
+
- openapitools.json
|
108
109
|
- spec/.gitkeep
|
109
110
|
- spec/placeholder_spec.rb
|
110
111
|
- spec/spec_helper.rb
|