adzerk_decision_sdk 1.0.0.pre.beta.5 → 1.0.0.pre.beta.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +5 -7
  3. data/README.md +58 -4
  4. data/adzerk_decision_sdk.gemspec +3 -4
  5. data/docs/ConsentRequest.md +10 -9
  6. data/docs/Content.md +16 -15
  7. data/docs/Decision.md +28 -27
  8. data/docs/DecisionApi.md +30 -13
  9. data/docs/DecisionRequest.md +44 -41
  10. data/docs/DecisionResponse.md +12 -11
  11. data/docs/Event.md +10 -9
  12. data/docs/MatchedPoint.md +10 -9
  13. data/docs/Placement.md +50 -41
  14. data/docs/PricingData.md +16 -15
  15. data/docs/User.md +8 -7
  16. data/docs/UserdbApi.md +259 -98
  17. data/lib/adzerk_decision_sdk/api/decision_api.rb +5 -4
  18. data/lib/adzerk_decision_sdk/api/userdb_api.rb +37 -28
  19. data/lib/adzerk_decision_sdk/api_client.rb +50 -48
  20. data/lib/adzerk_decision_sdk/api_error.rb +1 -1
  21. data/lib/adzerk_decision_sdk/client.rb +2 -1
  22. data/lib/adzerk_decision_sdk/configuration.rb +39 -10
  23. data/lib/adzerk_decision_sdk/decision_client.rb +16 -6
  24. data/lib/adzerk_decision_sdk/models/consent_request.rb +19 -7
  25. data/lib/adzerk_decision_sdk/models/content.rb +19 -7
  26. data/lib/adzerk_decision_sdk/models/decision.rb +19 -7
  27. data/lib/adzerk_decision_sdk/models/decision_request.rb +32 -10
  28. data/lib/adzerk_decision_sdk/models/decision_response.rb +19 -7
  29. data/lib/adzerk_decision_sdk/models/event.rb +19 -7
  30. data/lib/adzerk_decision_sdk/models/matched_point.rb +19 -7
  31. data/lib/adzerk_decision_sdk/models/placement.rb +67 -12
  32. data/lib/adzerk_decision_sdk/models/pricing_data.rb +19 -7
  33. data/lib/adzerk_decision_sdk/models/user.rb +19 -7
  34. data/lib/adzerk_decision_sdk/user_db_client.rb +2 -2
  35. data/lib/adzerk_decision_sdk/version.rb +1 -1
  36. data/spec/spec_helper.rb +91 -0
  37. metadata +11 -30
  38. data/pkg/adzerk_decision_sdk-1.0.0.pre.beta.3.gem +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4154c223439a9d6cfedb9305e6b3e91b0b9a6330b90d5c33550dcb6cde8b8c8a
4
- data.tar.gz: 5547ecb242a0315d73c801f74cf092eac70d061e1b1e6ff5fd8271a5ba633fd9
3
+ metadata.gz: 7bd3e6c1e7915ed0d64549a440bf3b0b83cdb8d8d77145c52bc9601be798e980
4
+ data.tar.gz: 1074e2dee4c3ed743df25fa5cdfd7b9d7d13d30920bccb6c6c4cebb152ac64ae
5
5
  SHA512:
6
- metadata.gz: 78e46ff3095a383b3f1d33df22bce69ab27243250d21e6a8ec28e655e814655a663342024a701009e2b09128e8ee25b2561e67e4d2b32b2cef2598fe91d4d3f1
7
- data.tar.gz: d13e458a93075865334562e4efc4f671b621ca451c8baa510cd2e5e0278346f4977f6cf4e1dea7ca32b3847988a4507b967f38c94ac1da192f76dcfe2494b164
6
+ metadata.gz: 98813d4465b2c903f69574b2e05d7e88985ec81eb4a8b91fce3b7cb7e93d60d009c25acb796f49a363ddc4ede1fa0bb9f1a9748b1729ed83728f14cf6e1d98be
7
+ data.tar.gz: 6152df7fc606fb5a0a715433aa10fb8ea4dbe02d2b2d0086741785d9d96c49c321a949da714ff5384eb1e2440eae43926c22d7a4d86119988c3e0961e2565377
data/Gemfile.lock CHANGED
@@ -1,8 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- adzerk_decision_sdk (1.0.0.pre.beta.3)
5
- json (~> 2.1, >= 2.1.0)
4
+ adzerk_decision_sdk (1.0.0.pre.beta.9)
6
5
  typhoeus (~> 1.0, >= 1.0.1)
