adzerk_decision_sdk 1.0.0.pre.beta.3 → 1.0.0.pre.beta.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ad73c68c0252fbd2ccbbd837f77aa25c67b52d64cd595586f9e3040ad9199082
4
- data.tar.gz: 5059026a68d95ed6b749a56573a5e0d8bce32dafb9a6cdcbf5bcaa87a053a991
3
+ metadata.gz: 7d830e7e6e25ec7ae418affc0b46b52890aeb194c09eec309f4cf96eea8c1117
4
+ data.tar.gz: d3ab9c88d2bb6bcda4a10bfa0868144de86392b038dab1896d07ad9cdb5e258f
5
5
  SHA512:
6
- metadata.gz: 5e435954e9d9c91c2d47ebc040da9227bc00db16eb50f6cdca0b870cf2fb8876d156fbd2e8c5340db1fdea8da1091189681bbbf867cc434b99af02b66801095e
7
- data.tar.gz: 8102a548ce7a4c1a785f00afb27366a7c20debdd4daba20bcc63481e1c9a7ac19cc308719a8ec8b0e80b674524c441bb1b668f006b9f94741f0fa9c44c76d32f
6
+ metadata.gz: d7bc469e35b4578389cc518337b495d54df6650bd1c5e97ec00bf333668623da24fb05325a6d15a59bf47dc134cbc1941ac023f117f97668f018ae332340bf40
7
+ data.tar.gz: cb2e7afe0f9ec11cba6eed0389e2ea81e99b5686e927d297ba15024931c62e69ba6a27736cb8d1f1b8b87cd613a7046f80144f1f611fe145a92c48517a4d1271
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- adzerk_decision_sdk (1.0.0)
4
+ adzerk_decision_sdk (1.0.0.pre.beta.3)
5
5
  json (~> 2.1, >= 2.1.0)
6
6
  typhoeus (~> 1.0, >= 1.0.1)
7
7
 
@@ -14,9 +14,9 @@ GEM
14
14
  diff-lcs (1.3)
15
15
  ethon (0.12.0)
16
16
  ffi (>= 1.3.0)
17
- ffi (1.12.2)
17
+ ffi (1.13.1)
18
18
  jaro_winkler (1.5.4)
19
- json (2.3.0)
19
+ json (2.3.1)
20
20
  method_source (0.9.2)
21
21
  parallel (1.19.1)
22
22
  parser (2.7.0.2)
@@ -29,7 +29,7 @@ GEM
29
29
  pry (~> 0.10)
30
30
  psych (3.1.0)
31
31
  rainbow (3.0.0)
32
- rake (12.0.0)
32
+ rake (13.0.1)
33
33
  rspec (3.9.0)
34
34
  rspec-core (~> 3.9.0)
35
35
  rspec-expectations (~> 3.9.0)
@@ -52,7 +52,7 @@ GEM
52
52
  ruby-progressbar (~> 1.7)
53
53
  unicode-display_width (>= 1.4.0, < 1.6)
54
54
  ruby-progressbar (1.10.1)
55
- typhoeus (1.3.1)
55
+ typhoeus (1.4.0)
56
56
  ethon (>= 0.9.0)
57
57
  unicode-display_width (1.5.0)
58
58
 
@@ -62,7 +62,7 @@ PLATFORMS
62
62
  DEPENDENCIES
63
63
  adzerk_decision_sdk!
64
64
  pry-byebug
65
- rake (~> 12.0.0)
65
+ rake (~> 13.0.1)
66
66
  rspec (~> 3.6, >= 3.6.0)
67
67
  rubocop (~> 0.66.0)
68
68
 
@@ -20,6 +20,7 @@ Name | Type | Description | Notes
20
20
  **count** | **Integer** | (BETA) The number of ads to return per placement. Integer between 1 and 20 | [optional]
21
21
  **proportionality** | **Boolean** | (BETA) If true, fills ads in a multi-winner placement in proportion to the flight&#39;s goals | [optional]
