adzerk_decision_sdk 1.0.0.pre.beta.3 → 1.0.0.pre.beta.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +8 -10
  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 -25
  8. data/docs/DecisionApi.md +30 -13
  9. data/docs/DecisionRequest.md +44 -33
  10. data/docs/DecisionResponse.md +12 -11
  11. data/docs/Event.md +10 -9
  12. data/docs/MatchedPoint.md +20 -0
  13. data/docs/Placement.md +46 -37
  14. data/docs/PricingData.md +16 -15
  15. data/docs/RequestLocation.md +19 -0
  16. data/docs/User.md +8 -7
  17. data/docs/UserdbApi.md +252 -140
  18. data/lib/adzerk_decision_sdk.rb +1 -1
  19. data/lib/adzerk_decision_sdk/api/decision_api.rb +5 -4
  20. data/lib/adzerk_decision_sdk/api/userdb_api.rb +37 -95
  21. data/lib/adzerk_decision_sdk/api_client.rb +50 -48
  22. data/lib/adzerk_decision_sdk/api_error.rb +1 -1
  23. data/lib/adzerk_decision_sdk/client.rb +4 -3
  24. data/lib/adzerk_decision_sdk/configuration.rb +39 -10
  25. data/lib/adzerk_decision_sdk/decision_client.rb +18 -7
  26. data/lib/adzerk_decision_sdk/models/consent_request.rb +19 -7
  27. data/lib/adzerk_decision_sdk/models/content.rb +20 -8
  28. data/lib/adzerk_decision_sdk/models/decision.rb +31 -8
  29. data/lib/adzerk_decision_sdk/models/decision_request.rb +74 -12
  30. data/lib/adzerk_decision_sdk/models/decision_response.rb +19 -7
  31. data/lib/adzerk_decision_sdk/models/event.rb +19 -7
  32. data/lib/adzerk_decision_sdk/models/matched_point.rb +227 -0
  33. data/lib/adzerk_decision_sdk/models/placement.rb +91 -12
  34. data/lib/adzerk_decision_sdk/models/pricing_data.rb +19 -7
  35. data/lib/adzerk_decision_sdk/models/{decision_data.rb → request_location.rb} +16 -52
  36. data/lib/adzerk_decision_sdk/models/user.rb +19 -7
  37. data/lib/adzerk_decision_sdk/pixel_client.rb +8 -2
  38. data/lib/adzerk_decision_sdk/user_db_client.rb +18 -4
  39. data/lib/adzerk_decision_sdk/version.rb +1 -1
  40. data/spec/spec_helper.rb +91 -0
  41. metadata +15 -34
  42. data/docs/DecisionData.md +0 -27
  43. data/pkg/adzerk_decision_sdk-1.0.0.gem +0 -0
  44. data/pkg/adzerk_decision_sdk-1.0.0.pre.beta.1.gem +0 -0
  45. data/pkg/adzerk_decision_sdk-1.0.0.pre.beta.2.gem +0 -0
