adzerk_decision_sdk 1.0.0.pre.beta.1 → 1.0.0.pre.beta.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +6 -6
- data/README.md +28 -2
- data/adzerk_decision_sdk.gemspec +1 -1
- data/docs/Content.md +1 -1
- data/docs/Decision.md +2 -0
- data/docs/DecisionRequest.md +9 -1
- data/docs/MatchedPoint.md +19 -0
- data/docs/Placement.md +9 -1
- data/docs/RequestLocation.md +19 -0
- data/docs/UserdbApi.md +0 -49
- data/lib/adzerk_decision_sdk.rb +1 -1
- data/lib/adzerk_decision_sdk/api/decision_api.rb +1 -1
- data/lib/adzerk_decision_sdk/api/userdb_api.rb +1 -68
- data/lib/adzerk_decision_sdk/api_client.rb +8 -6
- data/lib/adzerk_decision_sdk/api_error.rb +1 -1
- data/lib/adzerk_decision_sdk/client.rb +2 -2
- data/lib/adzerk_decision_sdk/configuration.rb +1 -1
- data/lib/adzerk_decision_sdk/decision_client.rb +21 -10
- data/lib/adzerk_decision_sdk/models/consent_request.rb +1 -1
- data/lib/adzerk_decision_sdk/models/content.rb +2 -2
- data/lib/adzerk_decision_sdk/models/decision.rb +13 -2
- data/lib/adzerk_decision_sdk/models/decision_request.rb +46 -6
- 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/{decision_data.rb → matched_point.rb} +17 -44
- data/lib/adzerk_decision_sdk/models/placement.rb +73 -6
- data/lib/adzerk_decision_sdk/models/pricing_data.rb +1 -1
- data/lib/adzerk_decision_sdk/models/request_location.rb +215 -0
- data/lib/adzerk_decision_sdk/models/user.rb +1 -1
- data/lib/adzerk_decision_sdk/pixel_client.rb +8 -2
- data/lib/adzerk_decision_sdk/user_db_client.rb +16 -2
- data/lib/adzerk_decision_sdk/version.rb +2 -2
- data/pkg/adzerk_decision_sdk-1.0.0.pre.beta.3.gem +0 -0
- metadata +7 -5
- data/docs/DecisionData.md +0 -25
- data/pkg/adzerk_decision_sdk-1.0.0.gem +0 -0
@@ -0,0 +1,215 @@
|
|
1
|
+
=begin
|
2
|
+
#Adzerk Decision API
|
3
|
+
|
4
|
+
#Adzerk Decision API
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module AdzerkDecisionSdk
|
16
|
+
class RequestLocation
|
17
|
+
attr_accessor :latitude
|
18
|
+
|
19
|
+
attr_accessor :longitude
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:'latitude' => :'latitude',
|
25
|
+
:'longitude' => :'longitude'
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
# Attribute type mapping.
|
30
|
+
def self.openapi_types
|
31
|
+
{
|
32
|
+
:'latitude' => :'String',
|
33
|
+
:'longitude' => :'String'
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
# List of attributes with nullable: true
|
38
|
+
def self.openapi_nullable
|
39
|
+
Set.new([
|
40
|
+
])
|
41
|
+
end
|
42
|
+
|
43
|
+
# Initializes the object
|
44
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
45
|
+
def initialize(attributes = {})
|
46
|
+
if (!attributes.is_a?(Hash))
|
47
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AdzerkDecisionSdk::RequestLocation` initialize method"
|
48
|
+
end
|
49
|
+
|
50
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
51
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
52
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
53
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AdzerkDecisionSdk::RequestLocation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
54
|
+
end
|
55
|
+
h[k.to_sym] = v
|
56
|
+
}
|
57
|
+
|
58
|
+
if attributes.key?(:'latitude')
|
59
|
+
self.latitude = attributes[:'latitude']
|
60
|
+
end
|
61
|
+
|
62
|
+
if attributes.key?(:'longitude')
|
63
|
+
self.longitude = attributes[:'longitude']
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
68
|
+
# @return Array for valid properties with the reasons
|
69
|
+
def list_invalid_properties
|
70
|
+
invalid_properties = Array.new
|
71
|
+
invalid_properties
|
72
|
+
end
|
73
|
+
|
74
|
+
# Check to see if the all the properties in the model are valid
|
75
|
+
# @return true if the model is valid
|
76
|
+
def valid?
|
77
|
+
true
|
78
|
+
end
|
79
|
+
|
80
|
+
# Checks equality by comparing each attribute.
|
81
|
+
# @param [Object] Object to be compared
|
82
|
+
def ==(o)
|
83
|
+
return true if self.equal?(o)
|
84
|
+
self.class == o.class &&
|
85
|
+
latitude == o.latitude &&
|
86
|
+
longitude == o.longitude
|
87
|
+
end
|
88
|
+
|
89
|
+
# @see the `==` method
|
90
|
+
# @param [Object] Object to be compared
|
91
|
+
def eql?(o)
|
92
|
+
self == o
|
93
|
+
end
|
94
|
+
|
95
|
+
# Calculates hash code according to all attributes.
|
96
|
+
# @return [Integer] Hash code
|
97
|
+
def hash
|
98
|
+
[latitude, longitude].hash
|
99
|
+
end
|
100
|
+
|
101
|
+
# Builds the object from hash
|
102
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
103
|
+
# @return [Object] Returns the model itself
|
104
|
+
def self.build_from_hash(attributes)
|
105
|
+
new.build_from_hash(attributes)
|
106
|
+
end
|
107
|
+
|
108
|
+
# Builds the object from hash
|
109
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
110
|
+
# @return [Object] Returns the model itself
|
111
|
+
def build_from_hash(attributes)
|
112
|
+
return nil unless attributes.is_a?(Hash)
|
113
|
+
self.class.openapi_types.each_pair do |key, type|
|
114
|
+
if type =~ /\AArray<(.*)>/i
|
115
|
+
# check to ensure the input is an array given that the attribute
|
116
|
+
# is documented as an array but the input is not
|
117
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
118
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
119
|
+
end
|
120
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
121
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
122
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
123
|
+
end
|
124
|
+
|
125
|
+
self
|
126
|
+
end
|
127
|
+
|
128
|
+
# Deserializes the data based on type
|
129
|
+
# @param string type Data type
|
130
|
+
# @param string value Value to be deserialized
|
131
|
+
# @return [Object] Deserialized data
|
132
|
+
def _deserialize(type, value)
|
133
|
+
case type.to_sym
|
134
|
+
when :DateTime
|
135
|
+
DateTime.parse(value)
|
136
|
+
when :Date
|
137
|
+
Date.parse(value)
|
138
|
+
when :String
|
139
|
+
value.to_s
|
140
|
+
when :Integer
|
141
|
+
value.to_i
|
142
|
+
when :Float
|
143
|
+
value.to_f
|
144
|
+
when :Boolean
|
145
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
146
|
+
true
|
147
|
+
else
|
148
|
+
false
|
149
|
+
end
|
150
|
+
when :Object
|
151
|
+
# generic object (usually a Hash), return directly
|
152
|
+
value
|
153
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
154
|
+
inner_type = Regexp.last_match[:inner_type]
|
155
|
+
value.map { |v| _deserialize(inner_type, v) }
|
156
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
157
|
+
k_type = Regexp.last_match[:k_type]
|
158
|
+
v_type = Regexp.last_match[:v_type]
|
159
|
+
{}.tap do |hash|
|
160
|
+
value.each do |k, v|
|
161
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
else # model
|
165
|
+
AdzerkDecisionSdk.const_get(type).build_from_hash(value)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
# Returns the string representation of the object
|
170
|
+
# @return [String] String presentation of the object
|
171
|
+
def to_s
|
172
|
+
to_hash.to_s
|
173
|
+
end
|
174
|
+
|
175
|
+
# to_body is an alias to to_hash (backward compatibility)
|
176
|
+
# @return [Hash] Returns the object in the form of hash
|
177
|
+
def to_body
|
178
|
+
to_hash
|
179
|
+
end
|
180
|
+
|
181
|
+
# Returns the object in the form of hash
|
182
|
+
# @return [Hash] Returns the object in the form of hash
|
183
|
+
def to_hash
|
184
|
+
hash = {}
|
185
|
+
self.class.attribute_map.each_pair do |attr, param|
|
186
|
+
value = self.send(attr)
|
187
|
+
if value.nil?
|
188
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
189
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
190
|
+
end
|
191
|
+
|
192
|
+
hash[param] = _to_hash(value)
|
193
|
+
end
|
194
|
+
hash
|
195
|
+
end
|
196
|
+
|
197
|
+
# Outputs non-array value in the form of hash
|
198
|
+
# For object, use to_hash. Otherwise, just return the value
|
199
|
+
# @param [Object] value Any valid value
|
200
|
+
# @return [Hash] Returns the value in the form of hash
|
201
|
+
def _to_hash(value)
|
202
|
+
if value.is_a?(Array)
|
203
|
+
value.compact.map { |v| _to_hash(v) }
|
204
|
+
elsif value.is_a?(Hash)
|
205
|
+
{}.tap do |hash|
|
206
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
207
|
+
end
|
208
|
+
elsif value.respond_to? :to_hash
|
209
|
+
value.to_hash
|
210
|
+
else
|
211
|
+
value
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
@@ -3,23 +3,29 @@ require 'typhoeus'
|
|
3
3
|
|
4
4
|
module AdzerkDecisionSdk
|
5
5
|
class PixelClient
|
6
|
-
def initialize(api_client)
|
6
|
+
def initialize(api_client, logger)
|
7
7
|
@api_client = api_client
|
8
|
+
@logger = logger
|
8
9
|
end
|
9
10
|
|
10
|
-
def fire(url, revenue_override: nil, additional_revenue: nil)
|
11
|
+
def fire(url, revenue_override: nil, additional_revenue: nil, event_multiplier: nil)
|
11
12
|
uri = URI(url)
|
13
|
+
@logger.info("Firing Pixel at base url of: #{uri.to_s}")
|
14
|
+
|
12
15
|
query_params = URI.decode_www_form(uri.query)
|
13
16
|
query_params << ["override", revenue_override] if not revenue_override.nil?
|
14
17
|
query_params << ["additional", additional_revenue] if not additional_revenue.nil?
|
18
|
+
query_params << ["eventMultiplier", event_multiplier] if not event_multiplier.nil?
|
15
19
|
uri.query = URI.encode_www_form(query_params)
|
16
20
|
new_url = uri.to_s()
|
17
21
|
|
22
|
+
@logger.info("After url building with overrides, requesting: #{new_url}")
|
18
23
|
request = @api_client.build_request(:GET, '')
|
19
24
|
request.base_url = new_url
|
20
25
|
response = request.run()
|
21
26
|
location = response.response_code == 302 ? response.headers['location'] : nil
|
22
27
|
|
28
|
+
@logger.info("Received response from pixel url: #{response.response_code} with location: #{location}")
|
23
29
|
[response.response_code, location]
|
24
30
|
end
|
25
31
|
end
|
@@ -2,41 +2,50 @@ require 'adzerk_decision_sdk/api/userdb_api'
|
|
2
2
|
|
3
3
|
module AdzerkDecisionSdk
|
4
4
|
class UserDbClient
|
5
|
-
def initialize(network_id, api_client)
|
5
|
+
def initialize(network_id, api_client, logger)
|
6
6
|
@network_id = network_id
|
7
7
|
@api = UserdbApi.new(api_client)
|
8
|
+
@logger = logger
|
8
9
|
end
|
9
10
|
|
10
11
|
def set_custom_properties(user_key, properties, network_id: nil)
|
12
|
+
@logger.info("Setting custom properties for #{user_key} on #{network_id || @network_id} to: #{properties}")
|
11
13
|
@api.add_custom_properties(network_id || @network_id, user_key, { body: properties })
|
12
14
|
end
|
13
15
|
|
14
16
|
def add_interest(user_key, interest, network_id: nil)
|
17
|
+
@logger.info("Adding interest #{interest} for #{user_key} on #{network_id || @network_id}")
|
15
18
|
@api.add_interests(network_id || @network_id, user_key, interest)
|
16
19
|
end
|
17
20
|
|
18
21
|
def add_retargeting_segment(user_key, advertiser_id, retargeting_segment_id, network_id: nil)
|
22
|
+
@logger.info("Adding #{advertiser_id}.#{retargeting_segment_id} rt segment for #{user_key} on #{network_id || @network_id}")
|
19
23
|
@api.add_retargeting_segment(network_id || @network_id, advertiser_id, retargeting_segment_id, user_key)
|
20
24
|
end
|
21
25
|
|
22
26
|
def forget(user_key, network_id: nil)
|
27
|
+
@logger.info("Forgetting #{user_key} on #{network_id || @network_id}")
|
23
28
|
@api.forget(network_id || @network_id, user_key)
|
24
29
|
end
|
25
30
|
|
26
31
|
def gdpr_consent(gdpr_consent, network_id: nil)
|
27
32
|
body = gdpr_consent.respond_to?('to_hash') ? gdpr_consent.to_hash() : gdpr_consent
|
33
|
+
@logger.info("Setting GDPR consent on #{network_id || @network_id} with: #{body}")
|
28
34
|
@api.gdpr_consent(network_id || @network_id, { body: body })
|
29
35
|
end
|
30
36
|
|
31
37
|
def ip_override(user_key, ip, network_id: nil)
|
38
|
+
@logger.info("Overriding IP for #{user_key} on #{network_id || @network_id} to #{ip}")
|
32
39
|
@api.ip_override(network_id || @network_id, user_key, ip)
|
33
40
|
end
|
34
41
|
|
35
42
|
def match_user(user_key, partner_id, user_id, network_id: nil)
|
43
|
+
@logger.info("Matching user #{user_key} on #{network_id || @network_id} to #{partner_id}.#{user_id}")
|
36
44
|
@api.match_user(network_id || @network_id, user_key, partner_id, user_id)
|
37
45
|
end
|
38
46
|
|
39
47
|
def opt_out(user_key, network_id: nil)
|
48
|
+
@logger.info("Opting out for #{user_key} on #{network_id || @network_id}")
|
40
49
|
@api.opt_out(network_id || @network_id, user_key)
|
41
50
|
end
|
42
51
|
|
@@ -54,11 +63,16 @@ module AdzerkDecisionSdk
|
|
54
63
|
:campaignConversions
|
55
64
|
]
|
56
65
|
|
66
|
+
@logger.info("Requesting record for #{user_key} on #{network_id || @network_id}")
|
57
67
|
user_record = @api.read(network_id || @network_id, user_key)
|
58
68
|
|
59
|
-
|
69
|
+
@logger.info("Received unfiltered response of: #{user_record}")
|
70
|
+
clean_record = user_record.delete_if do |key, _|
|
60
71
|
bad_keys.include?(key)
|
61
72
|
end
|
73
|
+
|
74
|
+
@logger.info("Returning filtered response of: #{clean_record}")
|
75
|
+
clean_record
|
62
76
|
end
|
63
77
|
end
|
64
78
|
end
|
@@ -6,10 +6,10 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.
|
9
|
+
OpenAPI Generator version: 4.3.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
13
|
module AdzerkDecisionSdk
|
14
|
-
VERSION = '1.0.0-beta.
|
14
|
+
VERSION = '1.0.0-beta.6'
|
15
15
|
end
|
Binary file
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adzerk, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -87,15 +87,16 @@ files:
|
|
87
87
|
- docs/Content.md
|
88
88
|
- docs/Decision.md
|
89
89
|
- docs/DecisionApi.md
|
90
|
-
- docs/DecisionData.md
|
91
90
|
- docs/DecisionRequest.md
|
92
91
|
- docs/DecisionResponse.md
|
93
92
|
- docs/Event.md
|
94
93
|
- docs/GdprConsent.md
|
94
|
+
- docs/MatchedPoint.md
|
95
95
|
- docs/Placement.md
|
96
96
|
- docs/PricingData.md
|
97
97
|
- docs/Request.md
|
98
98
|
- docs/RequestConsent.md
|
99
|
+
- docs/RequestLocation.md
|
99
100
|
- docs/Response.md
|
100
101
|
- docs/User.md
|
101
102
|
- docs/UserdbApi.md
|
@@ -112,18 +113,19 @@ files:
|
|
112
113
|
- lib/adzerk_decision_sdk/models/consent_request.rb
|
113
114
|
- lib/adzerk_decision_sdk/models/content.rb
|
114
115
|
- lib/adzerk_decision_sdk/models/decision.rb
|
115
|
-
- lib/adzerk_decision_sdk/models/decision_data.rb
|
116
116
|
- lib/adzerk_decision_sdk/models/decision_request.rb
|
117
117
|
- lib/adzerk_decision_sdk/models/decision_response.rb
|
118
118
|
- lib/adzerk_decision_sdk/models/event.rb
|
119
|
+
- lib/adzerk_decision_sdk/models/matched_point.rb
|
119
120
|
- lib/adzerk_decision_sdk/models/placement.rb
|
120
121
|
- lib/adzerk_decision_sdk/models/pricing_data.rb
|
122
|
+
- lib/adzerk_decision_sdk/models/request_location.rb
|
121
123
|
- lib/adzerk_decision_sdk/models/user.rb
|
122
124
|
- lib/adzerk_decision_sdk/pixel_client.rb
|
123
125
|
- lib/adzerk_decision_sdk/rate_type.rb
|
124
126
|
- lib/adzerk_decision_sdk/user_db_client.rb
|
125
127
|
- lib/adzerk_decision_sdk/version.rb
|
126
|
-
- pkg/adzerk_decision_sdk-1.0.0.gem
|
128
|
+
- pkg/adzerk_decision_sdk-1.0.0.pre.beta.3.gem
|
127
129
|
- spec/.gitkeep
|
128
130
|
- spec/placeholder_spec.rb
|
129
131
|
homepage: http://adzerk.com
|
data/docs/DecisionData.md
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# AdzerkDecisionSdk::DecisionData
|
2
|
-
|
3
|
-
## Properties
|
4
|
-
|
5
|
-
Name | Type | Description | Notes
|
6
|
-
------------ | ------------- | ------------- | -------------
|
7
|
-
**image_url** | **String** | | [optional]
|
8
|
-
**title** | **String** | | [optional]
|
9
|
-
**width** | **Integer** | | [optional]
|
10
|
-
**height** | **Integer** | | [optional]
|
11
|
-
**custom_data** | [**Object**](.md) | | [optional]
|
12
|
-
|
13
|
-
## Code Sample
|
14
|
-
|
15
|
-
```ruby
|
16
|
-
require 'AdzerkDecisionSdk'
|
17
|
-
|
18
|
-
instance = AdzerkDecisionSdk::DecisionData.new(image_url: null,
|
19
|
-
title: null,
|
20
|
-
width: null,
|
21
|
-
height: null,
|
22
|
-
custom_data: null)
|
23
|
-
```
|
24
|
-
|
25
|
-
|
Binary file
|