22
22
  **ecpm_partition** | **String** | (BETA) The name of the eCPM Partition that should be used to source eCPM data for auctions | [optional]
23
+ **event_multiplier** | **Integer** | | [optional]
23
24
 
24
25
  ## Code Sample
25
26
 
@@ -41,7 +42,8 @@ instance = AdzerkDecisionSdk::Placement.new(div_name: null,
41
42
  content_keys: null,
42
43
  count: null,
43
44
  proportionality: null,
44
- ecpm_partition: null)
45
+ ecpm_partition: null,
46
+ event_multiplier: null)
45
47
  ```
46
48
 
47
49
 
@@ -13,7 +13,6 @@ Method | HTTP request | Description
13
13
  [**match_user**](UserdbApi.md#match_user) | **GET** /udb/{networkId}/sync/i.gif |
14
14
  [**opt_out**](UserdbApi.md#opt_out) | **GET** /udb/{networkId}/optout/i.gif |
15
15
  [**read**](UserdbApi.md#read) | **GET** /udb/{networkId}/read |
16
- [**set_user_cookie**](UserdbApi.md#set_user_cookie) | **GET** /udb/{networkId}/set/i.gif |
17
16
 
18
17
 
19
18
 
@@ -486,51 +485,3 @@ No authorization required
486
485
  - **Content-Type**: Not defined
487
486
  - **Accept**: application/json
488
487
 
489
-
490
- ## set_user_cookie
491
-
492
- > File set_user_cookie(network_id, user_key)
493
-
494
-
495
-
496
- Set User Cookie
497
-
498
- ### Example
499
-
500
- ```ruby
501
- # load the gem
502
- require 'adzerk_decision_sdk'
503
-
504
- api_instance = AdzerkDecisionSdk::UserdbApi.new
505
- network_id = 56 # Integer | Your Network Id
506
- user_key = 'user_key_example' # String | UserDB Id for the user
507
-
508
- begin
509
- result = api_instance.set_user_cookie(network_id, user_key)
510
- p result
511
- rescue AdzerkDecisionSdk::ApiError => e
512
- puts "Exception when calling UserdbApi->set_user_cookie: #{e}"
513
- end
514
- ```
515
-
516
- ### Parameters
517
-
518
-
519
- Name | Type | Description | Notes
520
- ------------- | ------------- | ------------- | -------------
521
- **network_id** | **Integer**| Your Network Id |
522
- **user_key** | **String**| UserDB Id for the user |
523
-
524
- ### Return type
525
-
526
- **File**
527
-
528
- ### Authorization
529
-
530
- No authorization required
531
-
532
- ### HTTP request headers
533
-
534
- - **Content-Type**: Not defined
535
- - **Accept**: image/gif
536
-
@@ -660,72 +660,5 @@ module AdzerkDecisionSdk
660
660
  end
661
661
  return data, status_code, headers
662
662
  end
663
-
664
- # Set User Cookie
665
- # @param network_id [Integer] Your Network Id
666
- # @param user_key [String] UserDB Id for the user
667
- # @param [Hash] opts the optional parameters
668
- # @return [File]
669
- def set_user_cookie(network_id, user_key, opts = {})
670
- data, _status_code, _headers = set_user_cookie_with_http_info(network_id, user_key, opts)
671
- data
672
- end
673
-
674
- # Set User Cookie
675
- # @param network_id [Integer] Your Network Id
676
- # @param user_key [String] UserDB Id for the user
677
- # @param [Hash] opts the optional parameters
678
- # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers
679
- def set_user_cookie_with_http_info(network_id, user_key, opts = {})
680
- if @api_client.config.debugging
681
- @api_client.config.logger.debug 'Calling API: UserdbApi.set_user_cookie ...'
682
- end
683
- # verify the required parameter 'network_id' is set
684
- if @api_client.config.client_side_validation && network_id.nil?
685
- fail ArgumentError, "Missing the required parameter 'network_id' when calling UserdbApi.set_user_cookie"
686
- end
687
- # verify the required parameter 'user_key' is set
688
- if @api_client.config.client_side_validation && user_key.nil?
689
- fail ArgumentError, "Missing the required parameter 'user_key' when calling UserdbApi.set_user_cookie"
690
- end
691
- # resource path
692
- local_var_path = '/udb/{networkId}/set/i.gif'.sub('{' + 'networkId' + '}', CGI.escape(network_id.to_s))
693
-
694
- # query parameters
695
- query_params = opts[:query_params] || {}
696
- query_params[:'userKey'] = user_key
697
-
698
- # header parameters
699
- header_params = opts[:header_params] || {}
700
- # HTTP header 'Accept' (if needed)
701
- header_params['Accept'] = @api_client.select_header_accept(['image/gif'])
702
-
703
- # form parameters
704
- form_params = opts[:form_params] || {}
705
-
706
- # http body (model)
707
- post_body = opts[:body]
708
-
709
- # return_type
710
- return_type = opts[:return_type] || 'File'
711
-
712
- # auth_names
713
- auth_names = opts[:auth_names] || []
714
-
715
- new_options = opts.merge(
716
- :header_params => header_params,
717
- :query_params => query_params,
718
- :form_params => form_params,
719
- :body => post_body,
720
- :auth_names => auth_names,
721
- :return_type => return_type
722
- )
723
-
724
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
725
- if @api_client.config.debugging
726
- @api_client.config.logger.debug "API called: UserdbApi#set_user_cookie\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
727
- end
728
- return data, status_code, headers
729
- end
730
663
  end
731
664
  end
@@ -36,8 +36,8 @@ module AdzerkDecisionSdk
36
36
  api_client.default_headers['X-Adzerk-Sdk-Version'] = "adzerk-decision-sdk-ruby:#{version}"
37
37
 
38
38
  @decisions = DecisionClient.new(network_id, site_id, api_client, configuration.logger)
39
- @user_db = UserDbClient.new(network_id, api_client)
40
- @pixels = PixelClient.new(api_client)
39
+ @user_db = UserDbClient.new(network_id, api_client, configuration.logger)
40
+ @pixels = PixelClient.new(api_client, configuration.logger)
41
41
  end
42
42
  end
43
43
  end
@@ -62,6 +62,8 @@ module AdzerkDecisionSdk
62
62
  # (BETA) The name of the eCPM Partition that should be used to source eCPM data for auctions
63
63
  attr_accessor :ecpm_partition
64
64
 
65
+ attr_accessor :event_multiplier
66
+
65
67
  # Attribute mapping from ruby-style variable name to JSON key.
66
68
  def self.attribute_map
67
69
  {
@@ -80,7 +82,8 @@ module AdzerkDecisionSdk
80
82
  :'content_keys' => :'contentKeys',
81
83
  :'count' => :'count',
82
84
  :'proportionality' => :'proportionality',
83
- :'ecpm_partition' => :'ecpmPartition'
85
+ :'ecpm_partition' => :'ecpmPartition',
86
+ :'event_multiplier' => :'eventMultiplier'
84
87
  }
85
88
  end
86
89
 
@@ -102,7 +105,8 @@ module AdzerkDecisionSdk
102
105
  :'content_keys' => :'Hash<String, Integer>',
103
106
  :'count' => :'Integer',
104
107
  :'proportionality' => :'Boolean',
105
- :'ecpm_partition' => :'String'
108
+ :'ecpm_partition' => :'String',
109
+ :'event_multiplier' => :'Integer'
106
110
  }
107
111
  end
108
112
 
@@ -120,7 +124,8 @@ module AdzerkDecisionSdk
120
124
  :'content_keys',
121
125
  :'count',
122
126
  :'proportionality',
123
- :'ecpm_partition'
127
+ :'ecpm_partition',
128
+ :'event_multiplier'
124
129
  ])
125
130
  end
126
131
 
@@ -210,21 +215,49 @@ module AdzerkDecisionSdk
210
215
  if attributes.key?(:'ecpm_partition')
211
216
  self.ecpm_partition = attributes[:'ecpm_partition']
212
217
  end
218
+
219
+ if attributes.key?(:'event_multiplier')
220
+ self.event_multiplier = attributes[:'event_multiplier']
221
+ end
213
222
  end
214
223
 
215
224
  # Show invalid properties with the reasons. Usually used together with valid?
216
225
  # @return Array for valid properties with the reasons
217
226
  def list_invalid_properties
218
227
  invalid_properties = Array.new
228
+ if !@event_multiplier.nil? && @event_multiplier > 100000000
229
+ invalid_properties.push('invalid value for "event_multiplier", must be smaller than or equal to 100000000.')
230
+ end
231
+
232
+ if !@event_multiplier.nil? && @event_multiplier < -100000000
233
+ invalid_properties.push('invalid value for "event_multiplier", must be greater than or equal to -100000000.')
234
+ end
235
+
219
236
  invalid_properties
220
237
  end
221
238
 
222
239
  # Check to see if the all the properties in the model are valid
223
240
  # @return true if the model is valid
224
241
  def valid?
242
+ return false if !@event_multiplier.nil? && @event_multiplier > 100000000
243
+ return false if !@event_multiplier.nil? && @event_multiplier < -100000000
225
244
  true
226
245
  end
227
246
 
247
+ # Custom attribute writer method with validation
248
+ # @param [Object] event_multiplier Value to be assigned
249
+ def event_multiplier=(event_multiplier)
250
+ if !event_multiplier.nil? && event_multiplier > 100000000
251
+ fail ArgumentError, 'invalid value for "event_multiplier", must be smaller than or equal to 100000000.'
252
+ end
253
+
254
+ if !event_multiplier.nil? && event_multiplier < -100000000
255
+ fail ArgumentError, 'invalid value for "event_multiplier", must be greater than or equal to -100000000.'
256
+ end
257
+
258
+ @event_multiplier = event_multiplier
259
+ end
260
+
228
261
  # Checks equality by comparing each attribute.
229
262
  # @param [Object] Object to be compared
230
263
  def ==(o)
@@ -245,7 +278,8 @@ module AdzerkDecisionSdk
245
278
  content_keys == o.content_keys &&
246
279
  count == o.count &&
247
280
  proportionality == o.proportionality &&
248
- ecpm_partition == o.ecpm_partition
281
+ ecpm_partition == o.ecpm_partition &&
282
+ event_multiplier == o.event_multiplier
249
283
  end
250
284
 
251
285
  # @see the `==` method
@@ -257,7 +291,7 @@ module AdzerkDecisionSdk
257
291
  # Calculates hash code according to all attributes.
258
292
  # @return [Integer] Hash code
259
293
  def hash
260
- [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].hash
294
+ [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, event_multiplier].hash
261
295
  end
262
296
 
263
297
  # Builds the object from hash
@@ -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
- user_record.delete_if do |key, _|
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
@@ -11,5 +11,5 @@ OpenAPI Generator version: 4.3.1
11
11
  =end
12
12
 
13
13
  module AdzerkDecisionSdk
14
- VERSION = '1.0.0-beta.3'
14
+ VERSION = '1.0.0-beta.4'
15
15
  end
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.3
4
+ version: 1.0.0.pre.beta.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adzerk, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-26 00:00:00.000000000 Z
11
+ date: 2020-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -123,9 +123,7 @@ files:
123
123
  - lib/adzerk_decision_sdk/rate_type.rb
124
124
  - lib/adzerk_decision_sdk/user_db_client.rb
125
125
  - lib/adzerk_decision_sdk/version.rb
126
- - pkg/adzerk_decision_sdk-1.0.0.gem
127
- - pkg/adzerk_decision_sdk-1.0.0.pre.beta.1.gem
128
- - pkg/adzerk_decision_sdk-1.0.0.pre.beta.2.gem
126
+ - pkg/adzerk_decision_sdk-1.0.0.pre.beta.3.gem
129
127
  - spec/.gitkeep
130
128
  - spec/placeholder_spec.rb
131
129
  homepage: http://adzerk.com