promoted-ruby-client 0.1.19 → 0.1.20

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6b8a39c8af4d21ae9987db29f0041e57d54de87da119b799e89091069a0bfbc2
4
- data.tar.gz: 7b3932706882a896f330b0bd0a3d05671111e80b97fac4403e355ae30e537750
3
+ metadata.gz: 340cf31fbc7680c1b9abb8df8dd1226e4a13fed103e21815afb82fb43b85f481
4
+ data.tar.gz: d5448efcb375ac090847ac6c37fcda3b57babf0dca6043d82967e8ecdb42ae52
5
5
  SHA512:
6
- metadata.gz: 3146dc2f31afa84fa2b332b1cdb5ca145e7aa51140ae14503a8ca8a4aebc96bb59c4313ee10884b85ba819c930f40f9dd88e7d88454a39a9748b42f3e7d827e5
7
- data.tar.gz: 903cb0dca7f83acfa605db3be223833ffebe78d0e530b1e98599ed2b8b15e2b5babffb1e40704789bab45f42f3d8372a46e2263733428da2e9fea90860003cb0
6
+ metadata.gz: df18a2f73308fd9771b55a8762592a4041059b5d5fe72e0de07fa9566eb8627647eef75276a401c6f9da7d03bfc7158deb94bfd6b5824d22635a22b7d11848f0
7
+ data.tar.gz: 7ed68c19270dcd13b8ed2347138aa845dd767d19bc257312e1a001f0e858879e75186142b9719b31e9c132d95fc7d48049baaf3e57b442f39f2b969cf2c835b8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- promoted-ruby-client (0.1.19)
4
+ promoted-ruby-client (0.1.20)
5
5
  concurrent-ruby (~> 1)
6
6
  faraday (>= 0.9.0)
7
7
  faraday_middleware (>= 0.9.0)
data/README.md CHANGED
@@ -103,6 +103,14 @@ Field Name | Type | Optional? | Description
103
103
  ```:height``` | Integer | No | Screen height
104
104
  ---
105
105
 
106
+ ### Screen
107
+ State of the screen including scaling.
108
+ Field Name | Type | Optional? | Description
109
+ ---------- | ---- | --------- | -----------
110
+ ```:size``` | Size | Yes | Screen size
111
+ ```:scale``` | Float | Yes | Current screen scaling factor
112
+ ---
113
+
106
114
  ### ClientHints
107
115
  Alternative to user-agent strings. See https://raw.githubusercontent.com/snowplow/iglu-central/master/schemas/org.ietf/http_client_hints/jsonschema/1-0-0
108
116
  Field Name | Type | Optional? | Description
@@ -131,7 +139,6 @@ Field Name | Type | Optional? | Description
131
139
  ```:latitude``` | Float | No | Location latitude
132
140
  ```:longitude``` | Float | No | Location longitude
133
141
  ```:accuracy_in_meters``` | Integer | Yes | Location accuracy if available
134
- ```:client_hints``` | ClientHints | Yes | HTTP client hints structure
135
142
  ---
136
143
 
137
144
  ### Browser
@@ -140,7 +147,7 @@ Field Name | Type | Optional? | Description
140
147
  ---------- | ---- | --------- | -----------
141
148
  ```:user_agent``` | String | Yes | Browser user agent string
142
149
  ```:viewport_size``` | Size | Yes | Size of the browser viewport
143
- ```:
150
+ ```:client_hints``` | ClientHints | Yes | HTTP client hints structure
144
151
  ---
145
152
  ### Device
146
153
  Information about the user's device.
data/dev.md CHANGED
@@ -4,5 +4,5 @@
4
4
  2. Get credentials for deployment from 1password.
5
5
  3. Modify `promoted-ruby-client.gemspec`'s push block.
6
6
  4. Run `gem build promoted-ruby-client.gemspec` to generate `gem`.
7
- 5. Run (using new output) `gem push promoted-ruby-client-0.1.19.gem`
7
+ 5. Run (using new output) `gem push promoted-ruby-client-0.1.20.gem`
8
8
  6. Update README with new version.
@@ -39,7 +39,7 @@ module Promoted
39
39
 
40
40
  ##
41
41
  # Create and configure a new Promoted client.
42
- def initialize (params={})
42
+ def initialize(params={})
43
43
  @perform_checks = true
44
44
  if params[:perform_checks] != nil
45
45
  @perform_checks = params[:perform_checks]
@@ -175,7 +175,7 @@ module Promoted
175
175
 
176
176
  insertions_from_delivery = (response != nil && !deliver_err);
177
177
  response_insertions = delivery_request_builder.fill_details_from_response(
178
- response ? response[:insertion] : [])
178
+ response && response[:insertion] || [])
179
179
  end
180
180
  end
181
181
 
@@ -318,7 +318,7 @@ module Promoted
318
318
 
319
319
  ellapsed_time = Time.now - start_time
320
320
  @logger.debug("Sync send_request completed in #{ellapsed_time.to_f * 1000} ms") if @logger
321
- end
321
+ end
322
322
 
323
323
  return resp
324
324
  end
@@ -357,7 +357,7 @@ module Promoted
357
357
 
358
358
  if !@async_shadow_traffic
359
359
  ellapsed_time = Time.now - start_time
360
- insertions = response ? response[:insertion] : []
360
+ insertions = response && response[:insertion] || []
361
361
  @logger.info("Shadow traffic call completed in #{ellapsed_time.to_f * 1000} ms with #{insertions.length} insertions") if @logger
362
362
  end
363
363
  end
@@ -11,13 +11,13 @@ module Promoted
11
11
  end
12
12
 
13
13
  class Pager
14
- def validate_paging (insertions, paging)
14
+ def validate_paging(insertions, paging)
15
15
  if paging && paging[:offset] && paging[:offset] >= insertions.length
16
16
  raise InvalidPagingError.new("Invalid page offset (insertion size #{insertions.length}, offset #{paging[:offset]})", [])
17
17
  end
18
18
  end
19
19
 
20
- def apply_paging (insertions, insertion_page_type, paging = nil)
20
+ def apply_paging(insertions, insertion_page_type, paging = nil)
21
21
  begin
22
22
  validate_paging(insertions, paging)
23
23
  rescue InvalidPagingError => err
@@ -47,7 +47,7 @@ module Promoted
47
47
  size = insertions.length
48
48
  end
49
49
 
50
- final_insertion_size = [size, insertions.length].min
50
+ final_insertion_size = [size, insertions.length - index].min
51
51
  insertion_page = Array.new(final_insertion_size)
52
52
  0.upto(final_insertion_size - 1) {|i|
53
53
  insertion = insertions[index]
@@ -63,5 +63,5 @@ module Promoted
63
63
  end
64
64
  end
65
65
  end
66
- end
66
+ end
67
67
  end
@@ -78,7 +78,7 @@ module Promoted
78
78
  # to the responses.
79
79
  def fill_details_from_response response_insertions
80
80
  if !response_insertions then
81
- response_insertions = full_insertion
81
+ response_insertions = []
82
82
  end
83
83
 
84
84
  props = @full_insertion.each_with_object({}) do |insertion, hash|
@@ -1,7 +1,7 @@
1
1
  module Promoted
2
2
  module Ruby
3
3
  module Client
4
- VERSION = "0.1.19"
4
+ VERSION = "0.1.20"
5
5
  end
6
6
  end
7
7
  end
@@ -14,6 +14,7 @@ Gem::Specification.new do |spec|
14
14
  spec.homepage = 'https://github.com/promotedai/promoted-ruby-client'
15
15
  spec.license = 'MIT'
16
16
 
17
+ spec.metadata["allowed_push_host"] = "https://rubygems.org/"
17
18
  spec.metadata["homepage_uri"] = spec.homepage
18
19
  spec.metadata["source_code_uri"] = "https://github.com/promotedai/promoted-ruby-client"
19
20
  spec.metadata["changelog_uri"] = "https://github.com/promotedai/promoted-ruby-client/blob/master/CHANGELOG.md"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: promoted-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.19
4
+ version: 0.1.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - scottmcmaster
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-11 00:00:00.000000000 Z
11
+ date: 2021-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -150,6 +150,7 @@ homepage: https://github.com/promotedai/promoted-ruby-client
150
150
  licenses:
151
151
  - MIT
152
152
  metadata:
153
+ allowed_push_host: https://rubygems.org/
153
154
  homepage_uri: https://github.com/promotedai/promoted-ruby-client
154
155
  source_code_uri: https://github.com/promotedai/promoted-ruby-client
155
156
  changelog_uri: https://github.com/promotedai/promoted-ruby-client/blob/master/CHANGELOG.md