recapi 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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +14 -1
  3. data/lib/recapi.rb +12 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d35f47328f77966c86c8e878287daf33ec8d124022a53886261026d59dcb1f5
4
- data.tar.gz: 71ba6c97a3725dc7d713f6f7ce18c4192af93b64e1e2a0fe3c796effc7074f16
3
+ metadata.gz: eb0159dbbb16fbcdcbf3521d176be80a7f6b0ac32f597ae6be4e64cc72c5e0ff
4
+ data.tar.gz: 4897a48ece87f2981a3ad2393f8564ca5d0090dea5a5eb4ab725d397fc562ce8
5
5
  SHA512:
6
- metadata.gz: 4cfa62dbe9f9406553978b4bb365344230b1bb96e125487aff7e651fc922cf3dc47994acb7bb464b3f7af8168e6469f51cfff37c85f646d1fd159c45919f1ba9
7
- data.tar.gz: a14ead0cea8e039816d866bdd6522a75bfb8ceffdb51c07a6b72a86ec0ac4a762b909c0e12130e29a0936bf61ef195dcfbdd95e2d5a3d5b624316bfda4ae10a5
6
+ metadata.gz: b1003bce4fb708f86872b87b1f12f9a19711c82b3d8ee24a72b436fd05f507b4d361eea01bead3fdbe9859aefbb28de2e795015cba7f5e46e7126f1fd69a9a53
7
+ data.tar.gz: 3fe594aabd5ff99fa4eba82044a5df92fd1dbfb7e07785dcdf8ff4b1216055d610879c24231eb41a9d1b8d5d833e82526fe6e19f35e111f931ec3a3b177aba90
data/README.md CHANGED
@@ -28,7 +28,7 @@ line with your address): save it as `lib/recapi.rb` and
28
28
  `require Rails.root.join("lib/recapi").to_s` instead.
29
29
 
30
30
  ```sh
31
- curl -fLo lib/recapi.rb https://api.<your-domain>/sdk/ruby/recapi-0.1.19.rb
31
+ curl -fLo lib/recapi.rb https://api.<your-domain>/sdk/ruby/recapi-0.1.20.rb
32
32
  ```
33
33
 
34
34
  ## Quick start
@@ -74,6 +74,17 @@ similar, accessories = RECAPI.recommend_lists(user_id: current_user.id, exclude:
74
74
  Each list takes `recommend`'s `placement`, `count`, `tags_any`, `tags_all`,
75
75
  `exclude`, `context_item_id` and `discovery`; it fails and falls back as `recommend` does, row by row.
76
76
 
77
+ The home page's second row, the products the visitor opened and has not bought, is the built-in
78
+ placement `Recapi::RECENTLY_VIEWED`: ask it after the first row, with nothing to set in the dashboard
79
+ (`Recapi::BOUGHT_TOGETHER` is the product page's second row).
80
+
81
+ ```ruby
82
+ home, recently_viewed = RECAPI.recommend_lists(user_id: current_user.id, lists: [
83
+ { placement: "home", count: 4 },
84
+ { placement: Recapi::RECENTLY_VIEWED, count: 4 }
85
+ ])
86
+ ```
87
+
77
88
  ## Calls
78
89
 
79
90
  A refused argument (an invalid id or level) raises `ArgumentError`, except an
@@ -138,6 +149,8 @@ so a visitor who never returns stays on disk (about 8 KB each): run
138
149
 
139
150
  ## Changes
140
151
 
152
+ - 2026-11-28: version 0.1.20. `Recapi::RECENTLY_VIEWED` and `Recapi::BOUGHT_TOGETHER`
153
+ name the built-in placements, the home page's and the product page's second rows.
141
154
  - 2026-11-23: version 0.1.19. The comment on `Item#why` names the reason code
142
155
  `viewed_earlier`, a product the visitor opened earlier.
143
156
  - 2026-11-22: version 0.1.18. The saved history keeps, per product, the strongest
data/lib/recapi.rb CHANGED
@@ -25,7 +25,18 @@ rescue LoadError
25
25
  end
26
26
 
27
27
  module Recapi
28
- VERSION = "0.1.19"
28
+ VERSION = "0.1.20"
29
+
30
+ # The built-in placements, which serve their own list with nothing to set
31
+ # in the dashboard. Ask each beside the page's first row in one
32
+ # recommend_lists call, after it, so it never repeats that row.
33
+ #
34
+ # RECENTLY_VIEWED is a home page's second row: the products the visitor
35
+ # opened and has not bought, newest first, filled from the default list.
36
+ RECENTLY_VIEWED = "recently_viewed"
37
+ # BOUGHT_TOGETHER is a product page's second row: what shoppers carted or
38
+ # bought with the product on screen.
39
+ BOUGHT_TOGETHER = "bought_together"
29
40
 
30
41
  # Decayed user history, exactly as docs/history-spec.md (times in unix ms).
31
42
  # A port of sdk/python's history.py, snapshot merging included.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recapi
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
  - recapi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-11-24 00:00:00.000000000 Z
11
+ date: 2026-12-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'Ruby client for the recapi recommendation API: per-user history, event
14
14
  batching, retries, popular fallback. Standard library only.'