7
6
 
8
7
  GEM
@@ -12,11 +11,10 @@ GEM
12
11
  byebug (11.1.1)
13
12
  coderay (1.1.2)
14
13
  diff-lcs (1.3)
15
- ethon (0.12.0)
16
- ffi (>= 1.3.0)
17
- ffi (1.13.1)
14
+ ethon (0.14.0)
15
+ ffi (>= 1.15.0)
16
+ ffi (1.15.3)
18
17
  jaro_winkler (1.5.4)
19
- json (2.3.1)
20
18
  method_source (0.9.2)
21
19
  parallel (1.19.1)
22
20
  parser (2.7.0.2)
@@ -67,4 +65,4 @@ DEPENDENCIES
67
65
  rubocop (~> 0.66.0)
68
66
 
69
67
  BUNDLED WITH
70
- 2.1.2
68
+ 2.2.25
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,13 +92,67 @@ 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: "YOUR_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
- <!-- ### Logging Example
99
+ ### Decision Explainer
100
100
 
101
- TBD: ....... -->
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
+
139
+ ### Logging
140
+
141
+ Our logging implementation is meant to be flexible enough to fit into any common Ruby logging framework.
142
+
143
+ You can use the [logger](https://ruby-doc.org/stdlib-2.4.0/libdoc/logger/rdoc/Logger.html) utility to output messages.
144
+
145
+ The messages have associated levels: unknown, fatal, error, warn, info, and debug.
146
+
147
+ The easiest way to integrate is to write a function that handles translating the data from the Adzerk SDK Logger into whatever logging framework you're using in the rest of your application:
148
+
149
+ ```ruby
150
+ require "adzerk_decision_sdk"
151
+
152
+ logger.level("Message")
153
+
154
+ client = AdzerkDecisionSdk::Client.new(logger)
155
+ ```
102
156
 
103
157
  ## Documentation
104
158
 
@@ -8,7 +8,7 @@
8
8
  The version of the OpenAPI document: 1.0
9
9
 
10
10
  Generated by: https://openapi-generator.tech
11
- OpenAPI Generator version: 4.3.1
11
+ OpenAPI Generator version: 5.1.0
12
12
 
13
13
  =end
14
14
 
@@ -24,11 +24,10 @@ Gem::Specification.new do |s|
24
24
  s.homepage = "http://adzerk.com"
25
25
  s.summary = "Adzerk Decision API"
26
26
  s.description = "Ruby library for the Adzerk Decision API"
27
- s.license = 'Apache-2.0'
28
- s.required_ruby_version = ">= 1.9"
27
+ s.license = "Apache-2.0"
28
+ s.required_ruby_version = ">= 2.4"
29
29
 
30
30
  s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
31
- s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0'
32
31
 
33
32
  s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
34
33
 
@@ -2,18 +2,19 @@
2
2
 
3
3
  ## Properties
4
4
 
5
- Name | Type | Description | Notes
6
- ------------ | ------------- | ------------- | -------------
7
- **user_key** | **String** | | [optional]
8
- **consent** | [**Object**](.md) | | [optional]
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **user_key** | **String** | | [optional] |
8
+ | **consent** | **Object** | | [optional] |
9
9
 
10
- ## Code Sample
10
+ ## Example
11
11
 
12
12
  ```ruby
13
- require 'AdzerkDecisionSdk'
13
+ require 'adzerk_decision_sdk'
14
14
 
15
- instance = AdzerkDecisionSdk::ConsentRequest.new(user_key: null,
16
- consent: null)
15
+ instance = AdzerkDecisionSdk::ConsentRequest.new(
16
+ user_key: null,
17
+ consent: null
18
+ )
17
19
  ```
18
20
 
19
-
data/docs/Content.md CHANGED
@@ -2,24 +2,25 @@
2
2
 
3
3
  ## Properties
4
4
 
5
- Name | Type | Description | Notes
6
- ------------ | ------------- | ------------- | -------------
7
- **type** | **String** | | [optional]
8
- **template** | **String** | | [optional]
9
- **custom_template** | **String** | | [optional]
10
- **data** | [**Object**](.md) | | [optional]
11
- **body** | **String** | | [optional]
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **type** | **String** | | [optional] |
8
+ | **template** | **String** | | [optional] |
9
+ | **custom_template** | **String** | | [optional] |
10
+ | **data** | **Object** | | [optional] |
11
+ | **body** | **String** | | [optional] |
12
12
 
13
- ## Code Sample
13
+ ## Example
14
14
 
15
15
  ```ruby
16
- require 'AdzerkDecisionSdk'
16
+ require 'adzerk_decision_sdk'
17
17
 
18
- instance = AdzerkDecisionSdk::Content.new(type: null,
19
- template: null,
20
- custom_template: null,
21
- data: null,
22
- body: null)
18
+ instance = AdzerkDecisionSdk::Content.new(
19
+ type: null,
20
+ template: null,
21
+ custom_template: null,
22
+ data: null,
23
+ body: null
24
+ )
23
25
  ```
24
26
 
25
-
data/docs/Decision.md CHANGED
@@ -2,36 +2,37 @@
2
2
 
3
3
  ## Properties
4
4
 
5
- Name | Type | Description | Notes
6
- ------------ | ------------- | ------------- | -------------
7
- **ad_id** | **Integer** | | [optional]
8
- **creative_id** | **Integer** | | [optional]
9
- **flight_id** | **Integer** | | [optional]
10
- **campaign_id** | **Integer** | | [optional]
11
- **priority_id** | **Integer** | | [optional]
12
- **click_url** | **String** | | [optional]
13
- **contents** | [**Array&lt;Content&gt;**](Content.md) | | [optional]
14
- **impression_url** | **String** | | [optional]
15
- **events** | [**Array&lt;Event&gt;**](Event.md) | | [optional]
16
- **matched_points** | [**Array&lt;MatchedPoint&gt;**](MatchedPoint.md) | | [optional]
17
- **pricing** | [**PricingData**](PricingData.md) | | [optional]
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **ad_id** | **Integer** | | [optional] |
8
+ | **creative_id** | **Integer** | | [optional] |
9
+ | **flight_id** | **Integer** | | [optional] |
10
+ | **campaign_id** | **Integer** | | [optional] |
11
+ | **priority_id** | **Integer** | | [optional] |
12
+ | **click_url** | **String** | | [optional] |
13
+ | **contents** | [**Array&lt;Content&gt;**](Content.md) | | [optional] |
14
+ | **impression_url** | **String** | | [optional] |
15
+ | **events** | [**Array&lt;Event&gt;**](Event.md) | | [optional] |
16
+ | **matched_points** | [**Array&lt;MatchedPoint&gt;**](MatchedPoint.md) | | [optional] |
17
+ | **pricing** | [**PricingData**](PricingData.md) | | [optional] |
18
18
 
19
- ## Code Sample
19
+ ## Example
20
20
 
21
21
  ```ruby
22
- require 'AdzerkDecisionSdk'
22
+ require 'adzerk_decision_sdk'
23
23
 
24
- instance = AdzerkDecisionSdk::Decision.new(ad_id: null,
25
- creative_id: null,
26
- flight_id: null,
27
- campaign_id: null,
28
- priority_id: null,
29
- click_url: null,
30
- contents: null,
31
- impression_url: null,
32
- events: null,
33
- matched_points: null,
34
- pricing: null)
24
+ instance = AdzerkDecisionSdk::Decision.new(
25
+ ad_id: null,
26
+ creative_id: null,
27
+ flight_id: null,
28
+ campaign_id: null,
29
+ priority_id: null,
30
+ click_url: null,
31
+ contents: null,
32
+ impression_url: null,
33
+ events: null,
34
+ matched_points: null,
35
+ pricing: null
36
+ )
35
37
  ```
36
38
 
37
-
data/docs/DecisionApi.md CHANGED
@@ -2,45 +2,62 @@
2
2
 
3
3
  All URIs are relative to *https://e-23.adzerk.net*
4
4
 
5
- Method | HTTP request | Description
6
- ------------- | ------------- | -------------
7
- [**get_decisions**](DecisionApi.md#get_decisions) | **POST** /api/v2 |
8
-
5
+ | Method | HTTP request | Description |
6
+ | ------ | ------------ | ----------- |
7
+ | [**get_decisions**](DecisionApi.md#get_decisions) | **POST** /api/v2 | |
9
8
 
10
9
 
11
10
  ## get_decisions
12
11
 
13
- > DecisionResponse get_decisions(opts)
12
+ > <DecisionResponse> get_decisions(opts)
14
13
 
15
14
 
16
15
 
17
16
  Request Decision(s)
18
17
 
19
- ### Example
18
+ ### Examples
20
19
 
21
20
  ```ruby
22
- # load the gem
21
+ require 'time'
23
22
  require 'adzerk_decision_sdk'
24
23
 
25
24
  api_instance = AdzerkDecisionSdk::DecisionApi.new
26
25
  opts = {
27
- decision_request: {"placements": [{ "divName": "header", "networkId": 23, "siteId": 667480, "adTypes": [5] }] } # DecisionRequest |
26
+ decision_request: AdzerkDecisionSdk::DecisionRequest.new({placements: [AdzerkDecisionSdk::Placement.new]}) # DecisionRequest |
28
27
  }
29
28
 
30
29
  begin
30
+
31
31
  result = api_instance.get_decisions(opts)
32
32
  p result
33
33
  rescue AdzerkDecisionSdk::ApiError => e
34
- puts "Exception when calling DecisionApi->get_decisions: #{e}"
34
+ puts "Error when calling DecisionApi->get_decisions: #{e}"
35
35
  end
36
36
  ```
37
37
 
38
- ### Parameters
38
+ #### Using the get_decisions_with_http_info variant
39
+
40
+ This returns an Array which contains the response data, status code and headers.
39
41
 
42
+ > <Array(<DecisionResponse>, Integer, Hash)> get_decisions_with_http_info(opts)
43
+
44
+ ```ruby
45
+ begin
46
+
47
+ data, status_code, headers = api_instance.get_decisions_with_http_info(opts)
48
+ p status_code # => 2xx
49
+ p headers # => { ... }
50
+ p data # => <DecisionResponse>
51
+ rescue AdzerkDecisionSdk::ApiError => e
52
+ puts "Error when calling DecisionApi->get_decisions_with_http_info: #{e}"
53
+ end
54
+ ```
55
+
56
+ ### Parameters
40
57
 
41
- Name | Type | Description | Notes
42
- ------------- | ------------- | ------------- | -------------
43
- **decision_request** | [**DecisionRequest**](DecisionRequest.md)| | [optional]
58
+ | Name | Type | Description | Notes |
59
+ | ---- | ---- | ----------- | ----- |
60
+ | **decision_request** | [**DecisionRequest**](DecisionRequest.md) | | [optional] |
44
61
 
45
62
  ### Return type
46
63
 
@@ -2,50 +2,53 @@
2
2
 
3
3
  ## Properties
4
4
 
5
- Name | Type | Description | Notes
6
- ------------ | ------------- | ------------- | -------------
7
- **placements** | [**Array&lt;Placement&gt;**](Placement.md) | One or more Placement objects |
8
- **user** | [**User**](User.md) | | [optional]
9
- **keywords** | **Array&lt;String&gt;** | Keywords for keyword Targeting. Such as &#x60;\&quot;keywords\&quot;: [\&quot;foo\&quot;, \&quot;bar\&quot;, \&quot;baz\&quot;]&#x60;. | [optional]
10
- **url** | **String** | The current page URL | [optional]
11
- **referrer** | **String** | The referrer URL | [optional]
12
- **ip** | **String** | The IP address. Required for [Geo-Targeting](https://dev.adzerk.com/docs/geo-location) | [optional]
13
- **blocked_creatives** | **Array&lt;Integer&gt;** | Numeric creative ids to disregard for ad selection | [optional]
14
- **is_mobile** | **Boolean** | If true, only ads containing a single image will be returned | [optional]
15
- **include_pricing_data** | **Boolean** | If true, return pricing data for the decision in the response | [optional]
16
- **notrack** | **Boolean** | If true, only return ads that are set to honor Do Not Track | [optional]
17
- **enable_bot_filtering** | **Boolean** | If making a client-side request, set to true. Defaults to false to ensure a server isn&#39;t seen as a bot. See [here](https://dev.adzerk.com/docs/tracking-overview#section-bot-filtering) for more info | [optional]
18
- **enable_user_dbip** | **Boolean** | If true, override the IP address of the request with the IP address supplied on the UserKey. If no IP address is found on the UserKey, this will fall back to the IP address on the request. Requires UserDB | [optional]
19
- **consent** | [**Object**](.md) | Object that sets the data consent preferences. Other consent settings are available in the GDPR settings documentation. | [optional]
20
- **device_id** | **String** | RTB requests only - sets an Identifier for Advertisers (IFA or IDFA) | [optional]
21
- **parallel** | **Boolean** | | [optional]
22
- **intended_latitude** | **String** | | [optional]
23
- **intended_longitude** | **String** | | [optional]
24
- **include_matched_points** | **Boolean** | | [optional]
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **placements** | [**Array&lt;Placement&gt;**](Placement.md) | One or more Placement objects | |
8
+ | **user** | [**User**](User.md) | | [optional] |
9
+ | **keywords** | **Array&lt;String&gt;** | Keywords for keyword Targeting. Such as &#x60;\&quot;keywords\&quot;: [\&quot;foo\&quot;, \&quot;bar\&quot;, \&quot;baz\&quot;]&#x60;. | [optional] |
10
+ | **url** | **String** | The current page URL | [optional] |
11
+ | **referrer** | **String** | The referrer URL | [optional] |
12
+ | **ip** | **String** | The IP address. Required for [Geo-Targeting](https://dev.adzerk.com/docs/geo-location) | [optional] |
13
+ | **blocked_creatives** | **Array&lt;Integer&gt;** | Numeric creative ids to disregard for ad selection | [optional] |
14
+ | **is_mobile** | **Boolean** | If true, only ads containing a single image will be returned | [optional] |
15
+ | **include_pricing_data** | **Boolean** | If true, return pricing data for the decision in the response | [optional] |
16
+ | **notrack** | **Boolean** | If true, only return ads that are set to honor Do Not Track | [optional] |
17
+ | **enable_bot_filtering** | **Boolean** | If making a client-side request, set to true. Defaults to false to ensure a server isn&#39;t seen as a bot. See [here](https://dev.adzerk.com/docs/tracking-overview#section-bot-filtering) for more info | [optional] |
18
+ | **enable_user_dbip** | **Boolean** | If true, override the IP address of the request with the IP address supplied on the UserKey. If no IP address is found on the UserKey, this will fall back to the IP address on the request. Requires UserDB | [optional] |
19
+ | **consent** | **Object** | Object that sets the data consent preferences. Other consent settings are available in the GDPR settings documentation. | [optional] |
20
+ | **device_id** | **String** | RTB requests only - sets an Identifier for Advertisers (IFA or IDFA) | [optional] |
21
+ | **parallel** | **Boolean** | | [optional] |
22
+ | **intended_latitude** | **Float** | | [optional] |
23
+ | **intended_longitude** | **Float** | | [optional] |
24
+ | **radius** | **Float** | | [optional] |
25
+ | **include_matched_points** | **Boolean** | | [optional] |
25
26
 
26
- ## Code Sample
27
+ ## Example
27
28
 
28
29
  ```ruby
29
- require 'AdzerkDecisionSdk'
30
+ require 'adzerk_decision_sdk'
30
31
 
31
- instance = AdzerkDecisionSdk::DecisionRequest.new(placements: null,
32
- user: null,
33
- keywords: null,
34
- url: null,
35
- referrer: null,
36
- ip: null,
37
- blocked_creatives: null,
38
- is_mobile: null,
39
- include_pricing_data: null,
40
- notrack: null,
41
- enable_bot_filtering: null,
42
- enable_user_dbip: null,
43
- consent: null,
44
- device_id: null,
45
- parallel: null,
46
- intended_latitude: null,
47
- intended_longitude: null,
48
- include_matched_points: null)
32
+ instance = AdzerkDecisionSdk::DecisionRequest.new(
33
+ placements: null,
34
+ user: null,
35
+ keywords: null,
36
+ url: null,
37
+ referrer: null,
38
+ ip: null,
39
+ blocked_creatives: null,
40
+ is_mobile: null,
41
+ include_pricing_data: null,
42
+ notrack: null,
43
+ enable_bot_filtering: null,
44
+ enable_user_dbip: null,
45
+ consent: null,
46
+ device_id: null,
47
+ parallel: null,
48
+ intended_latitude: null,
49
+ intended_longitude: null,
50
+ radius: null,
51
+ include_matched_points: null
52
+ )
49
53
  ```
50
54
 
51
-