adzerk_decision_sdk 1.0.0.pre.beta.7 → 1.0.0.pre.beta.8
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 +3 -3
- data/README.md +42 -2
- data/lib/adzerk_decision_sdk/client.rb +2 -1
- data/lib/adzerk_decision_sdk/decision_client.rb +6 -6
- data/lib/adzerk_decision_sdk/user_db_client.rb +2 -2
- data/lib/adzerk_decision_sdk/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3c1fa1975fc4fcfd55306fd13622738720961b229b85f309fea506f0f1d450f
|
4
|
+
data.tar.gz: 53914caaa486d34f102326193f719d0a29e819f6b3917d0fbf7e0917eee6d4c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fc835f013c0781ed26da9f40e4f95d6d594d8d1cea3528d0d61643b6e8925581526ef3cc1c8670f3992d50f70b2aecf51cb4475779fa078115fe19779974d05
|
7
|
+
data.tar.gz: 1a2523d2a2499da3a4aff92b1dd9492d2587a775b7dfe90ca82be33c08bbb650c32d91731a2003bd2fc70d015931dfb6a7ce3b21f5022183944377cce05ea947
|
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.8)
|
5
5
|
typhoeus (~> 1.0, >= 1.0.1)
|
6
6
|
|
7
7
|
GEM
|
@@ -13,7 +13,7 @@ GEM
|
|
13
13
|
diff-lcs (1.3)
|
14
14
|
ethon (0.14.0)
|
15
15
|
ffi (>= 1.15.0)
|
16
|
-
ffi (1.15.
|
16
|
+
ffi (1.15.3)
|
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.21
|
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.
|
@@ -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
|
@@ -56,7 +56,7 @@ module AdzerkDecisionSdk
|
|
56
56
|
|
57
57
|
opts[:header_params] = header_params
|
58
58
|
|
59
|
-
@logger.info("Processed request: #{opts[:
|
59
|
+
@logger.info("Processed request: #{opts[:debug_body]}")
|
60
60
|
@logger.info("Requesting with headers: #{opts[:header_params]}")
|
61
61
|
|
62
62
|
response = @api.get_decisions(opts)
|
@@ -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)
|
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.8
|
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-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|