@@ -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)
11
- @api.add_custom_properties(network_id || @network_id, user_key, { body: properties })
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, { debug_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
28
- @api.gdpr_consent(network_id || @network_id, { body: body })
33
+ @logger.info("Setting GDPR consent on #{network_id || @network_id} with: #{body}")
34
+ @api.gdpr_consent(network_id || @network_id, { debug_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.8'
15
15
  end
@@ -0,0 +1,91 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # The `.rspec` file also contains a few flags that are not defaults but that
16
+ # users commonly want.
17
+ #
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
+ RSpec.configure do |config|
20
+ # rspec-expectations config goes here. You can use an alternate
21
+ # assertion/expectation library such as wrong or the stdlib/minitest
22
+ # assertions if you prefer.
23
+ config.expect_with :rspec do |expectations|
24
+ # This option will default to `true` in RSpec 4. It makes the `description`
25
+ # and `failure_message` of custom matchers include text for helper methods
26
+ # defined using `chain`, e.g.:
27
+ # be_bigger_than(2).and_smaller_than(4).description
28
+ # # => "be bigger than 2 and smaller than 4"
29
+ # ...rather than:
30
+ # # => "be bigger than 2"
31
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
32
+ end
33
+
34
+ # rspec-mocks config goes here. You can use an alternate test double
35
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
36
+ config.mock_with :rspec do |mocks|
37
+ # Prevents you from mocking or stubbing a method that does not exist on
38
+ # a real object. This is generally recommended, and will default to
39
+ # `true` in RSpec 4.
40
+ mocks.verify_partial_doubles = true
41
+ end
42
+
43
+ # The settings below are suggested to provide a good initial experience
44
+ # with RSpec, but feel free to customize to your heart's content.
45
+ =begin
46
+ # These two settings work together to allow you to limit a spec run
47
+ # to individual examples or groups you care about by tagging them with
48
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
49
+ # get run.
50
+ config.filter_run :focus
51
+ config.run_all_when_everything_filtered = true
52
+
53
+ # Limits the available syntax to the non-monkey patched syntax that is
54
+ # recommended. For more details, see:
55
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
56
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
57
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
58
+ config.disable_monkey_patching!
59
+
60
+ # This setting enables warnings. It's recommended, but in some cases may
61
+ # be too noisy due to issues in dependencies.
62
+ config.warnings = true
63
+
64
+ # Many RSpec users commonly either run the entire suite or an individual
65
+ # file, and it's useful to allow more verbose output when running an
66
+ # individual spec file.
67
+ if config.files_to_run.one?
68
+ # Use the documentation formatter for detailed output,
69
+ # unless a formatter has already been configured
70
+ # (e.g. via a command-line flag).
71
+ config.default_formatter = 'doc'
72
+ end
73
+
74
+ # Print the 10 slowest examples and example groups at the
75
+ # end of the spec run, to help surface which specs are running
76
+ # particularly slow.
77
+ config.profile_examples = 10
78
+
79
+ # Run specs in random order to surface order dependencies. If you find an
80
+ # order dependency and want to debug it, you can fix the order by providing
81
+ # the seed, which is printed after each run.
82
+ # --seed 1234
83
+ config.order = :random
84
+
85
+ # Seed global randomization in this process using the `--seed` CLI option.
86
+ # Setting this allows you to use `--seed` to deterministically reproduce
87
+ # test failures related to randomization by passing the same `--seed` value
88
+ # as the one that triggered the failure.
89
+ Kernel.srand config.seed
90
+ =end
91
+ 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.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: 2020-06-26 00:00:00.000000000 Z
11
+ date: 2021-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -31,45 +31,25 @@ dependencies:
31
31
  - !ruby/object:Gem::Version
32
32
  version: 1.0.1
33
33
  - !ruby/object:Gem::Dependency
34
- name: json
34
+ name: rspec
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '2.1'
40
37
  - - ">="
41
38
  - !ruby/object:Gem::Version
42
- version: 2.1.0
43
- type: :runtime
44
- prerelease: false
45
- version_requirements: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '2.1'
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- version: 2.1.0
53
- - !ruby/object:Gem::Dependency
54
- name: rspec
55
- requirement: !ruby/object:Gem::Requirement
56
- requirements:
39
+ version: 3.6.0
57
40
  - - "~>"
58
41
  - !ruby/object:Gem::Version
59
42
  version: '3.6'
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: 3.6.0
63
43
  type: :development
64
44
  prerelease: false
65
45
  version_requirements: !ruby/object:Gem::Requirement
66
46
  requirements:
67
- - - "~>"
68
- - !ruby/object:Gem::Version
69
- version: '3.6'
70
47
  - - ">="
71
48
  - !ruby/object:Gem::Version
72
49
  version: 3.6.0
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '3.6'
73
53
  description: Ruby library for the Adzerk Decision API
74
54
  email:
75
55
  - engineering@adzerk.com
@@ -87,15 +67,16 @@ files:
87
67
  - docs/Content.md
88
68
  - docs/Decision.md
89
69
  - docs/DecisionApi.md
90
- - docs/DecisionData.md
91
70
  - docs/DecisionRequest.md
92
71
  - docs/DecisionResponse.md
93
72
  - docs/Event.md
94
73
  - docs/GdprConsent.md
74
+ - docs/MatchedPoint.md
95
75
  - docs/Placement.md
96
76
  - docs/PricingData.md
97
77
  - docs/Request.md
98
78
  - docs/RequestConsent.md
79
+ - docs/RequestLocation.md
99
80
  - docs/Response.md
100
81
  - docs/User.md
101
82
  - docs/UserdbApi.md
@@ -112,22 +93,21 @@ files:
112
93
  - lib/adzerk_decision_sdk/models/consent_request.rb
113
94
  - lib/adzerk_decision_sdk/models/content.rb
114
95
  - lib/adzerk_decision_sdk/models/decision.rb
115
- - lib/adzerk_decision_sdk/models/decision_data.rb
116
96
  - lib/adzerk_decision_sdk/models/decision_request.rb
117
97
  - lib/adzerk_decision_sdk/models/decision_response.rb
118
98
  - lib/adzerk_decision_sdk/models/event.rb
99
+ - lib/adzerk_decision_sdk/models/matched_point.rb
119
100
  - lib/adzerk_decision_sdk/models/placement.rb
120
101
  - lib/adzerk_decision_sdk/models/pricing_data.rb
102
+ - lib/adzerk_decision_sdk/models/request_location.rb
121
103
  - lib/adzerk_decision_sdk/models/user.rb
122
104
  - lib/adzerk_decision_sdk/pixel_client.rb
123
105
  - lib/adzerk_decision_sdk/rate_type.rb
124
106
  - lib/adzerk_decision_sdk/user_db_client.rb
125
107
  - 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
129
108
  - spec/.gitkeep
130
109
  - spec/placeholder_spec.rb
110
+ - spec/spec_helper.rb
131
111
  homepage: http://adzerk.com
132
112
  licenses:
133
113
  - Apache-2.0
@@ -140,16 +120,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
140
120
  requirements:
141
121
  - - ">="
142
122
  - !ruby/object:Gem::Version
143
- version: '1.9'
123
+ version: '2.4'
144
124
  required_rubygems_version: !ruby/object:Gem::Requirement
145
125
  requirements:
146
126
  - - ">"
147
127
  - !ruby/object:Gem::Version
148
128
  version: 1.3.1
149
129
  requirements: []
150
- rubygems_version: 3.1.2
130
+ rubygems_version: 3.0.3.1
151
131
  signing_key:
152
132
  specification_version: 4
153
133
  summary: Adzerk Decision API
154
134
  test_files:
155
135
  - spec/placeholder_spec.rb
136
+ - spec/spec_helper.rb
data/docs/DecisionData.md DELETED
@@ -1,27 +0,0 @@
1
- # AdzerkDecisionSdk::DecisionData
2
-
3
- ## Properties
4
-
5
- Name | Type | Description | Notes
6
- ------------ | ------------- | ------------- | -------------
7
- **image_url** | **String** | | [optional]
8
- **file_name** | **String** | | [optional]
9
- **title** | **String** | | [optional]
10
- **width** | **Integer** | | [optional]
11
- **height** | **Integer** | | [optional]
12
- **custom_data** | [**Object**](.md) | | [optional]
13
-
14
- ## Code Sample
15
-
16
- ```ruby
17
- require 'AdzerkDecisionSdk'
18
-
19
- instance = AdzerkDecisionSdk::DecisionData.new(image_url: null,
20
- file_name: null,
21
- title: null,
22
- width: null,
23
- height: null,
24
- custom_data: null)
25
- ```
26
-
27
-
Binary file