promoted-ruby-client 0.1.18 → 0.1.19

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: c49d0a2668c2ac163b2fb9bbfb13fcff75d6a4f558b8e62b633bc590d094c269
4
- data.tar.gz: c0bc6218512f2883bd2fcbdfc60d4f5a9da05b93a9872bd60c1ce65bbd1d6ec9
3
+ metadata.gz: 6b8a39c8af4d21ae9987db29f0041e57d54de87da119b799e89091069a0bfbc2
4
+ data.tar.gz: 7b3932706882a896f330b0bd0a3d05671111e80b97fac4403e355ae30e537750
5
5
  SHA512:
6
- metadata.gz: d92f40acf137305cbce1c2e66d3f9b40d9ed5d58f97fc84b0beb2a9ecc7a47671316c012c36279bdbed401f8d1f81001dcbf352f70507593c48d14cbd829e6b1
7
- data.tar.gz: 0fddc62d1ea650b98653b8f05680d15e9245d0259c835408113c4b4dbab4baa16360735755656d7fec42466e2254bf3fd69e7187f3dbc44e97f1b435b94afbab
6
+ metadata.gz: 3146dc2f31afa84fa2b332b1cdb5ca145e7aa51140ae14503a8ca8a4aebc96bb59c4313ee10884b85ba819c930f40f9dd88e7d88454a39a9748b42f3e7d827e5
7
+ data.tar.gz: 903cb0dca7f83acfa605db3be223833ffebe78d0e530b1e98599ed2b8b15e2b5babffb1e40704789bab45f42f3d8372a46e2263733428da2e9fea90860003cb0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- promoted-ruby-client (0.1.18)
4
+ promoted-ruby-client (0.1.19)
5
5
  concurrent-ruby (~> 1)
6
6
  faraday (>= 0.9.0)
7
7
  faraday_middleware (>= 0.9.0)
data/README.md CHANGED
@@ -94,7 +94,66 @@ Field Name | Type | Optional? | Description
94
94
  ```:request_id``` | String | Yes | Generated by the SDK when needed (*do not set*)
95
95
  ```:content_id``` | String | No | Identifier for the content to be shown, must be set.
96
96
  ```:properties``` | Properties | Yes | Any additional custom properties to associate. For v1 integrations, it is fine not to fill in all the properties.
97
+ ---
98
+ ### Size
99
+ User's screen dimensions.
100
+ Field Name | Type | Optional? | Description
101
+ ---------- | ---- | --------- | -----------
102
+ ```:width``` | Integer | No | Screen width
103
+ ```:height``` | Integer | No | Screen height
104
+ ---
105
+
106
+ ### ClientHints
107
+ 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
+ Field Name | Type | Optional? | Description
109
+ ---------- | ---- | --------- | -----------
110
+ ```:is_mobile``` | Boolean | Yes | Mobile flag
111
+ ```:brand``` | Array of ClientBrandHint | Yes |
112
+ ```:architecture``` | String | Yes |
113
+ ```:model``` | String | Yes |
114
+ ```:platform``` | String | Yes |
115
+ ```:platform_version``` | String | Yes |
116
+ ```:ua_full_version``` | String | Yes |
117
+
118
+ ---
119
+ ### ClientBrandHint
120
+ See https://raw.githubusercontent.com/snowplow/iglu-central/master/schemas/org.ietf/http_client_hints/jsonschema/1-0-0
121
+ Field Name | Type | Optional? | Description
122
+ ---------- | ---- | --------- | -----------
123
+ ```:brand``` | String | Yes | Mobile flag
124
+ ```:version``` | String | Yes |
97
125
 
126
+ ---
127
+ ### Location
128
+ Information about the user's location.
129
+ Field Name | Type | Optional? | Description
130
+ ---------- | ---- | --------- | -----------
131
+ ```:latitude``` | Float | No | Location latitude
132
+ ```:longitude``` | Float | No | Location longitude
133
+ ```:accuracy_in_meters``` | Integer | Yes | Location accuracy if available
134
+ ```:client_hints``` | ClientHints | Yes | HTTP client hints structure
135
+ ---
136
+
137
+ ### Browser
138
+ Information about the user's browser.
139
+ Field Name | Type | Optional? | Description
140
+ ---------- | ---- | --------- | -----------
141
+ ```:user_agent``` | String | Yes | Browser user agent string
142
+ ```:viewport_size``` | Size | Yes | Size of the browser viewport
143
+ ```:
144
+ ---
145
+ ### Device
146
+ Information about the user's device.
147
+ Field Name | Type | Optional? | Description
148
+ ---------- | ---- | --------- | -----------
149
+ ```:device_type``` | one of (`UNKNOWN_DEVICE_TYPE`, `DESKTOP`, `MOBILE`, `TABLET`) | Yes | Type of device
150
+ ```:brand``` | String | Yes | "Apple, "google", Samsung", etc.
151
+ ```:manufacturer``` | String | Yes | "Apple", "HTC", Motorola", "HUAWEI", etc.
152
+ ```:identifier``` | String | Yes | Android: android.os.Build.MODEL; iOS: iPhoneXX,YY, etc.
153
+ ```:screen``` | Screen | Yes | Screen dimensions
154
+ ```:ip_address``` | String | Yes | Originating IP address
155
+ ```:location``` | Location | Yes | Location information
156
+ ```:browser``` | Browser | Yes | Browser information
98
157
  ---
99
158
  ### Paging
100
159
  #### TODO
@@ -108,6 +167,7 @@ Field Name | Type | Optional? | Description
108
167
  ```:use_case``` | String | Yes | One of the use case values, i.e. 'FEED' (see [constants.rb](https://github.com/promotedai/promoted-ruby-client/blob/main/lib/promoted/ruby/client/constants.rb)).
109
168
  ```:properties``` | Properties | Yes | Any additional custom properties to associate.
110
169
  ```:paging``` | Paging | Yes | Paging parameters (see TODO)
170
+ ```:device``` | Device | Yes | Device information (as available)
111
171
  ---
112
172
  ### MetricsRequest
113
173
  Input to ```prepare_for_logging```
@@ -142,6 +202,8 @@ Field Name | Type | Optional? | Description
142
202
  ---------- | ---- | --------- | -----------
143
203
  ```:insertion``` | [] of Insertion | No | The insertions, which are from Delivery API (when ```deliver``` was called, i.e. we weren't either only-log or part of an experiment) or the input insertions (when the other conditions don't hold).
144
204
  ```:log_request``` | LogRequest | Yes | A message suitable for logging to Metrics API via ```send_log_request```. If the call to ```deliver``` was made (i.e. the request was not part of the CONTROL arm of an experiment or marked to only log), ```:log_request``` will not be set, as you can assume logging was performed on the server-side by Promoted.
205
+ ```:client_request_id``` | String | Yes | Client-generated request id sent to Delivery API and may be useful for logging and debugging.
206
+ ```:execution_server``` | one of 'API' or 'SDK' | Yes | Indicates if response insertions on a delivery request came from the API or the SDK.
145
207
  ---
146
208
 
147
209
  ### PromotedClient
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.18.gem`
7
+ 5. Run (using new output) `gem push promoted-ruby-client-0.1.19.gem`
8
8
  6. Update README with new version.
@@ -210,7 +210,9 @@ module Promoted
210
210
 
211
211
  client_response = {
212
212
  insertion: response_insertions,
213
- log_request: log_req
213
+ log_request: log_req,
214
+ execution_server: insertions_from_delivery ? Promoted::Ruby::Client::EXECUTION_SERVER['API'] : Promoted::Ruby::Client::EXECUTION_SERVER['SDK'],
215
+ client_request_id: delivery_request_builder.client_request_id
214
216
  }
215
217
  return client_response
216
218
  end
@@ -32,6 +32,13 @@ module Promoted
32
32
  CLIENT_TYPE = {'UNKNOWN_REQUEST_CLIENT' => 'UNKNOWN_REQUEST_CLIENT',
33
33
  'PLATFORM_SERVER' => 'PLATFORM_SERVER',
34
34
  'PLATFORM_CLIENT' => 'PLATFORM_CLIENT'}
35
+
36
+ EXECUTION_SERVER = {'API' => 'API', 'SDK' => 'SDK'}
37
+
38
+ DEVICE_TYPE = {'UNKNOWN_DEVICE_TYPE' => 'UNKNOWN_DEVICE_TYPE',
39
+ 'DESKTOP' => 'DESKTOP',
40
+ 'MOBILE' => 'MOBILE',
41
+ 'TABLET' => 'TABLET'}
35
42
  end
36
43
  end
37
44
  end
@@ -2,7 +2,7 @@ module Promoted
2
2
  module Ruby
3
3
  module Client
4
4
  class RequestBuilder
5
- attr_reader :session_id, :only_log, :experiment, :client_info,
5
+ attr_reader :session_id, :only_log, :experiment, :client_info, :device,
6
6
  :view_id, :insertion, :to_compact_delivery_properties_func,
7
7
  :request_id, :full_insertion, :use_case, :request, :to_compact_metrics_properties_func
8
8
 
@@ -24,6 +24,7 @@ module Promoted
24
24
  @session_id = request[:session_id]
25
25
  @platform_id = request[:platform_id]
26
26
  @client_info = request[:client_info] || {}
27
+ @device = request[:device] || {}
27
28
  @view_id = request[:view_id]
28
29
  @use_case = Promoted::Ruby::Client::USE_CASES[request[:use_case]] || Promoted::Ruby::Client::USE_CASES['UNKNOWN_USE_CASE']
29
30
  @full_insertion = args[:full_insertion]
@@ -57,6 +58,7 @@ module Promoted
57
58
  user_info: user_info,
58
59
  timing: timing,
59
60
  client_info: @client_info.merge({ :client_type => Promoted::Ruby::Client::CLIENT_TYPE['PLATFORM_SERVER'] }),
61
+ device: @device,
60
62
  platform_id: @platform_id,
61
63
  view_id: @view_id,
62
64
  session_id: @session_id,
@@ -64,7 +66,7 @@ module Promoted
64
66
  search_query: request[:search_query],
65
67
  properties: request[:properties],
66
68
  paging: request[:paging],
67
- client_request_id: request[:client_request_id]
69
+ client_request_id: client_request_id
68
70
  }
69
71
  params[:insertion] = insertions_with_compact_props(@to_compact_delivery_properties_func)
70
72
 
@@ -102,7 +104,8 @@ module Promoted
102
104
  params = {
103
105
  user_info: user_info,
104
106
  timing: timing,
105
- client_info: @client_info
107
+ client_info: @client_info,
108
+ device: @device
106
109
  }
107
110
 
108
111
  if @experiment
@@ -184,6 +187,10 @@ module Promoted
184
187
  @insertion
185
188
  end
186
189
 
190
+ def client_request_id
191
+ request[:client_request_id]
192
+ end
193
+
187
194
  private
188
195
 
189
196
  def add_missing_ids_on_insertions! request, insertions
@@ -1,7 +1,7 @@
1
1
  module Promoted
2
2
  module Ruby
3
3
  module Client
4
- VERSION = "0.1.18"
4
+ VERSION = "0.1.19"
5
5
  end
6
6
  end
7
7
  end
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.18
4
+ version: 0.1.19
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-03 00:00:00.000000000 Z
11
+ date: 2021-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday